Programmatically Send Messages

Programmable Conversations allows you to send a message to a user over any supported communication platform.

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

Step 1: Collect your credentials

To start testing the Programmable Conversations API using cURL, you need to first set up your terminal. Before we get started, you need to collect your live API key from the MessageBird Developer Dashboard.

Step 2: Send your first message

To set your credentials in the code snippet below, replace

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://example.com/reports" }'
Notification icon

You can access and manage your credentials in the MessageBird Developer Dashboard.

Next, enter your mobile number as

to
and the ID that identifies the channel over which the message should be sent as
from
. You can find your channel’s ID 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 your credentials are entered, go ahead and copy the above snippet to your terminal and hit enter!

Step 3: View the response

Now, let's view the 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.

Congrats! You can now send outbound messages with Programmable Conversations.

Next Steps

You may now want to check out these resources:

Questions?

We’re always happy to help with code or other questions you might have! Search our API Reference, check the Developer tutorials or contact support.

Cookie Settings