Skip to main content

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:

TriggerLink nameFires whenevent sent
CreatecreateA record is created<module>.created
EditeditA record is changed (status changes included)<module>.updated
Create Or EditcreateoreditEither of the above<module>.created or <module>.updated
DeletedeleteA record is deleted<module>.deleted
Add CommentaddcommentA comment is added or edited<module>.add_ticket_note
Comment DeletedcommentdeletedA comment is deleted<module>.comment_deleted
Add AttachmentaddattachmentA file is attached<module>.add_ticket_attachments
Attachment DeletedattachmentdeletedAn 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:

TriggerLink nameevent sent
Closecloseworkorder.close_work_order
Assignassignworkorder.assign_ticket
Resolveresolveworkorder.solve_work_order
On Holdonholdworkorder.hold_work_order
Add Comment With Notify Requesteraddcommentwithnotifyrequesterworkorder.add_note_requester
Comment Visibility Changedcommentvisibilitychangedworkorder.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.

Note:Comment and attachment triggers send the comment or file itself, not the record: see Comment and Attachment Events. Comment Deleted, Add Attachment and Attachment Deleted exist on work orders, service requests, quotes, purchase orders, invoices and custom modules.

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"]}}'
    eventType is one of created, updated, created_or_updated or field_change; fields are field API names. Then read the new trigger's link name from GET /platform/webhook/{module}/triggers.

What a custom trigger sends:

Custom triggerevent sent
Field change<module>.updated, or <module>.created when the field was set while creating the record
Created, Updated, Created or UpdatedAs 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 data already shows the new status.