Sending messages

In this Programmable Conversations API Quickstart, you'll learn how to send a new outbound message to a channel-specific user identifier, that is, a phone number for the SMS channel with the Programmable Conversations API.

Programmable Conversations allows you to send messages to users over any supported communication platform such as SMS, WhatsApp, Live Chat, WeChat, Messenger, Telegram, LINE, Instagram, Email, Google Business Messages, Twitter, and Viber.

Step 1: Collect your credentials

To start testing the Programmable Conversations API using cURL, you need to first set up your terminal.

Log in to the MessageBird Connectivity Platform and collect your live API key from the Developer Dashboard.

Step 2: Sending text messages with the API

Enter your credentials in the code snippet below. Start by replacing YOUR-API-KEY with your API key.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H "Authorization: AccessKey YOUR-API-KEY" \
-H "Content-Type: application/json" \
--data '{ "to":"+31XXXXXXXXX", "from":"CHANNEL-ID", "type":"text", "content":{ "text":"Hello!" }, "reportUrl":"https://your-domain.com/reports" }'

Replace your mobile number as to, and the channel ID (that identifies the channel over which the message should be sent) as from. You can find your channel IDs or create new channels in the Channels Directory in your MessageBird Dashboard.

You may also want to add reportUrl to deliver status reports to your platform through a POST request to a specific URL. If you don't need reports, remove the parameter from the request.

Once you’ve entered all your credentials, go ahead and copy the above snippet to your terminal and hit enter!

Step 3: View the response

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

{
"id": "24500a370c86916fe8aef77e4c24b6a6",
"status": "accepted",
"fallback": null
}

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

Nice work! 🎉 You can now send outbound messages with Programmable Conversations.

#

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