Send message
- Send a message on Twilio SMS, Twilio WhatsApp or Gupshup WhatsApp channel.
- You can also send an image, a video or a file.
- You can schedule the message to be sent at a future date and time.
- Optionally, you can also save the recipient in a contact list.
- Calling this API with a future schedule date will create a scheduled message, which you can also see and update on app.sociocs.com -> Outbound -> Scheduled.
Method
POST
Path
/message
Body parameters
template
This field is used for passing template details when sending a WhatsApp template message. Applicable only when provider is either twlowa
or gswa
.
template for provider twlowa
template for provider gswa
contact_saving
This field is for passing instruction to save phone number and name as a contact. If the contact already exists, it will be updated. Extra custom fields can also be passed.
Response
HTTP status codes
Response object
Code samples
Sending only text content
curl --location --request POST 'https://api.sociocs.com/message' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider": "twlo",
"channel_key": "your_channel_key",
"to": "phone_number",
"name": "recipient_name",
"text": "message"
}'
Sending text & image
curl --location --request POST 'https://api.sociocs.com/message' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider": "twlo",
"channel_key": "your_channel_key",
"to": "phone_number",
"name": "recipient_name",
"text": "message",
"image_url": "https://fastly.picsum.photos/id/1068/200/300.jpg?hmac=ICIwYXRGTpDxBPZAI7V8YxGtBBanV8Dfbe_DLNKtYcE"
}'
Sending only an image
curl --location --request POST 'https://api.sociocs.com/message' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider": "twlo",
"channel_key": "your_channel_key",
"to": "phone_number",
"name": "recipient_name",
"image_url": "https://fastly.picsum.photos/id/701/200/300.jpg?hmac=gVWdD9Rh_J0iGXpXOJAN7MZpGPrpeHX_M5JwGGvTSsI"
}'
Response object examples
When the API call was successful
{
"status": "success",
"data": { "message_id": "Xyz12345" }
}
When the API call was unsuccessful
{
"status": "error",
"errors": [{ "msg": "Invalid channel_key." }]
}