Skip to main content

Send Keyword Phonebook SMS

This API allows you to send messages using a keyword to a phonebook.

📍 Endpoint

POST {base_url}/api/send

🧾 Headers

KeyValue
AuthorizationYOUR_TOKEN_HERE
Content-Typeapplication/json

📤 Request Body

{
"sending_type": "keyword_phonebook",
"from_number": "+983000505",
"message": "تاریخ {ex_50856}\nبدهی {ex_50858}",
"send_time": "2025-03-25 10:10:10",
"params": [
{
"phonebook_id": 123654
}
]
}

📝 Parameters

ParameterTypeRequiredDescription
sending_typestringYesType of sending, must be "keyword_phonebook" for this endpoint
from_numberstringYesSender's phone number in E.164 format (e.g., +983000505)
messagestringYesMessage content to be sent, can include placeholders for phonebook fields
send_timestringNoScheduled time for sending the message in YYYY-MM-DD HH:MM:SS format (timezone is UTC)
paramsarrayYesArray of objects containing phonebook id
phonebook_idintegerYesID of the phonebook to send messages to

📝 Notes

  • The from_number must be a valid sender number assigned to your account.
  • The send_time is optional; if not provided, the message will be sent immediately.

✅ Success Response

{
"data": {
"message_outbox_ids": [
1123594208
]
},
"meta": {
"status": true,
"message": "انجام شد",
"message_parameters": [],
"message_code": "200-1"
}
}

The response returns an array of message_outbox_ids – one ID per message sent (regardless of how many recipients it had).

❌ Error Response — Invalid or Expired Token (401)

{
"data": null,
"meta": {
"status": false,
"message": "اطلاعات وارد شده صحیح نمی باشد",
"message_parameters": [],
"message_code": "400-1",
"errors": {}
}
}

❌ Error Response — Invalid Request (422)

{
"data": null,
"meta": {
"status": false,
"message": "تکمیل گزینه پیام الزامی است",
"message_parameters": [],
"message_code": "400-2",
"errors": {
"message": [
"تکمیل گزینه پیام الزامی است"
]
}
}
}

🧪 Example Request

curl --location '{base_url}/api/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: API TOKEN' \
--data '{
"sending_type": "keyword_phonebook",
"from_number": "+983000505",
"message": "تاریخ {ex_50856}\nبدهی {ex_50858}",
"send_time": "2025-03-25 10:10:10",
"params": [
{
"phonebook_id": 123654
}
]
}'