Skip to main content
Android
iOS
Web
Windows
Unity
Flutter
React Native

Offline push configuration

This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

Before calling the following methods, ensure that you meet the following:

  • You understand the call frequency limit of the Chat RESTful APIs as described in Limitations.

  • You have activated the advanced features for push in Agora Console. Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

You must contact support@agora.io to disable the advanced features for push as this operation will delete all the relevant configurations.

Common parameters

The following table lists common request and response parameters of the Chat RESTful APIs:

Request parameters

ParameterTypeDescriptionRequired
hostStringThe domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see Get the information of your project.Yes
org_nameStringThe unique identifier assigned to each company (organization) by the Chat service. For how to get the org name, see Get the information of the Chat project.Yes
app_nameStringThe unique identifier assigned to each app by the Chat service. For how to get the app name, see Get the information of the Chat project.Yes
usernameStringThe unique login account of the user.Yes

Response parameters

ParameterTypeDescription
actionStringThe request method.
organizationStringThe unique identifier assigned to each company (organization) by the Chat service. This is the same as org_name.
applicationStringA unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter.
applicationNameStringThe unique identifier assigned to each app by the Chat service . This is the same as app_name.
timestampNumberThe Unix timestamp (ms) of the HTTP response.
durationNumberThe duration (ms) from when the HTTP request is sent to the time the response is received.
pathStringThe request path, which is part of the request URL. You can safely ignore this parameter.
uriStringThe request URI.
entities JSONThe response entity.
dataJSONThe response details.

Authorization

Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following Authorization field must be filled in the request header:


_1
Authorization: Bearer ${YourAppToken}

In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see Authentication using App Token.

Set the display name in push notifications

Sets the nickname displayed in push notifications.

For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

HTTP request


_1
PUT https://{host}/{org_name}/{app_name}/users/{userId}

Path parameter

ParameterTypeDescriptionRequired
userIdStringThe user ID of the current user.Yes

For the descriptions of other path parameters, see Common Parameters.

Request header

ParameterTypeDescriptionRequired
Content-TypeStringThe content type. Set it as application/json.Yes
AcceptStringThe parameter type. Set it as application/json.Yes
AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

Request body

ParameterTypeDescriptionRequired
nicknameStringThe nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. The length of the nickname cannot exceed 100 characters, and the following character sets are supported:
  • 26 lowercase English letters (a-z)
  • 26 uppercase English letters (A-Z)
  • 10 numbers (0-9)
  • Chinese characters
  • Special characters

  • If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (notification_display_style is set to 1).
    The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see Setting user attributes.
    No

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    uuidStringA unique internal identifier generated by the Chat service for the user in this request.
    typeStringThe type of the chat. "user" indicates a One-to-one chat.
    createdNumberThe Unix timestamp (ms) when the user account is registered.
    modifiedNumberThe Unix timestamp (ms) when the user information is last modified.
    usernameStringThe ID of the user.
    activatedBoolWhether the user account is active:
  • true: The user account is active.
  • false: The user account is deactivated. To unban a deactivated user account, refer to Unbanning a user.
  • nicknameStringThe nickname displayed in push notifications.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _1
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' -d '{ "nickname": "testuser" }' 'http://XXXX/XXXX/XXXX/users/user1'

    Response example


    _20
    {
    _20
    "action": "put",
    _20
    "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
    _20
    "path": "/users",
    _20
    "uri": "https://XXXX/XXXX/XXXX/users",
    _20
    "entities": [
    _20
    {
    _20
    "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
    _20
    "type": "user",
    _20
    "created": 1542595573399,
    _20
    "modified": 1542596083687,
    _20
    "username": "user1",
    _20
    "activated": true,
    _20
    "nickname": "testuser"
    _20
    } ],
    _20
    "timestamp": 1542596083685,
    _20
    "duration": 6,
    _20
    "organization": "agora-demo",
    _20
    "applicationName": "testapp"
    _20
    }

    Set the display style in push notifications

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    HTTP request


    _1
    PUT https://{host}/{org_name}/{app_name}/users/{userId}

    Path parameter

    ParameterTypeDescriptionRequired
    userIdStringThe user ID of the current user.Yes

    For the descriptions of other path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    Content-TypeStringThe content type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body

    ParameterTypeDescriptionRequired
    notification_display_styleIntThe display style of push notifications:
  • (Default) 0: The push title is "You have a new message", and the push content is "Click to check".
  • 1: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message.
  • Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    uuidStringA unique internal identifier generated by the Chat service for the user in this request.
    typeStringThe type of the chat. "user" indicates a One-to-one chat.
    createdNumberThe Unix timestamp (ms) when the user account is registered.
    modifiedNumberThe Unix timestamp (ms) when the user information is last modified.
    usernameStringThe ID of the user.
    activatedBoolWhether the user account is active:
  • true: The user account is active.
  • false: The user account is deactivated. To unban a deactivated user account, refer to Unbanning a user.
  • notification_display_styleIntThe display style of push notifications. This parameter is returned only if you specify it when sending the request.
    nicknameStringThe nickname displayed in push notifications.
    notifier_nameStringThe name of the push certificate.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _4
    curl -X PUT https://XXXX/XXXX/XXXX/users/XXXX \
    _4
    -H 'Content-Type: application/json' \
    _4
    -H "Authorization: Bearer <YourAppToken>" \
    _4
    -d '{"notification_display_style": "1"}'

    Response example


    _22
    {
    _22
    "action" : "put",
    _22
    "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
    _22
    "path" : "/users",
    _22
    "uri" : "https://XXXX/XXXX/XXXX/users/XXXX",
    _22
    "entities" : [
    _22
    {
    _22
    "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
    _22
    "type" : "user",
    _22
    "created" : 1530276298905,
    _22
    "modified" : 1534407146060,
    _22
    "username" : "user1",
    _22
    "activated" : true,
    _22
    "notification_display_style" : 1,
    _22
    "nickname" : "testuser",
    _22
    "notifier_name" : "2882303761517426801"
    _22
    } ],
    _22
    "timestamp" : 1534407146058,
    _22
    "duration" : 3,
    _22
    "organization" : "XXXX",
    _22
    "applicationName" : "XXXX"
    _22
    }

    Set up push notifications

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    PUT https://{host}/{org}/{app}/users/{username}/notification/{chattype}/{key}

    Path parameter

    ParameterTypeDescriptionRequired
    userIdStringThe user ID of the current user.Yes
    chattypeStringThe type of the chat:
  • user: One-to-one chats.
  • chatgroup: Group chats.
  • Yes
    keyStringThe identifier of the chat:
  • If type is set to user, key indicates the user ID of the peer user.
  • If type is set to chatgroup, key indicates the ID of the chat group.
  • Yes

    To set up push notifications at the app level, you can set type to user and key to the user ID of the current user.
    For the descriptions of other path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    Content-TypeStringThe content type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body

    ParameterTypeDescriptionRequired
    typeStringThe push notification mode:
    • DEFAULT: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level.
    • ALL: Receives push notifications for all offline messages.
    • AT: Only receives push notifications for mentioned messages.
    • NONE: Do not receive push notifications for offline messages.
    No
    ignoreIntervalStringThe interval during which the DND mode is scheduled everyday. The value is in the format of {HH:MM-HH:MM}, for example, 08:30-10:00, where HH ranges from 00 to 23 in hour and MM from 00 to 59 in minute.
    • This parameter works only when chattype is set to user and key to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations.
    • The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days.
    • If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode.
    • If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.
    • Currently, only one DND interval is allowed, with the new setting overwriting the old.
    • If this parameter is not specified, pass in an empty string.
    • If both ignoreInterval and ignoreDuration are set, the DND mode works in both periods. For example, at 8:00, you set ignoreInterval to 8:00-10:00 and ignoreDuration to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.
    No
    ignoreDurationNumberThe DND duration in milliseconds. The value range is [0,604800000], where 0 indicates that this parameter is invalid and 604800000 indicates that the DND mode lasts for 7 days.
    • This parameter works for both the app and one-to-one and group chat conversations in it.
    • Unlike ignoreInterval set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day.
    • If both ignoreInterval and ignoreDuration are set, the DND mode remains in both periods. For example, at 8:00, you set ignoreInterval to 8:00-10:00 and ignoreDuration to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.
    No
    For both the app and all the conversations in the app, the DNS mode setting (ignoreInterval or ignoreDuration) takes precedence over the setting of the push notification mode (type). For example, assume that ignoreInterval or ignoreDuration is specified at the app level and type is set to ALL for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    typeStringThe push notification mode.
    ignoreIntervalStringThe DND time frame.
    ignoreDurationLongThe DND duration.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _8
    curl -L -X PUT 'http://XXXX/XXXX/XXXX/users/XXXX/notification/user/XXXX' \
    _8
    -H 'Authorization: Bearer <YourAppToken>' \
    _8
    -H 'Content-Type: application/json' \
    _8
    -d '{
    _8
    "type":"NONE",
    _8
    "ignoreInterval":"21:30-08:00",
    _8
    "ignoreDuration":86400000
    _8
    }'

    Response example


    _15
    {
    _15
    "path": "/users",
    _15
    "uri": "https://XXXX/XXXX/XXXX/users/notification/user/XXXX",
    _15
    "timestamp": 1647503749918,
    _15
    "organization": "XXX",
    _15
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _15
    "action": "put",
    _15
    "data": {
    _15
    "type": "NONE",
    _15
    "ignoreDuration": 1647590149924,
    _15
    "ignoreInterval": "21:30-08:00"
    _15
    },
    _15
    "duration": 20,
    _15
    "applicationName": "XXXX"
    _15
    }

    Retrieve the settings of push notifications

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    GET https://{host}/{org_name}/{app_name}/users/{userId}/notification/{chattype}/{key}

    Path parameter

    ParameterTypeDescriptionRequired
    userIdStringThe user ID of the current user.Yes
    chattypeStringThe type of the chat:
  • user: One-to-one chats.
  • chatgroup: Group chats.
  • Yes
    keyStringThe identifier of the chat:
  • If type is set to user, key indicates the user ID of the peer user.
  • If type is set to chatgroup, key indicates the ID of the chat group.
  • Yes

    For the descriptions of other path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    typeStringThe push notification mode.
    ignoreIntervalStringThe DND time frame.
    ignoreDurationLongThe DND duration.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _2
    curl -L -X GET 'https://XXXX/XXXX/XXXX/users/XXXX/notification/chatgroup/XXXX' \
    _2
    -H 'Authorization: Bearer <YourAppToken>'

    Response example


    _15
    {
    _15
    "path": "/users",
    _15
    "uri": "https://XXXX/XXXX/XXXX/users/notification/chatgroup/12312312321",
    _15
    "timestamp": 1647503749918,
    _15
    "organization": "XXXX",
    _15
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _15
    "action": "get",
    _15
    "data": {
    _15
    "type": "NONE",
    _15
    "ignoreDuration": 1647590149924,
    _15
    "ignoreInterval": "21:30-08:00"
    _15
    },
    _15
    "duration": 20,
    _15
    "applicationName": "XXXX"
    _15
    }

    Set the preferred language of push notifications

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    PUT https://{host}/{org_name}/{app_name}/users/{userId}/notification/language

    Path parameter

    ParameterTypeDescriptionRequired
    userIdStringThe user ID of the current user.Yes

    For the descriptions of path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    Content-TypeStringThe content type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body

    ParameterTypeDescriptionRequired
    translationLanguageStringThe code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    languageStringThe code for the language that the user prefers to see push notifications in.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _6
    curl -L -X PUT 'https://XXXX/XXXX/XXXX/users/XXXX/notification/language' \
    _6
    -H 'Authorization: Bearer <YourAppToken>' \
    _6
    -H 'Content-Type: application/json' \
    _6
    -d '{
    _6
    "translationLanguage":"EU"
    _6
    }'

    Response example


    _13
    {
    _13
    "path": "/users",
    _13
    "uri": "https://XXXX/XXXX/XXXX/users/XXXX/notification/language",
    _13
    "timestamp": 1648089630244,
    _13
    "organization": "XXXX",
    _13
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _13
    "action": "put",
    _13
    "data": {
    _13
    "language": "EU"
    _13
    },
    _13
    "duration": 66,
    _13
    "applicationName": "XXXX"
    _13
    }

    Retrieve the preferred language of push notifications

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    GET https://{host}/{org}/{app}/users/{userId}/notification/language

    Path parameter

    ParameterTypeDescriptionRequired
    userIdStringThe user ID of the current user.Yes

    For the descriptions of path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    languageStringThe code for the language that the user prefers to see push notifications in.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _2
    curl -L -X GET 'https://XXXX/XXXX/XXXX/users/XXXX/notification/language' \
    _2
    -H 'Authorization: Bearer <YourAppToken>'

    Response example


    _13
    {
    _13
    "path": "/users",
    _13
    "uri": "https://XXXX/XXXX/XXXX/users/XXXX/notification/language",
    _13
    "timestamp": 1648089630244,
    _13
    "organization": "XXXX",
    _13
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _13
    "action": "put",
    _13
    "data": {
    _13
    "language": "EU"
    _13
    },
    _13
    "duration": 66,
    _13
    "applicationName": "XXXX"
    _13
    }

    Create a push template

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    POST https://{host}/{org}/{app}/notification/template`

    Path parameter

    For the descriptions of path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    Content-TypeStringThe content type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body

    ParameterTypeDescriptionRequired
    nameStringThe name of the push template.Yes
    title_patternStringThe custom title of the push template. You can add variables in the title, such as 0.Yes
    content_patternStringThe custom content of the push template. You can add variables in the content, such as 0 and 1.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    nameStringThe name of the push template.
    createAtNumberThe Unix timestamp (ms) when the template is created.
    updateAtNumberThe Unix timestamp (ms) when the template is last modified.
    title_patternStringThe custom title of the push template.
    content_patternStringThe custom content of the push template.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _8
    curl -X POST 'https://XXXX/XXXX/XXXX/notification/template' \
    _8
    -H 'Authorization: Bearer <YourAppToken>' \
    _8
    -H 'Content-Type: application/json' \
    _8
    -d '{
    _8
    "name": "test7",
    _8
    "title_pattern": "Hello,{0}",
    _8
    "content_pattern": "Test,{0}"
    _8
    }'

    Response example


    _16
    {
    _16
    "uri": "https://XXXX/XXXX/XXXX/notification/template",
    _16
    "timestamp": 1646989584108,
    _16
    "organization": "XXXX",
    _16
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _16
    "action": "post",
    _16
    "data": {
    _16
    "name": "test7",
    _16
    "createAt": 1646989584124,
    _16
    "updateAt": 1646989584124,
    _16
    "title_pattern": "Hello,{0}",
    _16
    "content_pattern": "Test,{0}"
    _16
    },
    _16
    "duration": 26,
    _16
    "applicationName": "XXXX"
    _16
    }

    Retrieve a push template

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    GET https://{host}/{org}/{app}/notification/template/{name}

    Path parameter

    ParameterTypeDescriptionRequired
    nameStringThe name of the push template.Yes

    For the descriptions of other path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    nameStringThe name of the push template.
    createAtNumberThe Unix timestamp (ms) when the template is created.
    updateAtNumberThe Unix timestamp (ms) when the template is last modified.
    title_patternStringThe custom title of the push template.
    content_patternStringThe custom content of the push template.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _2
    curl -X GET 'https://XXXX/XXXX/XXXX/notification/template/XXXX' \
    _2
    -H 'Authorization: Bearer <YourAppToken>'

    Response example


    _16
    {
    _16
    "uri": "https://XXXX/XXXX/XXXX/notification/template/XXXX",
    _16
    "timestamp": 1646989686393,
    _16
    "organization": "XXXX",
    _16
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _16
    "action": "get",
    _16
    "data": {
    _16
    "name": "test7",
    _16
    "createAt": 1646989584124,
    _16
    "updateAt": 1646989584124,
    _16
    "title_pattern": "Hello,{0}",
    _16
    "content_pattern": "Test,{0}"
    _16
    },
    _16
    "duration": 11,
    _16
    "applicationName": "XXXX"
    _16
    }

    Delete a push template

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    HTTP request


    _1
    DELETE https://{host}/{org}/{app}/notification/template/{name}

    Path parameter

    ParameterTypeDescriptionRequired
    nameStringThe name of the push template.Yes

    For the descriptions of other path parameters, see Common Parameters.

    Request header

    ParameterTypeDescriptionRequired
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response

    Response body

    If the returned HTTP status code is 200, the request succeeds, and the response body contains the following fields:

    ParameterTypeDescription
    nameStringThe name of the push template.
    createAtNumberThe Unix timestamp (ms) when the template is created.
    updateAtNumberThe Unix timestamp (ms) when the template is last modified.
    title_patternStringThe custom title of the push template.
    content_patternStringThe custom content of the push template.

    For other fields and detailed descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible reasons.

    Example

    Request example


    _2
    curl -X DELETE 'https://XXXX/XXXX/XXXX/notification/template/XXXX' \
    _2
    -H 'Authorization: Bearer <YourAppToken>'

    Response example


    _16
    {
    _16
    "uri": "https://XXXX/XXXX/XXXX/notification/template/XXXX",
    _16
    "timestamp": 1646989686393,
    _16
    "organization": "XXXX",
    _16
    "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
    _16
    "action": "delete",
    _16
    "data": {
    _16
    "name": "test7",
    _16
    "createAt": 1646989584124,
    _16
    "updateAt": 1646989584124,
    _16
    "title_pattern": "Hello,{0}",
    _16
    "content_pattern": "Test,{0}"
    _16
    },
    _16
    "duration": 11,
    _16
    "applicationName": "XXXX"
    _16
    }

    Status codes

    For details, see HTTP Status Codes.

    vundefined