diff --git a/services/tickets/twilioflex/testdata/event_callback.json b/services/tickets/twilioflex/testdata/event_callback.json index ad2f215bc..f66a8f000 100644 --- a/services/tickets/twilioflex/testdata/event_callback.json +++ b/services/tickets/twilioflex/testdata/event_callback.json @@ -17,7 +17,7 @@ "label": "unauthorized response if auth fails", "method": "POST", "path": "/mr/tickets/types/twilioflex/event_callback/12cc5dcf-44c2-4b25-9781-27275873e0df/564fee60-7e84-4a9e-ade3-4fce01af19a2", - "body": "EventType=onMessageSent&InstanceSid=IS38067ec392f1486bb6e4de4610f26fb3&Attributes=%7B%7D&DateCreated=2022-03-10T23%3A56%3A43.412Z&Index=1&From=teste_2Etwilioflex&MessageSid=IM4b440f124820414b8f500a1235532ac1&AccountSid=AC92d44315e19372138bdaffcc13cf3b05&Source=SDK&ChannelSid=CH1880a9cde40c4dbb88dd97fc3aedac08&ClientIdentity=teste_2Etwilioflex&RetryCount=0&WebhookType=webhook&Body=ola&WebhookSid=WH99d1f1895a7c4e6fa10ac5e8ac0c2242", + "body": "EventType=onMessageSent&InstanceSid=IS43167ec392f1486bb6e4de4610f26gc4&Attributes=%7B%7D&DateCreated=2022-03-10T23%3A56%3A43.412Z&Index=1&From=teste_2Etwilioflex&MessageSid=IM4b440f124820414b8f500a1235532ac1&AccountSid=AC92d44315e19372138bdaffcc13cf3b05&Source=SDK&ChannelSid=CH1880a9cde40c4dbb88dd97fc3aedac08&ClientIdentity=teste_2Etwilioflex&RetryCount=0&WebhookType=webhook&Body=ola&WebhookSid=WH99d1f1895a7c4e6fa10ac5e8ac0c2242", "status": 401, "response": { "status": "unauthorized" @@ -121,4 +121,4 @@ } ] } -] \ No newline at end of file +] diff --git a/services/tickets/twilioflex/web.go b/services/tickets/twilioflex/web.go index 868bd7c92..1dd375bdb 100644 --- a/services/tickets/twilioflex/web.go +++ b/services/tickets/twilioflex/web.go @@ -56,8 +56,8 @@ func handleEventCallback(ctx context.Context, rt *runtime.Runtime, r *http.Reque return errors.Errorf("no such ticketer %s", ticketerUUID), http.StatusNotFound, nil } - accountSid := request.AccountSid - if accountSid != ticketer.Config(configurationAccountSid) { + serviceSid := request.InstanceSid + if serviceSid != ticketer.Config(configurationChatServiceSid) { return map[string]string{"status": "unauthorized"}, http.StatusUnauthorized, nil }