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

Input parameters

Parameter

Required?

Description

Default 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

Required

yes

Description

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

Default value

N/A

Required

yes

Description

Recipient’s phone number.

Phone numbers should be formatted with a country code.

For example, 35315313424.

Default value

N/A

Required

yes

Description

Text of the message.

Max 160 Latin characters or 70 Unicode characters.

Default value

N/A

Required

no

Description

Existing application SID, which is used for Message operations.

Default value

default_msg_app_sid

Request example

The following cURL example demonstrates sending a message.

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}

Response example

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