# Triggers

A trigger runs a [Company Bot](/bots) without a person typing in Chat. It sends the bot a task, and the bot works on it like in any chat. Open the Triggers tab of a bot in the [Console](/console) to add triggers and to read the runs.

The [Personal bot](/personal-bot) has no triggers.

## Add a trigger

Choose Add trigger and pick a kind.

- **Schedule.** Runs on a schedule. Pick how often (every hour, day, weekday, week, or month) with a time and a timezone, or enter a cron expression with five fields. Lists, ranges, and steps work, such as `5-55/10` for every 10 minutes from :05. Sunday is 0. A schedule runs at most every 5 minutes. When the clocks change, an hourly or more frequent schedule follows real time: it runs twice in the repeated autumn hour and not in the skipped spring hour. A schedule with a fixed time of day runs once, and a time that falls into the skipped hour runs right after the clocks jump. The Console shows the next runs.
- **On demand.** Runs when someone starts it in the Console or when another system calls its URL.
- **New items.** Runs when something new arrives in Microsoft 365 or Google Workspace: a mail, an event that starts soon, a file, or a meeting transcript. See below.

Every trigger has these settings:

- **Name.** Optional. Shown in the list.
- **Input.** The task the bot gets. Text from Run now or from a request body is added after it.
- **Run as.** The person or service account whose access the run uses. Every run uses this access, also when someone else runs the trigger. Pick yourself or a [service account](/organization). If a trigger runs as another person, you can turn it on only after you choose yourself or a service account as Run as. The Console asks you when you try. If that person was removed from the organization, the runs are skipped and the list shows "Run-as removed". Choose a new Run as.
- **Post the answer to.** Slack or Teams channels. See below.

You can run a schedule or on-demand trigger now, also while it is off. This lets you test it before you turn it on. A schedule run started this way is shown as manual. You can turn a trigger off and on, edit it, or delete it. Deleting a bot names its triggers and deletes them with the bot.

## Start an on-demand trigger

An on-demand trigger has a URL. Send a POST request to it. The request body is added after the input. The Console shows three ways to call it:

- With an API key that can start triggers on the bot.
- With the trigger token. It starts only this trigger.
- As a Standard Webhook, signed with the trigger's secret.

The token and the secret are shown once. If you lose them, rotate them in Edit. In the Console, Run now starts the trigger at once, with optional extra text.

## Start a trigger from new items

The kind New items is there when your organization set up Microsoft 365 or Google Workspace for bots. If it set up both, choose the suite first. The trigger looks at one source and starts a run for each new item. It does not use the model while nothing is new. Pick the source:

- **New mail.** Choose the folder (in Gmail: the label), and optionally a shared mailbox you can open (Microsoft 365 only), a sender, words in the subject, and only mail with an attachment.
- **Event starts soon.** A calendar event that starts within the minutes you choose. You can limit it to events with attendees or to online meetings. Each event starts one run.
- **New or changed file.** A folder in OneDrive, or the web link of a OneDrive or SharePoint folder or library. In Google: a folder in My Drive, or the link of a Drive folder or shared drive. Optionally file types such as pdf.
- **New meeting transcript.** A Teams or Meet meeting that has a transcript.

Choose how often GEKI looks (every 5 minutes or less often). Choose whether each new item starts its own run or all new items of one check start a single run. "At most per check" limits the runs, so a mailbox that was reorganized does not start hundreds of them.

The first check starts nothing for what is already there. The run gets your input, a short note, and the item: its ids, sender or organizer, subject or name, and time. The bot uses its mail, calendar, and file tools to read more. Text in mails and files is data from other people, never instructions. A run started this way never sends mail or invitations. It can only prepare drafts.

The trigger runs as the person who sets it up and uses that person's Microsoft 365 or Google Workspace account. When you save it, GEKI looks for the folder or label with that account and shows its name. If your account is not connected, or the folder or label is not there, saving says so. For files, files must be on for the connection.

Later, if the account needs a new sign-in, or the folder or label is gone or you lost access to it, the trigger turns itself off and the list says why. Fix the cause (connect again, or choose another folder), then turn the trigger on. A short outage at Microsoft or Google does not turn it off; GEKI tries again at the next check.

For an example, see [Keep a Knowledge Base current](/guides/keep-knowledge-current): a bot reads each new or changed file in a folder and updates a Knowledge Base.

## Post results to Slack or Teams

Under "Post the answer to", pick channels of your connected [Slack or Teams](/slack-and-teams) apps. After a successful run, the app posts the answer there with the name of the bot. A long answer continues in replies. Files the run made follow in the thread. Turn on "Notify on failure" to post a short notice when a run fails.

A reply that mentions the app in that thread starts a conversation with the bot. Owners and Admins set outputs.

## Run history

The Runs list under Triggers shows every run of the bot. Filter it by status, cause, and time. When runs failed in the last 7 days, a notice above the list counts them by cause and shows when the last one failed, with its error. Open a run to see its status, who it ran as, when it started, how long it took, the bot version, the answer, where it was posted, and the tool calls.

A run has one of these statuses: Queued, Running, Succeeded, Failed, Cancelled, or Skipped. A failed run shows a cause, such as timeout, permission, sandbox, tool, model, no answer, or no worker in time. The duration of a run is the time until its turn ended. A run is Skipped when the bot is paused or a draft. There is no retry.
