github.com/twilio/twilio-go@v1.20.1/rest/notify/v1/docs/ServicesNotificationsApi.md (about) 1 # ServicesNotificationsApi 2 3 All URIs are relative to *https://notify.twilio.com* 4 5 Method | HTTP request | Description 6 ------------- | ------------- | ------------- 7 [**CreateNotification**](ServicesNotificationsApi.md#CreateNotification) | **Post** /v1/Services/{ServiceSid}/Notifications | 8 9 10 11 ## CreateNotification 12 13 > NotifyV1Notification CreateNotification(ctx, ServiceSidoptional) 14 15 16 17 18 19 ### Path Parameters 20 21 22 Name | Type | Description 23 ------------- | ------------- | ------------- 24 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 25 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) to create the resource under. 26 27 ### Other Parameters 28 29 Other parameters are passed through a pointer to a CreateNotificationParams struct 30 31 32 Name | Type | Description 33 ------------- | ------------- | ------------- 34 **Body** | **string** | The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. 35 **Priority** | **string** | 36 **Ttl** | **int** | 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. 37 **Title** | **string** | The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. 38 **Sound** | **string** | 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 to `aps.sound`. SMS does not support this property. 39 **Action** | **string** | The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. 40 **Data** | [**interface{}**](interface{}.md) | The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` 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. 41 **Apn** | [**interface{}**](interface{}.md) | The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. 42 **Gcm** | [**interface{}**](interface{}.md) | 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](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). 43 **Sms** | [**interface{}**](interface{}.md) | The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/quickstart) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. 44 **FacebookMessenger** | [**interface{}**](interface{}.md) | Deprecated. 45 **Fcm** | [**interface{}**](interface{}.md) | 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](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. 46 **Segment** | **[]string** | The Segment resource is deprecated. Use the `tag` parameter, instead. 47 **Alexa** | [**interface{}**](interface{}.md) | Deprecated. 48 **ToBinding** | **[]string** | The destination address specified as a JSON string. Multiple `to_binding` 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. 49 **DeliveryCallbackUrl** | **string** | URL to send webhooks. 50 **Identity** | **[]string** | The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. 51 **Tag** | **[]string** | 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 `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 in a specific channel. 52 53 ### Return type 54 55 [**NotifyV1Notification**](NotifyV1Notification.md) 56 57 ### Authorization 58 59 [accountSid_authToken](../README.md#accountSid_authToken) 60 61 ### HTTP request headers 62 63 - **Content-Type**: application/x-www-form-urlencoded 64 - **Accept**: application/json 65 66 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 67 [[Back to Model list]](../README.md#documentation-for-models) 68 [[Back to README]](../README.md) 69