Sending messages using the API

Use the Falu Messaging API to send messages


Besides using the Dashboard, you can also send messages directly through API calls to the endpoint https://api.falu.io/v1/messages. Below, we will detail how you can send a message to a mobile number in Kenya using Postman as our API client.

Sending a message using the Falu Messaging API

The following steps represent a typical workflow of sending a message using the API.

1. Get your secret key

Log into your Dashboard and head over to the Developers menu and copy your secret key.

images-docs-messages-send-message-api-get-key

2. Configure your message

In this guide, we will use Postman as our API client for sending the message. You can also use other platforms such as the terminal/ command prompt, ReqBin, or Restfox.

As covered in the Messaging API Docs, the top-level messaging endpoint is https://api.falu.io/v1/messages.

A sample cURL POST request to send a message is therefore:

$ curl -X POST 'https://api.falu.io/v1/messages' \
    --header 'X-Falu-Version: 2022-09-01' \
    --header 'Authorization: Bearer YOUR_SECRET_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
        "body": "Hello World, from Falu Messaging",
        "to": "+254somenumber",
        "stream": "transactional"
    }'

In Postman, our request looks as follows: images-docs-messages-send-message-api-postman

3. Send your message

Confirm the details provided in your message and hit send!

4. Monitor the status of your message

If your request was successfully sent, you should get a 200 OK status response.

images-docs-messages-send-message-api-response-postman