Notificar motorista por WhatsApp ao atribuir frete
Template + regra prontos: o motorista recebe os detalhes do frete automaticamente.
1. Crie o template
Em Templates → Novo, crie:
text
Nome: driver_assignment
Canal: whatsapp
Idioma: pt-BR
Conteúdo:
Olá {{driver.name}}! Você foi atribuído ao frete #{{freight.code}}.
Origem: {{freight.origin_city}}/{{freight.origin_state}}
Destino: {{freight.destination_city}}/{{freight.destination_state}}
Valor: R$ {{freight.price}}
Coleta prevista: {{freight.pickup_date}}
Responda ACEITO para confirmar ou RECUSO para liberar.2. Crie a regra
json
{
"name": "Notificar motorista atribuído",
"trigger": "when_assign_driver",
"scope": {},
"conditions": {
"all": [
{ "fact": "driver.status", "op": "eq", "value": "ativo" }
]
},
"actions": [
{
"type": "notify_message",
"channel": "whatsapp",
"template_id": "<uuid-do-template-driver_assignment>"
}
],
"priority": 200,
"enabled": true
}Resultado
A cada atribuição, o motorista recebe a mensagem em segundos. Se ele responder ACEITO, o frete avança automaticamente para o status aceito.