. API  . Alert API

Alert API

This API can be used by your Skills bot to push app notifications to Kora.

POST https://{{host}}/api/public/users/{{userId}}/alert

Path Parameters

Parameter Description
host Environment URL, for example, https://kora.kore.ai
userId User id to whom the alert is intended for

Body Parameters

Parameter Description
from

Source object with the following details:

  • name – Source Identity for example Skill Name
  • id – unique identifier for example bot-id
payload

Object with notification details. Based on the payload parameters the notification would be sent to either the Update or Action Needed section. See the sample response below for better understanding.

Parameter Description
message
(mandatory)
Message text that needs to be displayed to the user for update notifications.
actions
(optional)

Action item notification details can be given here. This is an array of objects with the following details:

  • type of action – currently support is extended only to postback
  • title – title of the action item
  • utterance – that needs to be triggered on user click
ttl
(optional,
applicable only for actions)

Minutes the notification needs to stay in the notification tray. By default it is set to 60 minutes but you can set to a maximum of 1440 minutes (ie 1 day).

Authorization

Invoke the API with JWT in the header with the following syntax:

auth: {JWT}

Or Directly pass the userToken in the request header as follows:
"token": "<userToken>"

(See here for details)

Response content type

application/json

Sample Request

For Update Notification:

curl -X POST \
  https://kora.kore.ai/api/public/users/<u-user-uuid>/alert \
  -H 'auth: YOUR_JWT_ACCESS_TOKEN' \
  -H 'content-type: application/json' \
  -d '{
        "from": {
        	"name":  "ITSM",
                "Id": "st-hr-bot-id"
          },
  	"payload" : {
              "message": "Upgrade task scheduled at 4pm today"
  	 }
      }'

This would result in the update notification sent to the user as shown in the image below:

For Action Item Notification:

curl -X POST \
  https://kora.kore.ai/api/public/users/<u-user-uuid>/alert \
  -H 'auth: YOUR_JWT_ACCESS_TOKEN' \
  -H 'content-type: application/json' \
  -d '{
        "from": {
        	"name":  "ITSM",
                "Id": "st-hr-bot-id"
          },
  	"payload" : {
          "message": "Upgrade task scheduled at 4pm today"
          "actions": [
              {
               "type": "postback",
               "title" : "Postpone",
               "utterance": "Ask ITSM to reschedule upgrade task #123"
              },
             {
               "type": "postback",
               "title" : "Ignore",
               "utterance": "Ask ITSM to cancel the upgrade task #123"
             }
           ]
           "ttl": "60" 
  	 }
      }'

This would result in an action notification sent to the user as shown below:

Sample Response

{ 
   "alert": "SUCCESS" 
}