View Source ExTwilio.Notify.Notification (ExTwilio v0.10.0)
Represents a Notification resource in the Twilio Notify.
body (optional for all except Alexa) Indicates the notification body text. Translates to
data.twi_body
for FCM and GCM,aps.alert.body
for APNS,Body
for SMS and Facebook Messenger andrequest.message.data
for Alexa. For SMS either this,body
, or themedia_url
attribute of theSms
parameter is required. For Facebook Messenger either this parameter or the body attribute in theFacebookMessenger
parameter is required.priority Two priorities defined:
low
andhigh
(default).low
optimizes the client app's battery consumption, and notifications may be delivered with unspecified delay. This is the same as Normal priority for FCM and GCM or priority 5 for APNS.high
sends the notification immediately, and can wake up a sleeping device. This is the same as High priority for FCM and GCM or priority 10 for APNS. This feature is not supported by SMS and Facebook Messenger and will be ignored for deliveries via those channels.ttl This parameter specifies how long (in seconds) the notification is valid. Delivery should be attempted if the device is offline. The maximum time to live supported is 4 weeks. The value zero means that the notification delivery is attempted immediately once but not stored for future delivery. The default value is 4 weeks. This feature is not supported by SMS and Facebook Messenger and will be ignored for deliveries via those channels.
title (optional for all except Alexa) Indicates the notification title. This field is not visible on iOS phones and tablets but it is on Apple Watch and Android devices. Translates to
data.twi_title
for FCM and GCM,aps.alert.title
for APNS anddisplayInfo.content[0].title
,displayInfo.content[].toast.primaryText
ofrequest.message
for Alexa. It is not supported for SMS and Facebook Messenger and will be omitted from deliveries via those channels.sound Indicates a sound to be played. Translates to
data.twi_sound
for FCM and GCM andaps.sound
for APNS. This parameter is not supported by SMS and Facebook Messenger and is omitted from deliveries via those channels.action Specifies the actions to be displayed for the notification. Translates to
data.twi_action
for GCM andaps.category
for APNS. This parameter is not supported by SMS and Facebook Messenger and is omitted from deliveries via those channels.data This parameter specifies the custom key-value pairs of the notification's payload. Translates to
data
dictionary in FCM and GCM payload. FCM and GCM reserves certain keys that cannot be used for those channels. For APNS, attributes ofData
will be inserted into the APNS payload as custom properties outside of theaps
dictionary. For Alexa they are added torequest.message.data
. For all channels, thetwi_
prefix is reserved for Twilio for future use. Requests including custom data with keys starting withtwi_
will be rejected as 400 Bad request and no delivery will be attempted. This parameter is not supported by SMS and Facebook Messenger and is omitted from deliveries via those channels. -apn APNS specific payload that overrides corresponding attributes in a generic payload for Bindings with the apn BindingType. This value is mapped to the Payload item, therefore theaps
key has to be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. Refer to APNS documentation for more details. Thetwi_
key prefix for custom key-value pairs is reserved for Twilio for future use. Custom data with keys starting withtwi_
is not allowed.gcm GCM specific payload that overrides corresponding attributes in generic payload for Bindings with gcm BindingType. This value is mapped to the root json dictionary. Refer to GCM documentation for more details. Target parameters
to
,registration_ids
, andnotification_key
are not allowed. Thetwi_
key prefix for custom key-value pairs is reserved for Twilio for future use. Custom data with keys starting withtwi_
is not allowed. FCM and GCM reserves certain keys that cannot be used for those channels.sms SMS specific payload that overrides corresponding attributes in generic payload for Bindings with sms BindingType. Each attribute in this JSON object is mapped to the corresponding form parameter of the Twilio Message resource. The following parameters of the Message resource are supported in snake case format:
body
,media_urls
,status_callback
, andmax_price
. Thestatus_callback
parameter overrides the corresponding parameter in the messaging service if configured. Themedia_urls
expects a JSON array.facebook_messenger Messenger specific payload that overrides corresponding attributes in generic payload for Bindings with facebook-messenger BindingType. This value is mapped to the root json dictionary of Facebook's Send API request. Overriding the
recipient
parameter is not allowed.fcm FCM specific payload that overrides corresponding attributes in generic payload for Bindings with fcm BindingType. This value is mapped to the root json dictionary. Refer to FCM documentation for more details. Target parameters
to
,registration_ids
,condition
, andnotification_key
are not allowed. Thetwi_
key prefix for custom key-value pairs is reserved for Twilio for future use. Custom data with keys starting withtwi_
is not allowed. Custom data with keys starting withtwi_
is not allowed. FCM and GCM reserves certain keys that cannot be used for those channels.segment The segment
alexa The alexa
to_binding The destination address in a JSON object (see attributes below). Multiple ToBinding parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers.
identity Delivery will be attempted only to Bindings with an Identity in this list. Maximum 20 items allowed in this list.
tag Delivery will be attempted only to Bindings that have all of the Tags in this list. Maximum 5 items allowed in this list. The implicit tag "all" is available to notify all Bindings in a Service instance. Similarly the implicit tags "apn", "fcm", "gcm", "sms" and "facebook-messenger" are available to notify all Bindings of the given type.
Summary
Functions
Children represent path segments that come after the current resource. For example,
in the path /v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/Active
"Active" is
a child. Children may or may not have a key in the next segment.
Parents represent path segments that precede the current resource. For example,
in the path /v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users
"Services" is
a parent. Parents will always have a key in the next segment. If your parent is under a
submodule of ExTwilio
, specify your parent using the ExTwilio.Parent
struct.
Underscored and lowercased collection name for a given resource.
Delegates the real work to ExTwilio.UrlGenerator.resource_collection_name/1
by
default.
CamelCase resource name as it would be used in Twilio's API. Delegates
the real work to ExTwilio.UrlGenerator.resource_name/1
by default.
Functions
@spec children() :: list()
Children represent path segments that come after the current resource. For example,
in the path /v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/Active
"Active" is
a child. Children may or may not have a key in the next segment.
Override this method in your resource to specify children in the order that they will appear in the path.
@spec create(ExTwilio.Api.data(), list()) :: ExTwilio.Parser.parsed_response()
@spec do_new( %ExTwilio.Notify.Notification{ account_sid: term(), action: term(), alexa: term(), apn: term(), body: term(), data: term(), date_created: term(), facebook_messenger: term(), fcm: term(), gcm: term(), identities: term(), identity: term(), priority: term(), segments: term(), service_sid: term(), sid: term(), sms: term(), sound: term(), tag: term(), tags: term(), title: term(), to_binding: term(), ttl: term() }, list() ) :: %ExTwilio.Notify.Notification{ account_sid: term(), action: term(), alexa: term(), apn: term(), body: term(), data: term(), date_created: term(), facebook_messenger: term(), fcm: term(), gcm: term(), identities: term(), identity: term(), priority: term(), segments: term(), service_sid: term(), sid: term(), sms: term(), sound: term(), tag: term(), tags: term(), title: term(), to_binding: term(), ttl: term() }
@spec new() :: %ExTwilio.Notify.Notification{ account_sid: term(), action: term(), alexa: term(), apn: term(), body: term(), data: term(), date_created: term(), facebook_messenger: term(), fcm: term(), gcm: term(), identities: term(), identity: term(), priority: term(), segments: term(), service_sid: term(), sid: term(), sms: term(), sound: term(), tag: term(), tags: term(), title: term(), to_binding: term(), ttl: term() }
@spec new(list()) :: %ExTwilio.Notify.Notification{ account_sid: term(), action: term(), alexa: term(), apn: term(), body: term(), data: term(), date_created: term(), facebook_messenger: term(), fcm: term(), gcm: term(), identities: term(), identity: term(), priority: term(), segments: term(), service_sid: term(), sid: term(), sms: term(), sound: term(), tag: term(), tags: term(), title: term(), to_binding: term(), ttl: term() }
@spec parents() :: list()
Parents represent path segments that precede the current resource. For example,
in the path /v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users
"Services" is
a parent. Parents will always have a key in the next segment. If your parent is under a
submodule of ExTwilio
, specify your parent using the ExTwilio.Parent
struct.
Override this method in your resource to specify parents in the order that they will appear in the path.
Underscored and lowercased collection name for a given resource.
Delegates the real work to ExTwilio.UrlGenerator.resource_collection_name/1
by
default.
Override in your module after use ExTwilio.Resource
if you need
something different.
CamelCase resource name as it would be used in Twilio's API. Delegates
the real work to ExTwilio.UrlGenerator.resource_name/1
by default.
Override in your module after use ExTwilio.Resource
if you need
something different.