Triggers
List triggers
Lists the triggers of the organization: the rules that send a message when an event arrives or a contact stays silent. Filter to find one before you change it. Read only. It is safe to repeat.
Required scope: triggers:read.
query Parameters
limitcursorThe nextCursor of the previous page, with the same filters.
contactEventOnly the triggers of this fact.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
List triggers › Responses
objecthasMorenextCursorCreate a trigger
When you report a contact event with this name, the template goes out with the variables taken from the event. variables must cover every variable of the template. Add onEvent to open or move the contact case the moment the event arrives, without waiting for a reply. Leave templateId out and send only onEvent for a trigger that sends no message: when the event arrives it opens or moves the case of the contact and nothing goes out, so it costs nothing; a trigger with neither templateId nor onEvent is rejected because it would do nothing. Add cadence to repeat the template up to 5 times until the contact replies, opts out, or the case changes stage or closes. onEvent and cadence are for WhatsApp triggers only, and a trigger without a template has no variables, onReply, instructions, cooldownDays or cadence. Creating a trigger sends nothing, and send an Idempotency-Key to make a retry safe. Use dryRun=true to run the same checks (template, variables, onReply, onEvent, cadence) and get 200 with the trigger as it would be saved, without saving it; its id is not saved.
Required scope: triggers:write.
query Parameters
dryRunWhen true, the request goes through the same validation as the real one and is answered with what would happen (always 200), and nothing is saved, sent or charged. The answer has the same shape as the real one plus dryRun: true; an id in it is not saved. It does not use the Idempotency-Key.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Idempotency-KeyMakes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.
Create a trigger › Request Body
contactEventYour own name for the fact, as you send it in POST /v2/contact-events.
channelwhatsapp sends the template. email sends the text in email and opens a case the agent continues.
templateIdThe template to send. A whatsapp trigger needs either templateId or onEvent. Without templateId it sends no message and only acts on the case, so variables, onReply, instructions, cooldownDays and cadence do not apply.
Required for email.
Template (or email placeholder) variable to a path in the event: data.x or contact.name, contact.phone, contact.email, contact.externalRef. Any other text is used as is. Required when the trigger has a template or an email; leave it out when it has neither.
instructionsContext the agent gets if they answer. An event can replace it with onReply.instructions.
cooldownDaysDon't send twice to the same contact within this many days.
What happens to the contact case the moment the event arrives, without waiting for a reply. Send exactly one of openCase or moveCase. WhatsApp triggers only. With no templateId it is the whole trigger: the case is opened or moved and no message goes out.
Repeat the template up to attempts times, every intervalHours, until the contact replies, opts out, or the case changes stage or closes. WhatsApp triggers only. cooldownDays applies to the first attempt only.
Create a trigger › Responses
dryRun=true: the trigger as it would be saved.
objectidcontactEventchanneltemplateIdinstructionscooldownDaysstatuscreatedAtupdatedAtdryRunPresent and true when the request had dryRun=true.
Retrieve a trigger
Returns one trigger by id. Use it to refresh a single record you already know; to find records, use the list route. It includes its cadence. Read only. 404 not_found when the id does not exist or belongs to another organization. You can repeat it safely: it has no side effects.
Required scope: triggers:read.
path Parameters
id^trg_[0-9A-Za-z]{22}… · requiredThe id of the trigger (trg_…).
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Retrieve a trigger › Responses
objectidcontactEventchanneltemplateIdinstructionscooldownDaysstatuscreatedAtupdatedAtDelete a trigger
Deletes a trigger. Events that arrive afterwards no longer start it. To stop it for a while and keep it, disable it with the update route instead. The effect is permanent through the API. Repeating the call returns 404 not_found, because the trigger no longer exists, so do not retry a 404 as a failure.
Required scope: triggers:write.
path Parameters
id^trg_[0-9A-Za-z]{22}… · requiredThe id of the trigger (trg_…).
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Delete a trigger › Responses
Update a trigger
Change any field. status paused stops it without deleting it, and it also ends the cadences already running. Send onEvent or cadence as null to remove them. A change to cadence applies to new events only: cadences already running keep the settings they started with. Use dryRun=true to run the same checks and get the trigger as it would be saved, without saving it.
Required scope: triggers:write.
path Parameters
id^trg_[0-9A-Za-z]{22}… · requiredThe id of the trigger (trg_…).
query Parameters
dryRunWhen true, the request goes through the same validation as the real one and is answered with what would happen (always 200), and nothing is saved, sent or charged. The answer has the same shape as the real one plus dryRun: true; an id in it is not saved. It does not use the Idempotency-Key.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Update a trigger › Request Body optional
contactEventtemplateIdEmail triggers only.
instructionscooldownDaysstatusUpdate a trigger › Responses
objectidcontactEventchanneltemplateIdinstructionscooldownDaysstatuscreatedAtupdatedAtdryRunPresent and true when the request had dryRun=true.
List the runs of a trigger
Lists the cadence runs of the trigger, newest first: the contact, how many attempts went out, when the next one goes and why it stopped. A trigger without cadence has none. Read only. 404 not_found when the trigger does not exist or belongs to another organization. It is safe to repeat.
Required scope: triggers:read.
path Parameters
id^trg_[0-9A-Za-z]{22}… · requiredThe id of the trigger (trg_…).
query Parameters
limitcursorThe nextCursor of the previous page, with the same filters.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
List the runs of a trigger › Responses
objecthasMorenextCursor