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

Parameter

Required?

Description

Default 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

Required

yes

Description

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

Default value

N/A

Required

yes

Description

SIP number you want to send message to

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

Default value

N/A

Required

yes

Description

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

Default value

N/A

Required

no

Description

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

Default value

N/A

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.

Parameter name

Description

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.

 

Description

Account unique identifier.

Description

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

Description

SIP number which received the message.

Description

Message text.

Description

Push message SID

Description

The current message status.

For more information on possible statuses, seebelow.

Description

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

Status value

Description

sent

Message was sent.

failed

Message was not delivered to the recipient.

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

Description

Message was sent.

 

Description

Message was not delivered to the recipient.

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