Reputation: 7228
I found another question about callbacks, but that situation is different, both in how it expects the callback to work, and which services it uses, hence this question. (Twilio Callback URL not Called - PHP & Wordpress)
The control panel for Twilio Messaging services says:
Outbound Settings
Make a request to this URL when a message to or from this Messaging Service is completed.
I am able to send a MMS using this configured service. I am also able to receive MMS/SMS answers, and those generate a callback to my responding web service (which is a simple service that just logs the request data for now.)
However, when I send a MMS using curl, the status callback is never called. It's the exact same URL as the incoming SMS notification, which works.
What am I missing? (Note: I'm configuring a status callback URL in the console, not in the request through curl.)
Here is the request I make to send the message:
#!/bin/bash
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/blahblahblah/Messages.json' \
--data-urlencode 'To=+12345678900' \
--data-urlencode 'From=+9876543210' \
-d 'MessagingServiceCid=blahblahblah' \
--data-urlencode 'Body=Keep on rocking!' \
-d 'MediaUrl=https://webasset-akm.imvu.com/scene/2314.29/hc-2.1/sDr-t4W83vXXRcWetWbXVjWT5S965bhoB8GKHHt316qYA8nVLvcqD-UaPpSBw75_tn5RMCEIjjwSAMwe5J4yMQRTg92GAnwAEcQmzJPaxuHGh7FKNcj2SCDzZuYJusJsJfvgo_1QabUfCXgVPC7wo8J5NBYdpqRoc3_UtLssRphGGlrdUteIGT4vRv-EIvQBXfbAoSGXlpmqoxbRcohXsEgAkY0OBw_KH4qovzIT9P0eVTFErd_aQcAZPpNWBk1c2Rk9LxhOTqCwYesowSr034TfbRppMhTct0WkpU7JxrOjKFCm0tT0WCu7Dye6IryJRj9yet0vmZrrOzu4jvVuUw==.gif' \
-u blahblah:blahblah
(redacted to take the message service cid, account cid, and secret out of the post)
Upvotes: 1
Views: 425
Reputation: 73055
Twilio developer evangelist here.
This seems to be a combination of a couple of things.
First up, you have supplied both a From
number and a MessagingServiceCid
. This wouldn't usually work, you should provide one or another.
Second, you actually need to provide a MessagingServiceSid
(that's an S, not a C).
So what seems to have happened is Twilio has ignored your MessagingServiceCid
parameter and sent the message using your From
parameter. Since it didn't come from the messaging service, the callback you set on the service itself will not fire.
So, to fix this you need to remove the From
parameter and correct to MessagingServiceSid
.
#!/bin/bash
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/blahblahblah/Messages.json' \
--data-urlencode 'To=+12345678900' \
-d 'MessagingServiceSid=blahblahblah' \
--data-urlencode 'Body=Keep on rocking!' \
-d 'MediaUrl=https://webasset-akm.imvu.com/scene/2314.29/hc-2.1/sDr-t4W83vXXRcWetWbXVjWT5S965bhoB8GKHHt316qYA8nVLvcqD-UaPpSBw75_tn5RMCEIjjwSAMwe5J4yMQRTg92GAnwAEcQmzJPaxuHGh7FKNcj2SCDzZuYJusJsJfvgo_1QabUfCXgVPC7wo8J5NBYdpqRoc3_UtLssRphGGlrdUteIGT4vRv-EIvQBXfbAoSGXlpmqoxbRcohXsEgAkY0OBw_KH4qovzIT9P0eVTFErd_aQcAZPpNWBk1c2Rk9LxhOTqCwYesowSr034TfbRppMhTct0WkpU7JxrOjKFCm0tT0WCu7Dye6IryJRj9yet0vmZrrOzu4jvVuUw==.gif' \
-u blahblah:blahblah
Shout out to Brent for helping to debug this one.
Upvotes: 1