Path parameters
-
The SID of the Service to create the resource under.
Minimum length is
34, maximum length is34. Format should match the following pattern:^IS[0-9a-fA-F]{32}$.
Body
-
The notification text. For FCM and GCM, translates to
data.twi_body. For APNS, translates toaps.alert.body. For SMS, translates tobody. SMS requires either thisbodyvalue, ormedia_urlsattribute defined in thesmsparameter of the notification. -
The priority of the notification. Can be:
loworhighand the default ishigh. A value oflowoptimizes the client app's battery consumption; however, notifications may be delivered with unspecified delay. For FCM and GCM,lowpriority is the same asNormalpriority. For APNSlowpriority is the same as5. A value ofhighsends the notification immediately, and can wake up a sleeping device. For FCM and GCM,highis the same asHighpriority. For APNS,highis a priority10. SMS does not support this property.Values are
highorlow. -
How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property.
-
The notification title. For FCM and GCM, this translates to the
data.twi_titlevalue. For APNS, this translates to theaps.alert.titlevalue. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. -
The name of the sound to be played for the notification. For FCM and GCM, this Translates to
data.twi_sound. For APNS, this translates toaps.sound. SMS does not support this property. -
The actions to display for the notification. For APNS, translates to the
aps.categoryvalue. For GCM, translates to thedata.twi_actionvalue. For SMS, this parameter is not supported and is omitted from deliveries to those channels. -
The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to
datain the FCM and GCM payloads. FCM and GCM reserve certain keys that cannot be used in those channels. For APNS, attributes ofdataare inserted into the APNS payload as custom properties outside of theapsdictionary. In all channels, we reserve keys that start withtwi_for future use. Custom keys that start withtwi_are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. -
The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS
Payloaditem, therefore theapskey must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the APNS documentation for more details. We reserve keys that start withtwi_for future use. Custom keys that start withtwi_are not allowed. -
The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the GCM documentation for more details. Target parameters
to,registration_ids, andnotification_keyare not allowed. We reserve keys that start withtwi_for future use. Custom keys that start withtwi_are not allowed. GCM also reserves certain keys. -
The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding
formparameter of the Twilio Message resource. These parameters of the Message resource are supported in snake case format:body,media_urls,status_callback, andmax_price. Thestatus_callbackparameter overrides the corresponding parameter in the messaging service, if configured. Themedia_urlsproperty expects a JSON array. -
Deprecated.
-
The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the FCM documentation for more details. Target parameters
to,registration_ids,condition, andnotification_keyare not allowed in this parameter. We reserve keys that start withtwi_for future use. Custom keys that start withtwi_are not allowed. FCM also reserves certain keys, which cannot be used in that channel. -
The Segment resource is deprecated. Use the
tagparameter, instead. -
Deprecated.
-
The destination address specified as a JSON string. Multiple
to_bindingparameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. -
URL to send webhooks.
-
A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag
allis available to notify all Bindings in a Service instance. Similarly, the implicit tagsapn,fcm,gcm,smsandfacebook-messengerare available to notify all Bindings in a specific channel.
curl \
--request POST 'https://notify.twilio.com/v1/Services/{ServiceSid}/Notifications' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Body=body&Title=test&Identity=jing&Priority=high&DeliveryCallbackUrl=hello'
{"Body" => "body", "Title" => "test", "Identity" => "jing", "Priority" => "high", "DeliveryCallbackUrl" => "hello"}
{"Body" => "body", "ToBinding" => "{\"binding_type\":\"apn\", \"address\":\"0efb85d06b3cc1bf290545fde4775a929d46b3541aaa4aa167e420b6c8b0ff15\"}"}
{
"apn": null,
"fcm": null,
"gcm": null,
"sid": "NTb8021351170b4e1286adaac3fdd6d082",
"sms": null,
"ttl": 2419200,
"body": "body",
"data": null,
"tags": [],
"alexa": null,
"sound": null,
"title": "test",
"action": null,
"priority": "high",
"segments": [],
"identities": [
"jing"
],
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "IS699b53e02da45a1ba9d13b7d7d2766af",
"date_created": "2016-03-24T23:42:28Z",
"facebook_messenger": null
}
{
"apn": null,
"fcm": null,
"gcm": null,
"sid": "NTb8021351170b4e1286adaac3fdd6d082",
"sms": null,
"ttl": 2419200,
"body": "body",
"data": null,
"tags": [],
"alexa": null,
"sound": null,
"title": null,
"action": null,
"priority": "high",
"segments": [],
"identities": [],
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "IS699b53e02da45a1ba9d13b7d7d2766af",
"date_created": "2016-03-24T23:42:28Z",
"facebook_messenger": null
}