Overview

The Whatsable Notifier API allows users to send messages via a POST request. This documentation covers the specifics of making a request to the API, including the required headers, payload structure, and understanding the API response.

API Endpoint

POST https://api.insightssystem.com/api:-GWQv5aM/send

Authentication

To use the API, an authorization token is required. This token must be included in the request headers.

Request Headers

  • Content-Type: application/json - Indicates the media type of the resource.
  • Authorization: Bearer YOUR_TOKEN_HERE - Authentication token for the API.

Request Payload

The body of the request should be a JSON object with the following fields:

  • phone (string): The phone number to which the message will be sent. It should be in international format.
  • text (string): The text message to be sent.
  • attachment (string, optional): A public URL to an attachment to be sent with the message.
  • filename (string, optional): The name to be used for the attachment file.

Example:

{
    "phone": "phone_number",
    "text": "text",
    "attachment": "attachment as public url",
    "filename": ""
}
        

Response

The response from the API will be in JSON format. It typically includes a message and details field.

Example Success Response:

{
    "message": "Message sent successfully"
}
        

Example Error Response:

{
    "message": "Message sending failed",
    "details": "Message limit for this phone number reached."
}
        

Error Handling

In case of an error, the API responds with a message indicating the failure and details providing more context. Common errors include reaching the message limit for a given phone number or issues with authentication.

Note: Replace YOUR_TOKEN_HERE with your actual API token and phone_number with the recipient's phone number in international format. For attachment, provide a valid public URL to the file you wish to send, and optionally, you can specify a filename for the attachment.

cURL Example

Use the following cURL command to send a request to the API:

curl -X POST https://api.insightssystem.com/api:-GWQv5aM/send\
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-d '{
    "phone": "phone_number",
    "text": "Your message text",
    "attachment": "attachment_public_url",
    "filename": "filename"
}'