how to play pre-recorded audio
I want to play precorded audio file when a user call the agent. How can I do this? Can I upload a mp3 somehow and then play it?
1 Reply
Here’s the easiest way to play a pre-recorded audio file (-mp3, ‑wav, etc.) when someone calls your Voiceflow agent over the Twilio/Vonage Phone integration.
1. Host the audio file
• Upload the file to any HTTPS-accessible location (AWS S3, Cloudfront, GitHub Pages, your own server, etc.).
• Copy the direct URL (for example:
(You’ll find it in the Logic section of the canvas.) 3. Paste TwiML that tells Twilio to play the file: That’s it—when the call reaches this step Twilio streams the mp3 to the caller before the conversation continues.
If you need to collect DTMF afterwards you can wrap the
– Phone integration & Custom Action/TwiML: https://docs.voiceflow.com/docs/phone
– Twilio
• Copy the direct URL (for example:
https://my-files.s3.amazonaws.com/welcome.mp3). Voiceflow itself doesn’t store audio assets today.
2. Add a Custom Action → TwiML step in your flow(You’ll find it in the Logic section of the canvas.) 3. Paste TwiML that tells Twilio to play the file: That’s it—when the call reaches this step Twilio streams the mp3 to the caller before the conversation continues.
If you need to collect DTMF afterwards you can wrap the
<Play> in a <Gather>.
Why not SSML? For phone calls Voiceflow renders your Speak steps into Twilio TwiML <Say>, which doesn’t support the SSML <audio> tag. Using a Custom Action with raw TwiML is the supported way to play media files.
Docs for reference– Phone integration & Custom Action/TwiML: https://docs.voiceflow.com/docs/phone
– Twilio
<Play> element: https://www.twilio.com/docs/voice/twiml/play
Feel free to add multiple Custom Action steps if you want to string together several audio clips, or combine them with regular Speak steps for TTS prompts.TwiML™ Voice: <Play> | Twilio
Learn how to play an audio file back to your callers with TwiML Voice's <Play> verb using the programming language of your choice.