Response rules

Matched rule

If a message is sent using a template and associated ResponseRule, it would be helpful to know what response rule condition has been matched when the reply is received from recipients. The Whispir API lets you know this in real time via the /callbacks endpoint.

To use a callback to get the matched response rule condition:

  1. Create a response rule with the required conditions.
  2. Create a template/use an existing template with the above responserule ID added to it.
  3. Create a callback or use an existing callback.
  4. Send a message using the /messages endpoint, specifying the To, template and callbackId values.

After the message is received:

  • The recipient has replied to the message.
  • The message is received by Whispir.
  • Response rules are applied to the response.
  • A callback is invoked.
  • The response body contains the response given by the recipient, the channel, timestamps (see Callbacks) and customParameters.

What’s inside the custom parameters?

  • Custom parameters give you details of various processing/processed values associated with a message.
  • While many parameters are sent, the ones that are associated with response rules are :
    • responseRule: The name of responseRule that has been matched.
    • matchedCategory: The category/condition inside the responseRule that has been matched.

For more details on the callbackParameters refer to the /callbacks endpoint.

  • JSON
  • XML

Matched rule

Sending a message using template and callback:


HTTP 1.1 POST https://api.<region>[your_api_key]

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

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


"to" : "+1000000000",

"messageTemplateName" : "ReplyYesNoTemplate",

"callbackId" : "myCallbackName"



Custom parameters in a callback specifying the matched rule and category:


"customParameters" : {

"matchedCategory" : "Reserved",

"responseRule" : "Reserved Words",