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-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' \
       -H 'Content-Type: application/json' \
       -H 'X-Falu-Version: 2024-06-01' \
       -u "fskt_1234567890:" \
       --data '{
         "body": "Hello World, from Falu Messaging",
         "to": "+254somenumber",
         "stream": "transactional"
       }'

In Postman, our request looks as follows: images-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-messages-send-message-api-response-postman