jefflovejapan
jefflovejapan

Reputation: 2121

Twilio Programmable Chat - Push notifications not arriving

I'm working on an app that uses the Twilio Programmable Chat API. I've created an APNS development cert for the app and verified that notifications are landing using Pusher. I've created a new push credential in the Programmable Chat console using this cert and checked the "use this credential for sending to a sandbox APN" checkbox. I've updated our IpMessagingGrant call to use this credential's Sid. Lastly, I'm registering our device token successfully with the TwilioChatClient.

I'm not receiving push notifications for received messages, etc. and not sure what other levers I have at my disposal. If anyone on the team sees this message I'd love to know how I can try to debug this.

Upvotes: 2

Views: 1702

Answers (1)

rbeiter
rbeiter

Reputation: 156

It looks like your credentials are in good shape but notifications are not yet enabled for your chat instance. This step only needs to be done once per chat instance per notification type:

curl -X POST https://chat.twilio.com/v2/Services/{service sid} \ 
-d 'Notifications.NewMessage.Enabled=true' \
-d 'Notifications.NewMessage.Template=A New message in ${CHANNEL} from ${USER}: ${MESSAGE}' \
-d 'Notifications.NewMessage.Sound=default' \
-u '{twilio account sid}:{twilio auth token}'

This should solve the issue you're seeing. Docs for this can be found here: https://www.twilio.com/docs/api/chat/guides/push-notification-configuration#push-configuring

Please let us know if you have any questions or this does not get pushes flowing for you.

Upvotes: 2

Related Questions