Skip to content

Commit

Permalink
Test zendesk bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Jul 14, 2023
1 parent 2e67b3d commit a19fb27
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions flows/actions/open_ticket.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package actions

import (
"fmt"
"strings"

"github.com/nyaruka/goflow/assets"
"github.com/nyaruka/goflow/flows"
"github.com/nyaruka/goflow/flows/events"
Expand All @@ -16,21 +19,21 @@ const TypeOpenTicket string = "open_ticket"

// OpenTicketAction is used to open a ticket for the contact.
//
// {
// "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
// "type": "open_ticket",
// "ticketer": {
// "uuid": "19dc6346-9623-4fe4-be80-538d493ecdf5",
// "name": "Support Tickets"
// },
// "topic": {
// "uuid": "472a7a73-96cb-4736-b567-056d987cc5b4",
// "name": "Weather"
// },
// "body": "@input",
// "assignee": {"email": "[email protected]", "name": "Bob McTickets"},
// "result_name": "Help Ticket"
// }
// {
// "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
// "type": "open_ticket",
// "ticketer": {
// "uuid": "19dc6346-9623-4fe4-be80-538d493ecdf5",
// "name": "Support Tickets"
// },
// "topic": {
// "uuid": "472a7a73-96cb-4736-b567-056d987cc5b4",
// "name": "Weather"
// },
// "body": "@input",
// "assignee": {"email": "[email protected]", "name": "Bob McTickets"},
// "result_name": "Help Ticket"
// }
//
// @action open_ticket
type OpenTicketAction struct {
Expand Down Expand Up @@ -82,6 +85,10 @@ func (a *OpenTicketAction) Execute(run flows.FlowRun, step flows.Step, logModifi
if ticket != nil {
a.saveResult(run, step, a.ResultName, string(ticket.UUID()), CategorySuccess, "", "", nil, logEvent)
} else {
fmt.Println("empty ticket")
if strings.HasPrefix(evaluatedBody, `{"id":`) {
a.saveResult(run, step, a.ResultName, "", CategorySuccess, "", "", nil, logEvent)
}
a.saveResult(run, step, a.ResultName, "", CategoryFailure, "", "", nil, logEvent)
}

Expand Down

0 comments on commit a19fb27

Please sign in to comment.