Routing Rules API Reference

Possible Values for fields

Action Type

| Value | Description | | ----------------------------- | ------------------------------------ | | NOTIFY_TEAM | Notify a specific team | | NOTIFY_WORKSPACE_MEMBER | Notify a specific workspace member | | NOTIFY_CURRENT_ON_CALL_USER | Notify the current on-call user | | NOTIFY_NEXT_ON_CALL_USER | Notify the next on-call user | | NOTIFY_ALL_ON_CALL_MEMBERS | Notify all members currently on-call |

Assertion Type

| Value | Description | | --------------------- | ------------------------------------------- | | IMPACT | Asserts the impact of an event | | TITLE | Asserts the title of an event | | DESCRIPTION | Asserts the description of an event | | AFFECTED_COMPONENTS | Asserts the affected components of an event |

Comparasion Types

| Value | Description | | ------------------------ | ---------------------------------------------------- | | EQUALS | Checks if the value is equal | | NOT_EQUALS | Checks if the value is not equal | | IS_EMPTY | Checks if the value is empty | | NOT_EMPTY | Checks if the value is not empty | | GREATER_THAN | Checks if the value is greater than | | GREATER_THAN_OR_EQUALS | Checks if the value is greater than or equal | | LESS_THAN | Checks if the value is less than | | LESS_THAN_OR_EQUALS | Checks if the value is less than or equal | | CONTAINS | Checks if the value contains a specified substring | | NOT_CONTAINS | Checks if the value does not contain a substring | | HAS_KEY | Checks if an object has a specific key | | NOT_HAS_KEY | Checks if an object does not have a specific key | | HAS_VALUE | Checks if an object has a specific value | | NOT_HAS_VALUE | Checks if an object does not have a specific value | | IS_NULL | Checks if the value is null | | NOT_NULL | Checks if the value is not null | | STARTS_WITH | Checks if the value starts with a specific substring | | ENDS_WITH | Checks if the value ends with a specific substring |

Get Routing Rules

Endpoint:

GET /:page_id/routing-rules

Example request

GET /1/routing-rules

Example response

{
"routingRules": [
{
"id": "1",
"siteId": "pageId",
"assertions": [
{
"id": "1",
"routingRuleId": "1",
"type": "TITLE",
"comparison": "CONTAINS",
"value": "value1"
},
{
"id": "2",
"routingRuleId": "1",
"type": "TITLE",
"comparison": "CONTAINS",
"value": "value2"
}
],
"actions": [
{
"id": "1",
"routingRuleId": "1",
"type": "NOTIFY_WORKSPACE_MEMBER",
"targetId": "value1"
},
{
"id": "2",
"routingRuleId": "1",
"type": "NOTIFY_WORKSPACE_MEMBER",
"targetId": "member@platform.com"
}
],
"createdAt": "2021-09-29T00:00:00.000Z",
"updatedAt": "2021-09-29T00:00:00.000Z",
"order": 1
}
]
}

Create Routing Rule

Endpoint:

POST /routing-rules

Keep in mind in actions targetId can be a workspace member email or a team id depending on the type of the action.

Example request

{
"routingRule": {
"assertions": [
{
"id": "1",
"routingRuleId": "1",
"type": "TITLE",
"comparison": "CONTAINS",
"value": "value1"
},
{
"id": "2",
"routingRuleId": "1",
"type": "TITLE",
"comparison": "CONTAINS",
"value": "value2"',
}
],
"actions": [
{
"id": "1",
"routingRuleId": "1",
"type": "NOTIFY_WORKSPACE_MEMBER",
"targetId": "member2@platform.com"
},
{
"id": "2",
"routingRuleId": "1",
"type": "NOTIFY_WORKSPACE_MEMBER",
"targetId": "member@platform.com"
}
],
"order": 1,
"siteId": "site-id-1"
},
"message": "Routing rule updated successfully"
}

Example response

{
"routingRule": {
"id": "routing-rule-id-1",
"order": 1,
"siteId": "site123",
"updatedAt": "2021-09-01T12:00:00Z",
"createdAt": "2021-09-01T12:00:00Z"
},
"message": "Routing rule created successfully."
}

Update Routing Rule

Endpoint:

PUT /routing-rules/:id

Example request

PUT /routing-rules/routing-rule-id-1
{
"routingRule": {
"id": "routing-rule-id-1",
"assertions": [
{
"id": "assertion-id-1",
"routingRuleId": "routing-rule-id-1",
"comparison": "CONTAINS",
"value": "Issue With X",
"type": "TITLE"
}
],
"order": 1,
"siteId": "site-id-1",
"updatedAt": "2021-09-01T12:00:00Z",
"createdAt": "2021-05-01T12:00:00Z"
},
"message": "Routing rule updated successfully"
}

Example response

{
"routingRule": {
"id": "routing-rule-id-1",
"assertions": [
{
"id": "assertion-id-1",
"routingRuleId": "routing-rule-id-1",
"comparison": "CONTAINS",
"value": "Issue With X",
"type": "TITLE"
}
],
"order": 1,
"siteId": "site-id-1",
"updatedAt": "2024-08-09T12:00:00Z",
"createdAt": "2021-05-01T12:00:00Z"
},
"message": "Routing rule updated successfully"
}

Delete Routing Rule

Endpoint:

DELETE /routing-rules/:id

Example request

DELETE /routing-rules/routing-rule-id-1

Example response

{
"message": "Routing rule deleted successfully."
}