Triggered Alerts

Rather than send an alert immediately or on a schedule basis, you can also setup ‘trigger’ points such as SMS keywords, Email subject lines or shortlink URLs. When these trigger points are setup the alert is stored away until such a time as one of those trigger points is activated (for instance by someone visiting the shortlink URL).

In addition, you can request that a previously stored or deferred alert is actually the one to be launched when a trigger is activated. If you do this then the current /sendalert api continues to be processed; this allows you to be able to send out confirmation SMS/Emails containing the trigger point shortlink URLs and other details in advance.

"trigger": {
    "minimumRepeatInterval": "5m",
    "maximumRepeats": 1
    "storeDetails" : {
        "storeName" : "myPreviouslyStoredAlert"
    },
    "triggers": [
        {
          "keyword": "",
          "type": "shortlink",
          "tag": "sl1"
        },
        {
          "keyword": "mykeyword",
          "type": "sms",
          "tag": "sl2"
        }
  ]
}

ParameterRequirementDefaultDescription
minimumRepeatIntervalOptional1mSpecifies the grace period during which repeated triggering of the same alert (e.g. more than one person visiting the shortlink URL) will not result in the alert being resent.
maximumRepeatsOptional0How many times the alert can be resent when activation triggers are received. A value of 0 means that the alert can be resent indefinitely.
storeDetailsOptionalNoneIf a valid, existing, store is specified then it is used as the alert to be launched when one of the triggers is activated. See API guide for more details. Alerts can be pre-stored by either calling the /storecontent api call or by specifying a deferral JSON object when making a /sendalert api call. If a stored alert is used here then the remainder the current /sendalert is processed.
triggersMandatoryNoneSet of JSON objects, each describing a trigger to associate with this alert.
    typeMandatoryNoneOne of: sms, email, shortlink
    keywordMandatoryNoneFor type:sms or type:email this must specify a unique keyword that Alerting Hub would receive as either an inbound SMS or an inbound email subject line. These keywords are case insensitive and must occur within the 1st 40 characters of an SMS message or email subject line. Note that for these types of automatic keywords, Alerting Hub will add a 2 digit random number to the end of each requested keyword.

For type:shortlink the keyword can be set to an empty string and will be auto-populated by a randomised short-url code.
    tagOptionalNoneAn optional tag for this keyword. The tag can then be used when sending sms or emails (or even TTS voice calls) as Alerting Hub will auto-populate the following lookup keys:
  • trigger-[tag]-keyword = keyword used/generated
  • trigger-[tag]-sender = sender used
  • trigger-[tag]-recipient = recipient used
    senderOptionalallSpecifies a restriction list of who can activate the keyword. For type=sms this would be sender phone numbers, for type=email this would be email senders and for type=shortlink this would be ip addresses. The default of 'all' means that anyone can send the trigger in.
    recipientOptionalallSpecifies a restriction list of recipients that can check for this keyword. For type=sms this would be receiving virtual numbers, for type=email this would be email recipients and for type=shortlink this is ignored (the shortlink itself is the only recipient). The default of 'all' means that any number / email address that AlertingHub can receive message on can check for the keyword.

Response

Part of the response to submitting a triggered alert request will be a section including the description of the various keywords:

{
  "triggers": [
    {
      "keyword": "https://ahub.app/sl/dqngdjr",
      "type": "shortlink",
      "success": true
    },
    {
      "keyword": "mykeyword91",
      "type": "sms",
      "success": true
    }
  ],
  "trigger": {
    "set": true,
    "storeId": "12345678-1234-5687-2468-123456789abc",
    "storeName": "myPreviouslyStoredAlert",
    "expirationInDays": 60
  }
}