NAME
Twilio::Rest::Notify::V1::Service::Notification - The Notification resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $notification = $client->notify->v1->services($service_sid)->notifications->create(\%options);
DESCRIPTION
This file holds NotificationList and NotificationInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
NotificationList
Returned by $client->notify->v1->services($service_sid)->notifications. See also Twilio::ListResource.
create
my $notification = $client->notify->v1->services($service_sid)->notifications->create(\%options);
Returns a NotificationInstance.
The options are:
action-
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. alexa-
Deprecated. A hash or array reference, or a string of JSON.
apn-
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. A hash or array reference, or a string of JSON. 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. data-
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. A hash or array reference, or a string of JSON. delivery_callback_url-
URL to send webhooks.
facebook_messenger-
Deprecated. A hash or array reference, or a string of JSON.
fcm-
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. A hash or array reference, or a string of JSON. gcm-
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. A hash or array reference, or a string of JSON. identity-
The
identityvalue that uniquely identifies the new resource's User within the Service. Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. An array reference. priority-
One of
highorlow. segment-
The Segment resource is deprecated. Use the
tagparameter, instead. An array reference. sms-
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. A hash or array reference, or a string of JSON. sound-
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. tag-
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. An array reference. title-
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. to_binding-
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. An array reference. ttl-
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.
NotificationInstance
See also Twilio::InstanceResource.
Its fields are:
- account_sid
-
The SID of the Account that created the Notification resource.
- action
-
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. - alexa
-
Deprecated.
- apn
-
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. - 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. - data
-
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. - date_created
-
The date and time in GMT when the resource was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- facebook_messenger
-
Deprecated.
- fcm
-
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. - gcm
-
The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. 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. - identities
-
The list of
identityvalues of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. - priority
-
One of
highorlow. - segments
-
The list of Segments to notify. The Segment resource is deprecated. Use the
tagsproperty, instead. - service_sid
-
The SID of the Service the resource is associated with.
- sid
-
The unique string that we created to identify the Notification resource.
- sms
-
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. - sound
-
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 tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property.
- title
-
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. - ttl
-
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.
CONSTRUCTORS
new
Objects here come from the methods above, so there is no need to call new directly.
LICENSE
Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.