MohziDocsGuideOpen Mohzi
All pages

Triggers

Tasks that start when new mail arrives or when another system calls them.

A task can start when something happens instead of at a time. There are two triggers: new mail, and a call to the task's address (a webhook).

When new mail arrives

Tell a bot: "When an email comes from acme.com, pull out the quote request and summarize it for me." You'll need a mailbox added under the Email app first.

When another system calls

Tell a bot: "Give me an address our ERP can call when there's a new order, and check each order against the price list." The bot replies with an address like:

https://app.mohzisi.com/api/hooks/task/k3Jq…   (32-character secret)

Anything that can make an HTTP POST can call it: an ERP, a form tool, a CI pipeline, GitHub.

curl -X POST https://app.mohzisi.com/api/hooks/task/<secret> \
  -H 'Content-Type: application/json' \
  -d '{"order": "SO-1042", "customer": "Acme", "total": 1640}'

The body can be JSON or plain text. The task starts at once with what was sent; calls that arrive while it's running are handled next, ten at a time.

ResponseMeaning
202Accepted. The task will run with it.
404No task has this address. It may have been deleted.
409The task is paused.
413The body is larger than 20 KB.
429More than 60 calls in the last hour, or 30 calls already waiting.

The secret in the address is the only credential. Give it only to the system that needs it. To get a new address, delete the task and set it up again.

What a triggered task may do

Mail and webhook bodies are written by someone else, and may contain instructions meant to trick a bot. So a task started by a trigger is restricted, whatever you've allowed elsewhere:

If the task needs to do something it isn't allowed to, it says so in its result and you can do it from the conversation.