Skip to content

Commit

Permalink
Add external_id to ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Nov 10, 2022
1 parent c9fb178 commit 481afff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions services/tickets/zendesk/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ func (s *service) Open(session flows.Session, topic *flows.Topic, body string, a
msg.Message = body
} else {
extra := &struct {
Message string `json:"message"`
Priority string `json:"priority"`
Subject string `json:"subject"`
Description string `json:"description"`
CustomFields []FieldValue `json:"custom_fields"`
Tags []string `json:"tags"`
Message string `json:"message"`
Priority string `json:"priority"`
Subject string `json:"subject"`
Description string `json:"description"`
CustomFields interface{} `json:"custom_fields"`
Tags []string `json:"tags"`
}{}

err := jsonx.Unmarshal([]byte(body), extra)
Expand Down
2 changes: 1 addition & 1 deletion services/tickets/zendesk/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/require"
)

const fieldTicket = `{"message":"Cookies","priority":"high","subject":"Where are my cookies?","description":"I want to know where is my cookie.","tags": ["TAG_01","TAG_02"],"custom_fields":[{"id":"21938362","value":"hd_3000"}]}`
const fieldTicket = `{"message":"Cookies","priority":"high","subject":"Where are my cookies?","description":"I want to know where is my cookie.","tags": ["TAG_01","TAG_02"],"custom_fields":[{"id":21938362,"value":"hd_3000"}]}`

func TestOpenAndForward(t *testing.T) {
ctx, rt, _, _ := testsuite.Get()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
POST /api/v2/any_channel/push.json HTTP/1.1
Host: nyaruka.zendesk.com
User-Agent: Go-http-client/1.1
Content-Length: 631
Content-Length: 697
Authorization: Bearer ****************
Content-Type: application/json
Accept-Encoding: gzip

{"instance_push_id":"1234-abcd","request_id":"sesame:1570461696000000000","external_resources":[{"external_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","message":"Cookies","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:35Z","author":{"external_id":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis"},"allow_channelback":true,"fields":[{"id":"message","value":"Cookies"},{"id":"priority","value":"high"},{"id":"subject","value":"Where are my cookies?"},{"id":"description","value":"I want to know where is my cookie."},{"id":"custom_fields","value":[{"id":"21938362","value":"hd_3000"}]}]}]}
{"instance_push_id":"1234-abcd","request_id":"sesame:1570461696000000000","external_resources":[{"external_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","message":"Cookies","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:35Z","author":{"external_id":"5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f","name":"Ryan Lewis"},"allow_channelback":true,"fields":[{"id":"message","value":"Cookies"},{"id":"priority","value":"high"},{"id":"subject","value":"Where are my cookies?"},{"id":"description","value":"I want to know where is my cookie."},{"id":"custom_fields","value":[{"id":21938362,"value":"hd_3000"}]},{"id":"external_id","value":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c"}]}]}

0 comments on commit 481afff

Please sign in to comment.