Configure Placeholders

Last Updated on : 2024-06-19 02:17:57download

What is a placeholder for push notifications?

A placeholder is a small piece of code that will be replaced with specific property values. You can use placeholders in different setting fields of notification when editing notification templates. Placeholders make it possible to personalize the notifications and deliver useful information to end users.

For example, the ordinary message to alert users of high temperature is High temperature is detected, attention!. If you want to provide more details, such as the detected temperature, you can add a placeholder to the template to represent the variable for temperature.

Supported placeholders

Placeholder Description
Device name ${device} The name of a device.
Username ${username} The username of an end user.
Rule name ${rule} The title of a notification rule.
DP value ${dp**} The value of a data point (DP). For example, the values reported by the DPs such as temperature and wind level.
DP name ${DP**_name} The name of a DP. For example, the name of a DP such as temperature or wind level.

Configure placeholders

  1. Log in to the Tuya Developer Platform. Choose Product > Device > Notifications. Click Create Notification.

  2. Edit the template as needed.

    Configure Placeholders

  3. Click Add Placeholder to insert a placeholder.

    Configure Placeholders

To use ${dp**} and ${DP**_name}, you need to specify the corresponding DP ID. The asterisk symbols (**) are replaced with the value of the DP ID.

The placeholders only support DPs of value type and string type.

Configure Placeholders

Example

We recommend you use DP value for temperature related notifications, so that end users can be informed of the detected temperature.

Configure templates

Title: High temperature warning
Content: Your device ${device} temperature has reached ${dp**}.

** represents the DP ID. Make sure to replace the ** with the value of the corresponding DP ID.

Sample

Configure Placeholders Configure Placeholders