Choosing a Trigger
A webhook follows one trigger of its module and fires exactly when that trigger fires: on the same saves that run the trigger's workflows. Triggers are listed in Setup > Automation > Triggers, and every module has a set of system triggers (Create, Edit, Delete, Add Comment ...). You can add your own.
In the API, and in every event, a trigger is identified by its link name: a short, fixed ID such as create, edit or addcomment.
Common Triggers
Most modules have these system triggers:
| Trigger | Link name | Fires when | event sent |
|---|---|---|---|
| Create | create | A record is created | <module>.created |
| Edit | edit | A record is changed (status changes included) | <module>.updated |
| Create Or Edit | createoredit | Either of the above | <module>.created or <module>.updated |
| Delete | delete | A record is deleted | <module>.deleted |
| Add Comment | addcomment | A comment is added or edited | <module>.add_ticket_note |
| Comment Deleted | commentdeleted | A comment is deleted | <module>.comment_deleted |
| Add Attachment | addattachment | A file is attached | <module>.add_ticket_attachments |
| Attachment Deleted | attachmentdeleted | An attached file is deleted | <module>.attachment_deleted |
<module> is the module's API name, for example workorder.created, invoice.created, serviceRequest.add_ticket_note.
Modules have more triggers of their own. Work orders, for example, also have:
| Trigger | Link name | event sent |
|---|---|---|
| Close | close | workorder.close_work_order |
| Assign | assign | workorder.assign_ticket |
| Resolve | resolve | workorder.solve_work_order |
| On Hold | onhold | workorder.hold_work_order |
| Add Comment With Notify Requester | addcommentwithnotifyrequester | workorder.add_note_requester |
| Comment Visibility Changed | commentvisibilitychanged | workorder.comment_visibility_changed |
| Add Items, Add Labour, Add Service ... | addwoitems, addwolabour, addwoservice ... | workorder.add_wo_items ... |
Service requests also have email conversation triggers (oncustomerreply, onagentreply ...). The exact list for your organization is always available from the API (below) and in the Trigger list of the webhook form.
Finding a Trigger's Link Name
Ask the webhook API for the triggers a webhook can follow on a module:
curl "https://us.facilioapis.com/maintenance/api/v5/platform/webhook/invoice/triggers" \
-H "x-api-key: <your API key>"
{
"data": [
{ "linkName": "create", "name": "Create", "eventType": "create", "status": "active" },
{ "linkName": "edit", "name": "Edit", "eventType": "edit", "status": "active" },
{ "linkName": "createoredit", "name": "Create Or Edit", "eventType": "multi_trigger", "status": "active" },
{ "linkName": "addcomment", "name": "Add Comment", "eventType": "add_ticket_note", "status": "active" },
{ "linkName": "addattachment", "name": "Add Attachment", "eventType": "add_ticket_attachments", "status": "active" },
{ "linkName": "commentdeleted", "name": "Comment Deleted", "eventType": "comment_deleted", "status": "active" },
{ "linkName": "attachmentdeleted", "name": "Attachment Deleted", "eventType": "attachment_deleted", "status": "active" }
],
"success": true
}
name is what Setup shows; linkName is what you put in the webhook's trigger. A trigger with "status": "disabled" is switched off in Setup > Automation > Triggers: a webhook may follow it, but nothing is sent until the trigger is switched on. Change the host for your region (see Base URL).
Every event names the trigger that fired in trigger.linkName, so one receiver can serve several webhooks and tell their events apart.
Custom Triggers
When no system trigger fits, create one and point the webhook at it. Custom triggers get a link name of their own, which ends in __C (for example fieldchangepriority__C).
Field change triggers are the most useful: they fire only when one of the fields you choose changes. For example, a webhook that tells a contractor's system when a work order's priority or assignee changes, and stays quiet for every other edit.
- In Setup: Setup > Automation > Triggers (or Create a trigger in the webhook form). Choose the module, the event (for example Field Change) and the fields.
- With the API:
curl -X POST "https://us.facilioapis.com/maintenance/api/v5/platform/trigger/workorder" \
-H "x-api-key: <your API key>" -H "Content-Type: application/json" \
-d '{"data": {"name": "Priority or assignee changed", "eventType": "field_change", "fields": ["priority", "assignedTo"]}}'eventTypeis one ofcreated,updated,created_or_updatedorfield_change;fieldsare field API names. Then read the new trigger's link name fromGET /platform/webhook/{module}/triggers.
What a custom trigger sends:
| Custom trigger | event sent |
|---|---|
| Field change | <module>.updated, or <module>.created when the field was set while creating the record |
| Created, Updated, Created or Updated | As the system triggers above |
| A trigger your workflows or scripts invoke | <module>.custom_trigger |
What a Trigger Does Not Cover
- Scheduled triggers (for example "3 days before the due date") cannot be followed by a webhook: they run only through workflows. The API refuses them, and the Setup form does not list them.
- A webhook fires exactly when its trigger fires, so it misses the same saves triggers miss: changes made by processes that skip automation, such as some data imports.
- If Facilio moves a record to a new status by itself as a result of another change (for example to Assigned when someone is assigned), no separate event is sent for that automatic move. The receiver gets the Edit event of the save that caused it, and its
dataalready shows the new status.