Referencia de la API de reglas de enrutamiento

Valores posibles de los campos

Tipo de acción

ValorDescripción
NOTIFY_TEAMNotificar a un equipo concreto
NOTIFY_WORKSPACE_MEMBERNotificar a un miembro concreto del espacio de trabajo
NOTIFY_CURRENT_ON_CALL_USERNotificar a la persona de guardia actual
NOTIFY_NEXT_ON_CALL_USERNotificar a la siguiente persona de guardia
NOTIFY_ALL_ON_CALL_MEMBERSNotificar a todos los miembros que estén de guardia

Tipo de comprobación

ValorDescripción
IMPACTComprueba el impacto de un evento
TITLEComprueba el título de un evento
DESCRIPTIONComprueba la descripción de un evento
AFFECTED_COMPONENTSComprueba los componentes afectados de un evento

Tipos de comparación

ValorDescripción
EQUALSComprueba si el valor es igual
NOT_EQUALSComprueba si el valor no es igual
IS_EMPTYComprueba si el valor está vacío
NOT_EMPTYComprueba si el valor no está vacío
GREATER_THANComprueba si el valor es mayor
GREATER_THAN_OR_EQUALSComprueba si el valor es mayor o igual
LESS_THANComprueba si el valor es menor
LESS_THAN_OR_EQUALSComprueba si el valor es menor o igual
CONTAINSComprueba si el valor contiene una subcadena concreta
NOT_CONTAINSComprueba si el valor no contiene una subcadena
HAS_KEYComprueba si un objeto tiene una clave concreta
NOT_HAS_KEYComprueba si un objeto no tiene una clave concreta
HAS_VALUEComprueba si un objeto tiene un valor concreto
NOT_HAS_VALUEComprueba si un objeto no tiene un valor concreto
IS_NULLComprueba si el valor es null
NOT_NULLComprueba si el valor no es null
STARTS_WITHComprueba si el valor empieza por una subcadena concreta
ENDS_WITHComprueba si el valor termina con una subcadena concreta

Obtener las reglas de enrutamiento

Endpoint:

GET /:page_id/routing-rules

Petición de ejemplo

GET /1/routing-rules

Respuesta de ejemplo

{
"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
}
]
}

Crear una regla de enrutamiento

Endpoint:

POST /routing-rules

Ten en cuenta que, en las acciones, targetId puede ser el correo de un miembro del espacio de trabajo o el ID de un equipo, según el tipo de acción.

Petición de ejemplo

{
"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"
}

Respuesta de ejemplo

{
"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."
}

Actualizar una regla de enrutamiento

Endpoint:

PUT /routing-rules/:id

Petición de ejemplo

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"
}

Respuesta de ejemplo

{
"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"
}

Eliminar una regla de enrutamiento

Endpoint:

DELETE /routing-rules/:id

Petición de ejemplo

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

Respuesta de ejemplo

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