Reputation: 87
I am currently trying to figure out how to receive an mms message via a twilio chatbot. I can't figure out how to access the mediaURL from twilio since it is integrated with Api.ai -- anyone know if there is a way to do this?
Upvotes: 1
Views: 207
Reputation: 87
After looking into this issue quite a bit - Facebook/Twilio do not pass long the image event to API.ai. If another person out there is trying to have api.ai reply to an image event - you have to build in a node.js layer between facebook/twilio and Api.ai to ensure that information gets passed along.
Upvotes: 0
Reputation: 3469
API.AI retains information on the original request from each integration. Using a webhook you should be able to get all the information on a request including the mediaURL. API.AI webhook requests from integrations include a JSON object called originalRequest
which should have the information you need. The JSON from API.AI's webhook request to your server should have this form:
{
"originalRequest": {
"source": "twilio",
"data": {
...
}
}
...
}
The data attribute should have the information you're looking for.
Upvotes: 1