Send a Text To Speech Message

In this Voice Messaging API Quickstart, you'll learn how to programmatically send your first outbound text to speech message via the API.

Step 1: Sign up for free

Before we get started, log in to the MessageBird Connectivity Platform and collect your live API key from the Developer Dashboard.

Step 2: Send your first text to speech message

Now, enter your credentials in the code snippet below, including YOUR-API-KEY with your API key, and enter your mobile number as the recipient.

curl -X POST https://rest.messagebird.com/voicemessages \
-H 'Authorization: AccessKey YOUR-API-KEY' \
-d "recipients=31XXXXXXXXX” \
-d "body=Hi! This is your first text to speech message!"

Next, simply copy the above snippet to your terminal and hit enter.

Good job! You've just sent your first outbound text to speech message with the Voice Messaging API using cURL!

Step 3: View the response

Now, let’s view MessageBird’s HTTP response to your API call. If the set up was correct, you'll receive a response similar to this:

{
"id":"e8077d803532c0b5937c639b60216938",
"href":"https://rest.messagebird.com/voicemessages/e8077d803532c0b5937c639b60216938",
"originator":null,
"body":"Hi! This is your first text to speech message!",
"reference":"the-client-reference",
"language":"en-gb",
"voice":"female",
"repeat":1,
"ifMachine":"continue",
"machineTimeout":7000,
"scheduledDatetime":null,
"createdDatetime":"2016-05-03T14:26:57+00:00",
"recipients":{
"totalCount":1,
"totalSentCount":1,
"totalDeliveredCount":0,
"totalDeliveryFailedCount":0,
"items":[
{
"recipient":31XXXXXXXXX,
"status":"calling",
"statusDatetime":"2016-05-03T14:26:57+00:00"
}
]
}
}

If something went wrong, you’ll receive an error response from the MessageBird API. Don't worry, simply head over to Voice Messaging API Troubleshooting to understand the error.

Congrats! You can now programmatically send outbound text to speech message with the Voice Messaging API using cURL.

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings