Receiving event notifications

WebHooks is a system of automated notifications sent to indicate that an event has happened with one of your work orders, or a new work order is received. Instead of pulling information via the CorrigoPro API, you can use WebHook notifications to push information to your application when important events occur.

πŸ“˜

Note

Configure your WebHook as it is described in Configuration topic.

❗️

Important

No WebHook notifications are sent for actions initiated by CorrigoPro Direct!
So, if a work order is accepted via CorrigoPro Direct API, its status must be changed in your CMMS manually without waiting for a notification about this event.

Request structure

WebHook data is sent as JSON in the POST request body.
Each request header contains Authorization with OAuth token that can be used to validate it.

The following example shows a sample notification header:

Connection: Keep-Alive
Content-Length: 3296
Content-Type: application/json; charset=utf-8
Authorization: Bearer H4sIAAAEAG2MQQr<---->fyyoO7AkAOIJG3 (truncated for clarity)
Expect: 100-continue
Host: your.webhook.com
Event-Type: {name of an action}

Message header

A message header is available in all requests. It includes general information about the notification. The Action parameter shows what was changed. This parameter might be used to determine the data that is received and its structure. For details on the structure of data, see MessageHeader.

Request body

Each request body contains detailed information about event that happened. To identify an event type, review the Header property of the notification JSON included in the request body.
The following JSON represents an example of a notification body:

{
	"Header": {
		"WorkOrderId": 42,
		"BranchId": 492042,
		"Sender": {
			"Name": "Jon Snow",
			"Phone": "+12025550141",
			"Type": "CorrigoPro"
		},
		"Action": "{name of an action}",
		"ActionDate": "2018-09-04T10:12:08.1671613Z",
		"ApiVersion": "1.1",
		"MessageId": "c1d3d80f-a76c-452c-9261-682279a659cb"
	},
  {other fields of notification}
}

πŸ“˜

Note:

You can emulate any notification by using WebHook Emulator.