quickest-silver•16mo ago
Handle file coming in from Twilio sms
I have my bot working perfectly with the Twilio integration.
If the user uploads a file via sms interface.
Is there a possibility to get that file and send it as a payload in an API?
If not what could be the nearest solution.
Note: I don't want the VF assistant to read the file content or do any processing on the content.
I simply want to send the file as payload in an API using the voiceflow function or api step.
Thanks!
2 Replies
To handle a file coming in from Twilio SMS and send it as a payload in an API using Voiceflow, follow these steps:
1. Receive the File via Twilio SMS:
- Ensure your Twilio number is configured to receive MMS (Multimedia Messaging Service) messages.
- When a user sends a file via SMS, Twilio will provide a URL to access the file in the incoming message webhook.
2. Capture the File URL in Voiceflow:
- Use the Capture Response step in Voiceflow to capture the URL of the file from the incoming Twilio message.
- Map the URL to a variable, e.g.,
file_url
.
3. Send the File URL as Payload in an API Call:
- Use the API Step in Voiceflow to send the file URL as part of the payload to your desired API endpoint.
- Configure the API step with the necessary headers and body. For example, if your API expects a JSON payload, you can structure it like this:
4. Example Configuration:
- Capture Response Step:
- Path: response.MediaUrl0
(assuming MediaUrl0
is the key provided by Twilio for the file URL)
- Variable: file_url
- API Step:
- Method: POST
- URL: https://your-api-endpoint.com/upload
- Headers: Content-Type: application/json
- Body:
By following these steps, you can capture the file URL from an incoming Twilio SMS and send it as a payload in an API call without processing the file content within Voiceflow.quickest-silverOP•16mo ago
How do I extract the file url from the {last_utterance} or {last_response} variable.
Also does the Twilio integration convert incoming files to url automatically?
Could anyone please help with this,
Would really appreciate any leads on this