Messages

Message variables

When sending messages using the Whispir API, you can automatically include recipient information as part of the message. This is facilitated by message tags.

You use the contact mri/user mri from the Whispir system to resolve these variables.

The following tags can be included in any SMS, email or voice message:

Recipient message 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, 61412345678.

@@recipient_voice@@

Recipient’s primary phone number for voice calls.

For example, 61412345678.

@@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.

Each of these tags will resolve to an individual recipient’s information when you send the message. As Whispir needs to know about this information prior to sending the message, the tags only work when sending messages to contacts or distribution lists.

For more information about sending messages to contacts or distribution lists see to Contacts and Distribution lists.

Note: Message tags don't work in rich messages. The Whispir JavaScript object must be used instead to populate recipient-specific fields.

Using auto-populated system variables in messages

When sending messages using the Whispir API, you can automatically include system-generated information as part of the message. This is facilitated by system tags.

The following system tags can be included in any message:

@@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.

Each of these system tags will resolve to the system information when you send the message. The system tags only work when sending messages to any recipient.

  • JSON
  • XML

Message Variables

Demonstration of sending messages with variables (or tags).

 

{{codeStart}}

HTTP 1.1 POST https://api.<region>.whispir.com/messages?apikey=[your_api_key]

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}}