Docs

Send PUSH notification

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

Overview

To create a push notification message you need to make a POST request to /accounts/{accountSID}/push.

Input parameters

ParameterRequiredDescriptionDefault Value
from
yes

SIP number, which belongs to the account from which you want to send PUSH message.

N/A
to
yes

SIP number you want to send message to

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

N/A
text
yes

Text of the message. Max. 256 bytes of text (UTF-8).

N/A
msg_app_sid
no

Application which contains URL which will be used to transmit message status and parameters

default_msg_app_sid

Request example

The following cURL example demonstrates sending a message.

curl –X POST https://api.apifonica.com/v2/accounts/{accountSID}/push \
-H ‘Content-Type: application/json’ \
-d ‘{
    “from”: “883140347007966”
    “to”: ”883140347007307”,
    “text”: “Test PUSH message”
  }’ \
-u {accountSID}:{authToken}

Response example

{
  "sid": "pus19289ca7-6300-3075-b4a6-c679a1d10c34",
  "status": "sent",
  "from": "883140347007966",
  "to": "883140347007307",
  "account_sid": "{accountSID}",
  "number_sid": "{numberSID}",
  "device_type": "android",
  "token": "token",
  "text": "Test PUSH message",
  "created": "Fri, 21 Jul 2017 13:14:21 +0000",
  "updated": "Fri, 21 Jul 2017 13:14:21 +0000"
}

Apifonica request parameters being sent to controller url

The following parameters are sent to controller URL if it is provided in the request.

ParameterDescription
account_sid

Account unique identifier.

from

Number, which belongs to the account from which PUSH message was sent.

to

SIP number which received the message.

text

Message text.

push_sid

Push message SID

status

The current message status.

For more information on possible statuses, see below.

status_message

Error details.

It is sent only if the status value is failed.

Apifonica request example

{
  "account_sid": "{accountSID}",
  "from": "883140445566",
  "to": "883140112244",
  "text": "Apifonica API provides a really cool PUSH messaging service",
  "status": "sent",
  "push_sid": "{pushSID}"
}

Possible message statuses

StatusDescription
sent

Message was sent.

failed

Message was not delivered to the recipient.

If this happens, an error message is included in Apifonica request.