Events Reference
Type calls a subscription method with (ctx, event). This page describes event.
| Source | Event type in code |
|---|---|
| Recurring | RecurringEvent |
Slack message with a slack.message matcher and no schema | SlackMessageEvent |
Other integration events with no schema | IntegrationEvent |
Integration events with a schema | z.output<typeof schema> |
Any integration source with debounce.delivery: "batch" | An array of 1 to 100 of the events above |
RecurringEvent
Section titled “RecurringEvent”interface RecurringEvent { readonly scheduledAt: string; // ISO date-time}scheduledAt is the time from Type’s scheduler, not the time that the run started. Use it in effect keys, for example report:${event.scheduledAt}, so that a retry of the same tick uses the same key.
IntegrationEvent
Section titled “IntegrationEvent”Every integration event has this envelope:
interface IntegrationEvent<Data = unknown> { type: string; // one of source.events id: string; // the provider delivery ID resourceId: string | null; resourceType: string | null; data: Data; // the provider's fields}idstays the same when a provider sends the same event again. Type uses it to run each event one time for each subscription.- Provider fields are always under
data, not at the top level. - Without a
schema, Type does not check the fields indata. Parse them in your method, or give aschema.
SlackMessageEvent
Section titled “SlackMessageEvent”type SlackMessageEvent = { type: "message"; id: string; resourceId: string | null; // the channel ID resourceType: string | null; // "channel" data: { channel: string; ts: string; thread_ts?: string | null; user?: string | null; text?: string | null; subtype?: string | null; bot_id?: string | null; // other Slack fields are kept };};Type uses this shape when the subscription has events: ["message"], a slack.message matcher, and no schema. If the matcher selects the message_deleted subtype, data.ts can be missing and data.deleted_ts is present.
Slack events
Section titled “Slack events”Slack events use the Slack connection. Type receives them for you.
| Event | Starts when |
|---|---|
message | Someone posts, edits, or deletes a message in a channel that the Type app is in. |
app_mention | Someone mentions the Type app. |
reaction_added | Someone adds an emoji reaction. |
reaction_removed | Someone removes an emoji reaction. |
app_home_opened | Someone opens the Type app’s Home tab. |
| Envelope field | Value |
|---|---|
type | The Slack event type. |
id | Slack’s event_id. |
resourceType | "channel" when the event has a channel, otherwise null. |
resourceId | The channel ID. For reactions, the channel of the message. Otherwise null. |
data | The Slack event object, unchanged. |
- The Type Slack app must be in the channel, and the app must be subscribed to the event.
- Use the
slack.messagematcher to filter text before your code runs. - Use
replyInSlackThreadto reply.
GitHub events
Section titled “GitHub events”GitHub events use the GitHub connection. Type receives them for you. Event names have the form github.<event>.<action>.
| Event name | Examples | resourceType / resourceId | Fields in data |
|---|---|---|---|
github.pull_request.<action> | github.pull_request.opened, github.pull_request.closed | pull_request / PR number | title, url, state, merged, body, draft, baseBranch, headBranch, author |
github.push | — | commit / the new commit SHA | ref, branch, commits, pusher |
github.create.branch, github.create.tag | — | branch or tag / the ref | ref, refType |
github.delete.branch, github.delete.tag | — | branch or tag / the ref | ref, refType |
github.issues.<action> | github.issues.opened | issue / issue number | title, body, url, state, author |
github.issue_comment.<action> | github.issue_comment.created | pr_comment on a pull request, otherwise issue_comment / comment ID | isPullRequest, issueNumber, prNumber, commentBody, url, author |
github.pull_request_review.<action> | github.pull_request_review.submitted | pr_review / review ID | prNumber, state, body, author, url |
github.pull_request_review_comment.<action> | github.pull_request_review_comment.created | pr_comment / comment ID | prNumber, commentBody, author, url, path |
github.release.<action> | github.release.published | release / release ID | tagName, name, url, draft, prerelease |
github.workflow_run.<action> | github.workflow_run.completed | workflow_run / run ID | name, branch, status, conclusion, headSha, url |
github.check_run.<action> | github.check_run.completed | check_run / run ID | name, branch, status, conclusion, headSha, url |
github.check_suite.<action> | github.check_suite.completed | check_suite / suite ID | name, branch, status, conclusion, headSha, url |
github.status | — | commit / the SHA | state, context, description, url |
- All GitHub events also have
repositoryFullName,repositoryId, andsenderindatawhen GitHub sends them. idis GitHub’s delivery ID.<action>is GitHub’sactionvalue, for exampleopened,closed,created, orcompleted. Type does not check it against a list. Use the names in GitHub’s webhook documentation.- A general comment on a pull request is an
issue_commentevent. An inline comment on a diff is apull_request_review_commentevent. - Type does not send these GitHub events to automations:
deployment,deployment_status,pull_request_review_thread,label, andmember. - The GitHub App of the connection must have the permission and the event subscription for each event. Saving an automation does not change the GitHub App settings.
Use the GitHub matchers to filter by repository, branch, action, and more.
Custom webhook events
Section titled “Custom webhook events”A webhook adapter makes these events. The adapter sets type, id, resourceType, resourceId, and data. The subscription events must be a subset of the events that the adapter declares.
Resource filters
Section titled “Resource filters”The resources field of a source filters events by resourceType and resourceId. The behavior is different for each kind of source.
| Source | Behavior |
|---|---|
| Slack | The only key is channel. An event with no channel, or with a channel that is not in the list, is skipped. |
| GitHub | Allowed keys: pull_request, commit, branch, tag, issue, release, issue_comment, pr_comment, pr_review, workflow_run, check_run, check_suite, github_event. A filter applies only to events with the same resourceType. Events with a different resourceType pass. |
| Custom webhook | If resources has keys, the event must have a resourceType that is a key, and its resourceId must be in the list. Other events are skipped. |
Delivery guarantees
Section titled “Delivery guarantees”- Type saves each verified event before it starts work.
- A provider retry with the same
iddoes not start a second run for the same subscription. - Type does not promise the order of runs. With
debounce.delivery: "latest", Type uses the order in which it received the events. - Events that come while an automation is paused are not saved for it. Resume does not replay them.
- Events that Type saved before the pause, for example events in a debounce group, wait. They run after you resume, if the current code still subscribes to their event type.
- A subscription that you add later does not get older events.
- A provider event can come late or not at all. If your workflow cannot miss an item, add a recurring check that reads the source.