Referência da API de regras de roteamento
Valores possíveis dos campos
Tipo de ação
| Valor | Descrição |
|---|---|
NOTIFY_TEAM | Notificar um time específico |
NOTIFY_WORKSPACE_MEMBER | Notificar um membro do workspace |
NOTIFY_CURRENT_ON_CALL_USER | Notificar quem está de plantão agora |
NOTIFY_NEXT_ON_CALL_USER | Notificar o próximo de plantão |
NOTIFY_ALL_ON_CALL_MEMBERS | Notificar todos os membros de plantão |
Tipo de asserção
| Valor | Descrição |
|---|---|
IMPACT | Verifica o impacto de um evento |
TITLE | Verifica o título de um evento |
DESCRIPTION | Verifica a descrição de um evento |
AFFECTED_COMPONENTS | Verifica os componentes afetados por um evento |
Tipos de comparação
| Valor | Descrição |
|---|---|
EQUALS | Verifica se o valor é igual |
NOT_EQUALS | Verifica se o valor é diferente |
IS_EMPTY | Verifica se o valor está vazio |
NOT_EMPTY | Verifica se o valor não está vazio |
GREATER_THAN | Verifica se o valor é maior que |
GREATER_THAN_OR_EQUALS | Verifica se o valor é maior ou igual |
LESS_THAN | Verifica se o valor é menor que |
LESS_THAN_OR_EQUALS | Verifica se o valor é menor ou igual |
CONTAINS | Verifica se o valor contém a substring indicada |
NOT_CONTAINS | Verifica se o valor não contém a substring |
HAS_KEY | Verifica se um objeto tem uma chave específica |
NOT_HAS_KEY | Verifica se um objeto não tem uma chave específica |
HAS_VALUE | Verifica se um objeto tem um valor específico |
NOT_HAS_VALUE | Verifica se um objeto não tem um valor específico |
IS_NULL | Verifica se o valor é nulo |
NOT_NULL | Verifica se o valor não é nulo |
STARTS_WITH | Verifica se o valor começa com uma substring específica |
ENDS_WITH | Verifica se o valor termina com uma substring específica |
Obter as regras de roteamento
Endpoint:
GET /:page_id/routing-rules
Exemplo de requisição
GET /1/routing-rules
Exemplo de resposta
{"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}]}
Criar regra de roteamento
Endpoint:
POST /routing-rules
Lembre-se de que, nas ações, targetId pode ser o e-mail de um membro do workspace ou o id de um time, dependendo do tipo da ação.
Exemplo de requisição
{"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"}
Exemplo de resposta
{"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."}
Atualizar regra de roteamento
Endpoint:
PUT /routing-rules/:id
Exemplo de requisição
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"}
Exemplo de resposta
{"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"}
Excluir regra de roteamento
Endpoint:
DELETE /routing-rules/:id
Exemplo de requisição
DELETE /routing-rules/routing-rule-id-1
Exemplo de resposta
{"message": "Routing rule deleted successfully."}