Docs

Send message

https://api.apifonica.com/v2/accounts/{accountSID}/messages

Overview

This request sends an SMS message to a phone number. Only phone numbers rented from Apifonica can be used as senders’ numbers.

For message status control please refer to the article Message controller

XML command: sendMessage

Input parameters

ParameterRequiredDescriptionDefault Value
from
yes

A phone number to be used as a message sender. This number must be acquired from Apifonica.

N/A
to
yes

Recipient’s phone number.

Phone numbers should be formatted with a country code (without + sign).

For example, 35315313424.

N/A
text
yes

Text of the message.

Max 160 Latin characters or 70 Unicode characters.

N/A
msg_app_sid
no

Existing application SID, which is used for Message operations.

default_msg_app_sid
channel
no

Can be one of the following: sms, telegram, facebook

sms
type
no

Can be one of the following: sType of content for Telegram/Facebook. Can be one of the following: image, gif, text, documentms, telegram, facebook

N/A
url
no

URL where media content should be uploaded from

N/A
tag
no

Custom optional string field; can be used for custom client message filtering

N/A

Request example

The following cURL example demonstrates sending an SMS:

curl –X POST https://api.apifonica.com/v2/accounts/{accountSID}/messages \
-H 'Content-Type: application/json' \
-d '{
      "from": "35315313424",
      "to": "447860041755",
      "text": "Apifonica API provides a really cool SMS messaging service"
    }' \
-u {accountSID}:{authToken}

The following cURL example demonstrates sending a message to Telegram:

curl –X POST https://api.apifonica.com/v2/accounts/{accountSID}/messages \
-H 'Content-Type: application/json' \
-d '{
      "from": "35315313424",
      "to": "447860041755",
      "channel": "telegram",
      "type": "gif",
      "url": "https://media.giphy.com/media/ya4eevXU490Iw/giphy.gif",
      "text": "Apifonica API provides a really cool SMS messaging service"
    }' \
-u {accountSID}:{authToken}

Response example

{
  "status_code": 201,
  "status_message": "CREATED",
  "uri": "/accounts/{accountSID}/messages/{messageSID}"
}