Send alerts from webhooks
Turn incidents, cancelled shifts and form submissions into messages for your team.
Webhooks suit alerts. You subscribe to the event, check a condition, and send a message to a chat tool or email.
Useful events
| Alert | Event |
|---|---|
| A new incident has been reported | incident.created |
| A shift was cancelled | appointment.cancelled |
| A form was submitted | form.submitted |
| A new enquiry came in | prospect.created |
Example: incident alert
This receives incident.created and posts to a chat webhook URL that your chat tool gives you. The shape of the incident data is described in Payloads; log a real event first to see the fields you want.
async function onEvent(e) {
if (e.is_test || e.event !== "incident.created") return;
await fetch(process.env.CHAT_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `New incident reported (id ${e.resource.id}) for ${e.company_details.business_name}`,
}),
});
}
Tips
- Keep the message short and link to the record in Imploy. Don't copy sensitive details into a chat tool.
dataonly has the fields Imploy chooses to share. Call the API for more, with a token that has the right permission.- Only subscribe to events you act on. Fewer events means fewer deliveries to handle.
- Verify the signature before sending an alert. See Verify signatures.
Client and incident details are sensitive. Check where an alert is posted and who can read it.
Was this page helpful?