Templates

Using templates

developers.whispir.com API messages can specify the message template ID in the message request, instead of specifying the entire content payload.

The message template can then easily be changed (using either another API request or by logging in to the Whispir platform) and the part of the application sending the messages doesn't need to be altered.

  • JSON
  • XML

Using templates

The following methods allow you to use the templates that you’ve created in your Whispir messages:

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

{

"to" : "+1000000000",

"messageTemplateId" : "BACEB8D46BEF5315"

}

{{codeEnd}}

 

Alternatively, you can enter the message template name instead of the message memplate ID:

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

{

"to" : "+1000000000",

"messageTemplateName" : "Sample SMS Template"

}

{{codeEnd}}