Native message variables

When sending messages using the Whispir API you can automatically customise your communications including recipients information as part of the message. This is facilitated by the Whispir's native message variables [or native tags] that will be resolved against the recipients MRIs

IMPORTANT: the following tags can be included in any SMS, email or voice message. They are NOT meant to be used in rich messages. In this case recipient-specific fields can be populated using the Whispir JavaScript API. See Rich Messages for an example

Native Contacts tags

@@first_name@@

Recipient’s first name.

For example, John.

@@last_name@@

Recipient’s last name.

For example, Smith.

@@recipient_email@@

Recipient’s primary email address.

For example, jsmith@email.com

@@recipient_sms@@

Recipient’s primary mobile phone number.

For example, 61400400400.

@@recipient_voice@@

Recipient’s primary phone number for voice calls.

For example, 61400400400.

@@pin@@

Whispir message retrieval service call back PIN (only populated when voice is used).

For example, 1234.

@@recipient_role@@

Resolves to the recipient’s ‘Role’ field.

For example, Manager.

@@recipient_additionalrole@@

Resolves to the recipient’s ‘Additional Role’ field.

For example, Team Leader.

@@team_name1@@

Resolves to the recipient’s ‘Team Name’ field.

For example, Red Team.

@@messagelabel@@

Resolves to the label field of the sent message.

For example, Incident #1234.

@@messagecategories@@

Resolves to the list of categories used in the message, separated with commas.

For example, Product Update.

  • JSON
  • XML

{{codeStart}}

# To call from a User-defined workspace

POST https://api.<region>.whispir.com/workspaces/:workspace_id/messages 

# To call from the default workspace

POST https://api.<region>.whispir.com/messages

 

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Content-Type: application/vnd.whispir.message-v1+json

Accept: application/vnd.whispir.message-v1+json

 

{

"to" : "John_Wick.1143139@Contact.whispir.sg",

"subject" : "Test SMS Message with tags",

"body" : "Hi @@first_name@@. This is your message."

}

{{codeEnd}}



The main difference with the examples seen so far is given here by the to field of the payloads

Request Body Details

to

Defined Whispir recipients

  • Contact MRI:
    John_Smith.782749@Contact.whispir.com
  • User MRI:
    John_Smith@User.whispir.com
  • Distribution List MRI:
    Incidents.373947@List.whispir.com

Native system tags

When sending messages using the Whispir API, you can automatically include system-generated information via system variables. Each of them will resolve to the value obtained when you send the message. Unlike the preceding ones, they don't depend from the Contacts information stored in Whispir, so they can be included also in messages where the recipients are not represented by their MRI

@@dd@@

Current day with leading zero.

For example, 08.

@@mm@@

Current month with leading zero.

For example, 06.

@@yy@@

Current year, short form.

For example, 19.

@@yyyy@@

Current year, long form.

For example, 2019.

@@day@@

Day in spoken form.

For example, Wednesday.

@@month@@

Month in spoken form.

For example, June.

@@hrs@@

Current hour with leading zero, in 24 hour format.

For example, 16.

@@min@@

Current minute with leading zero.

For example, 07.

@@date@@

Current date in format (yyyy-mm-dd)

For example, 2019-02-02.

@@time@@

Current time in 24-hour format.

For example, 14:37.