/
ALERT WEB SERVICES

ALERT WEB SERVICES

Alerts are messages generated by the API to a client informing about several circumstances. E.g.:

  • Display a message
  • Inform about a new Event or Task
  • Request to execute an action

In order to receive the alerts generated by the API, the client must create a subscription to the alert system. This is done by means of the API function alert_subscribe (), which defines also which channel should be used to send the alert notifications.

Alert format

Alerts generated by the API consist in a JSON formatted string, which can contain the following fields:

  • action: Action that the client should perform on receiving the alert
    • "SHOW_EVENT": Asks the client application to navigate to the specified EVENT
    • "SHOW_TASK": Asks the client application to navigate to the specified TASK
    • "SHOW_FORM": Asks the client application to navigate to the specified FORM
    • "MESSAGE": Asks the client application to display a message for the user
    • "EXECUTE": Requests the client to invoke action_exec (). Normally the client application should ask the user for permission to execute the action
  • type: Specifies the type of alert
    • "INFO": Something happened that may be of interest for the user of the client application
    • "WARNING": Something importat happened that may be of interest for the user of the client application, though it is not critical
    • "ERROR": An error happened when the API tried to execute some action.
  • priority: Allows the client application to decide how to handle the alert. For example, a low priority alert could be stored in an 'alerts basket' to be inspected later, while a high priority alert should be displayed immediately to the user
  • message: Explanation of the alert
  • action_exec_token: token that should be passed to action_exec () in actions of type "EXECUTE".
  • task: (optional) TASK reference. Provided if the action is related to a specific TASK (E.g. when action = "REDIRECT_TO_TASK")
  • form: (optional) FORM reference. Provided if the action is related to a specific FORM (E.g. when action = "REDIRECT_TO_FORM")
  • event: (optional) EVENT reference. Provided if the action is related to a specific EVENT (E.g. when action = "REDIRECT_TO_EVENT")
  • admission: (optional) ADMISSION reference. Provided if the action is related to a specific ADMISSION
  • case: (optional). CASE reference. Provided if the action is related to a specific CASE

Example

{
  "type": "INFO",
  "action": "SHOW_EVENT",
  "priority": "NORMAL",
  "message": "You have received a new EVENT",
  "event": 18282,
  "admission": 4322,
  "case": 16761
}

Related content