Skip to content
Changelog

Report a bug

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().

SourceEntry stage input
RecurringRecurringEvent
Integration or event source with a schemaz.output<typeof schema>
Integration or event source without a schemaThe 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.

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.

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
}
  • id stays 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 in data. Parse them in the stage, or give a schema.

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:

SubscriptionEvent typeSchema that Type saves
events: ["message"] with a slack.message matcherSlackMessageEvent, with a required data.tsslackMessageEventSchema, with data.ts required
The same, with "message_deleted" in the matcher’s subtypesSlackMessageEventslackMessageEventSchema
events: ["app_mention"] with a slack.app_mention matcherSlackAppMentionEventslackAppMentionEventSchema
events: ["reaction_added"] with a slack.reaction_added matcherSlackReactionAddedEventslackReactionAddedEventSchema
events: ["reaction_removed"] with a slack.reaction_removed matcherSlackReactionRemovedEventslackReactionRemovedEventSchema
Anything elseIntegrationEvent, with type set to one of eventsOne 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 message subscription without a slack.message matcher gets the plain IntegrationEvent envelope, so an entry stage with input: slackMessageEventSchema fails the typecheck. Set schema: slackMessageEventSchema in that case.
  • See Event schema for the rules of your own schema.
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.

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
};
};
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 use the Slack connection. Type receives them for you.

EventStarts when
messageSomeone posts, edits, or deletes a message in a channel that the Type app is in.
app_mentionSomeone mentions the Type app.
reaction_addedSomeone adds an emoji reaction.
reaction_removedSomeone removes an emoji reaction.
app_home_openedSomeone opens the Type app’s Home tab.
Envelope fieldValue
typeThe Slack event type.
idSlack’s event_id.
resourceType"channel" when the event has a channel, otherwise null.
resourceIdThe channel ID. For reactions, the channel of the message. Otherwise null.
dataThe 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 replyInSlackThread to reply to a message or a mention.

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 nameExamplesresourceType / resourceIdFields in data
github.pull_request.<action>github.pull_request.opened, github.pull_request.closedpull_request / PR numbertitle, url, state, merged, body, draft, baseBranch, headBranch, author
github.push—commit / the new commit SHAref, branch, commits, pusher
github.create.branch, github.create.tag—branch or tag / the refref, refType
github.delete.branch, github.delete.tag—branch or tag / the refref, refType
github.issues.<action>github.issues.openedissue / issue numbertitle, body, url, state, author
github.issue_comment.<action>github.issue_comment.createdpr_comment on a pull request, otherwise issue_comment / comment IDisPullRequest, issueNumber, prNumber, commentBody, url, author
github.pull_request_review.<action>github.pull_request_review.submittedpr_review / review IDprNumber, state, body, author, url
github.pull_request_review_comment.<action>github.pull_request_review_comment.createdpr_comment / comment IDprNumber, commentBody, author, url, path
github.release.<action>github.release.publishedrelease / release IDtagName, name, url, draft, prerelease
github.workflow_run.<action>github.workflow_run.completedworkflow_run / run IDname, branch, status, conclusion, headSha, url
github.check_run.<action>github.check_run.completedcheck_run / run IDname, branch, status, conclusion, headSha, url
github.check_suite.<action>github.check_suite.completedcheck_suite / suite IDname, branch, status, conclusion, headSha, url
github.status—commit / the SHAstate, context, description, url
  • All GitHub events also have repositoryFullName, repositoryId, and sender in data when GitHub sends them.
  • resourceId is a string, also for numbers such as a PR number.
  • id is GitHub’s delivery ID.
  • <action> is GitHub’s action value, for example opened, closed, created, or completed. 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_comment event. An inline comment on a diff is a pull_request_review_comment event.
  • Type does not send these GitHub events to automations: deployment, deployment_status, pull_request_review_thread, label, and member.
  • 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 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
issueissue
commentcomment
projectproject
project_updateproject_update
cyclecycle
reactionreaction
labellabel
  • Issue label events arrive as linear.label.<action>. Only linear.* selects them. A deploy does not accept linear.label.<action> as an event name.
  • <action> is Linear’s action value, for example create, update, or remove.
  • resourceId is the ID of the Linear object. data has the fields that Type keeps from the object.
  • id is the webhook-id header, or the event_id, delivery_id, or id field 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.

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.

An event source sends one kind of event:

SourcetyperesourceType / resourceIdiddata
Custom webhook URLwebhook.receivedwebhook / the webhook IDThe delivery ID. See The event.The JSON body of a POST, or the query parameters of a GET
RSS feedrss.entry.receivedrss_entry / the entry GUIDThe entry GUID{ feedTitle, feedUrl, item: { guid, title, description, link, pubDate, author } }
Email inboxagentmail.message.receivedemail_message / the message IDThe message ID{ inboxId, threadId, from, to, subject, text, html, timestamp }

Event sources have no built-in matchers and no resource filters.

The resources field of an integration source filters events by resourceType and resourceId. The behavior is different for each kind of source.

SourceBehavior
SlackThe only key is channel. An event with no channel, or with a channel that is not in the list, is skipped.
GitHubAllowed 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.
LinearNot supported. The deploy fails if resources has a key.
Custom webhookIf 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.
  • Type saves each verified event before it starts work.
  • A provider retry with the same id does 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.