Events Reference
The entry stage of a subscription gets the event as its input. This page describes those events. Later stages get the input that the stage before them passes with next().
| Source | Entry stage input |
|---|---|
| Recurring | RecurringEvent |
Integration or event source with a schema | z.output<typeof schema> |
Integration or event source without a schema | The default contract of the subscription |
Any integration or event source with debounce.delivery: "batch" | An array of 1 to 100 of the events above, in the order that Type received them |
The entry stage’s input schema must accept this event. The typecheck checks it when you deploy. Use the same schema for the subscription’s schema and the entry stage’s input.
RecurringEvent
Section titled “RecurringEvent”interface RecurringEvent { readonly scheduledAt: string; // ISO date-time}Use recurringEventSchema as the entry stage’s input. scheduledAt is the time from Type’s scheduler, not the time that the run started. Use it in effect keys, for example report:${input.scheduledAt}, so that a retry of the same tick uses the same key.
IntegrationEvent
Section titled “IntegrationEvent”Every integration event and event source event has this envelope:
interface IntegrationEvent<Data = unknown> { type: string; // one of source.events id: string; // the 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 the stage, or give aschema.
Default contracts
Section titled “Default contracts”If a subscription has no schema, Type picks its contract from source.events and match. The typecheck uses the event type, and Type saves the schema to check each event:
| Subscription | Event type | Schema that Type saves |
|---|---|---|
events: ["message"] with a slack.message matcher | SlackMessageEvent, with a required data.ts | slackMessageEventSchema, with data.ts required |
The same, with "message_deleted" in the matcher’s subtypes | SlackMessageEvent | slackMessageEventSchema |
events: ["app_mention"] with a slack.app_mention matcher | SlackAppMentionEvent | slackAppMentionEventSchema |
events: ["reaction_added"] with a slack.reaction_added matcher | SlackReactionAddedEvent | slackReactionAddedEventSchema |
events: ["reaction_removed"] with a slack.reaction_removed matcher | SlackReactionRemovedEvent | slackReactionRemovedEventSchema |
| Anything else | IntegrationEvent, with type set to one of events | One envelope for each event. data is not checked. |
- Use the matcher keys in this table. Other forms of the Slack matchers can give a different contract.
- A Slack
messagesubscription without aslack.messagematcher gets the plainIntegrationEventenvelope, so an entry stage withinput: slackMessageEventSchemafails the typecheck. Setschema: slackMessageEventSchemain that case. - See Event schema for the rules of your own schema.
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; // can be missing when subtype is "message_deleted" thread_ts?: string | null; user?: string | null; text?: string | null; subtype?: string | null; bot_id?: string | null; deleted_ts?: string; // set when subtype is "message_deleted" // other Slack fields are kept };};If the matcher selects the message_deleted subtype, data.ts can be missing and data.deleted_ts is present. Otherwise the default contract requires data.ts.
SlackAppMentionEvent
Section titled “SlackAppMentionEvent”type SlackAppMentionEvent = { type: "app_mention"; 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 };};Slack reaction events
Section titled “Slack reaction events”type SlackReactionAddedEvent = { type: "reaction_added"; // "reaction_removed" in SlackReactionRemovedEvent id: string; resourceId: string | null; // the channel of the message resourceType: string | null; // "channel" data: { user: string; // who reacted reaction: string; // the emoji name, without colons item_user?: string | null; // the author of the message event_ts?: string; item: { type: string; channel?: string; ts?: string }; // other Slack fields are kept };};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. |
- Slack event names must match exactly. Slack has no wildcard.
- The Type Slack app must be in the channel, and the app must be subscribed to the event.
- Use the Slack matchers to filter events before your code runs.
- Use
replyInSlackThreadto reply to a message or a mention.
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>. github.* selects every GitHub event that Type receives.
| 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. resourceIdis a string, also for numbers such as a PR number.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.
Linear events
Section titled “Linear events”Linear events use the Linear connection. Type receives them for you. Event names have the form linear.<type>.<action>, for example linear.issue.create or linear.comment.update. linear.* selects every Linear event that Type receives.
<type> | resourceType |
|---|---|
issue | issue |
comment | comment |
project | project |
project_update | project_update |
cycle | cycle |
reaction | reaction |
label | label |
- Issue label events arrive as
linear.label.<action>. Onlylinear.*selects them. A deploy does not acceptlinear.label.<action>as an event name. <action>is Linear’sactionvalue, for examplecreate,update, orremove.resourceIdis the ID of the Linear object.datahas the fields that Type keeps from the object.idis thewebhook-idheader, or theevent_id,delivery_id, oridfield of the body. Without these, it is a hash of the request body.- There are no built-in Linear matchers and no Linear resource filters. Filter in the entry stage.
- See Linear.
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.
Event source events
Section titled “Event source events”An event source sends one kind of event:
| Source | type | resourceType / resourceId | id | data |
|---|---|---|---|---|
| Custom webhook URL | webhook.received | webhook / the webhook ID | The delivery ID. See The event. | The JSON body of a POST, or the query parameters of a GET |
| RSS feed | rss.entry.received | rss_entry / the entry GUID | The entry GUID | { feedTitle, feedUrl, item: { guid, title, description, link, pubDate, author } } |
| Email inbox | agentmail.message.received | email_message / the message ID | The message ID | { inboxId, threadId, from, to, subject, text, html, timestamp } |
Event sources have no built-in matchers and no resource filters.
Resource filters
Section titled “Resource filters”The resources field of an integration 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. |
| Linear | Not supported. The deploy fails if resources has a key. |
| 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, also after you deploy new code. - Type runs one code stage at a time for each automation. Other events wait in a queue. Type does not promise that runs start in the order that the provider sent 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.