diff --git a/src/helpers.ts b/src/helpers.ts index 81c1786e2..bb3ae1346 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -50,7 +50,7 @@ export function getTypeAndConversation(body: any): { type?: IncomingEventType, c conversationId: optionsBody.channel !== undefined ? optionsBody.channel.id : undefined, }; } - if (body.actions !== undefined || body.type === 'dialog_submission') { + if (body.actions !== undefined || body.type === 'dialog_submission' || body.type === 'workflow_step_edit') { const actionBody = (body as SlackActionMiddlewareArgs['body']); return { type: IncomingEventType.Action, diff --git a/src/types/actions/index.ts b/src/types/actions/index.ts index 18dd3c71f..90f6bff83 100644 --- a/src/types/actions/index.ts +++ b/src/types/actions/index.ts @@ -4,6 +4,7 @@ export * from './dialog-action'; import { BlockAction } from './block-action'; import { InteractiveMessage } from './interactive-message'; +import { WorkflowStepEdit } from './workflow-step-edit'; import { DialogSubmitAction, DialogValidation } from './dialog-action'; import { SayFn, SayArguments, RespondFn, AckFn } from '../utilities'; @@ -21,7 +22,7 @@ import { SayFn, SayArguments, RespondFn, AckFn } from '../utilities'; * offered when no generic parameter is bound would be limited to BasicElementAction rather than the union of known * actions - ElementAction. */ -export type SlackAction = BlockAction | InteractiveMessage | DialogSubmitAction; +export type SlackAction = BlockAction | InteractiveMessage | DialogSubmitAction | WorkflowStepEdit; /** * Arguments which listeners and middleware receive to process an action from Slack's Block Kit interactive components, @@ -40,7 +41,7 @@ export interface SlackActionMiddlewareArgs ? SayFn : never; + say: Action extends Exclude ? SayFn : never; respond: RespondFn; ack: ActionAckFn; } diff --git a/src/types/actions/workflow-step-edit.ts b/src/types/actions/workflow-step-edit.ts new file mode 100644 index 000000000..5d0ed8b84 --- /dev/null +++ b/src/types/actions/workflow-step-edit.ts @@ -0,0 +1,33 @@ +/** + * A Slack workflow step action wrapped in the standard metadata. + * + * This describes the entire JSON-encoded body of a request from Slack workflow step actions. + */ +export interface WorkflowStepEdit { + type: 'workflow_step_edit'; + callback_id: string; + trigger_id: string; + user: { + id: string; + username: string; + team_id?: string; // undocumented + }; + team: { + id: string; + domain: string; + enterprise_id?: string; // undocumented + enterprise_name?: string; // undocumented + }; + channel?: { + id?: string; + name?: string; + }; + token: string; + action_ts: string; // undocumented + workflow_step: { + workflow_id: string; + step_id: string; + inputs: object; + outputs: []; + }; +} diff --git a/src/types/events/base-events.ts b/src/types/events/base-events.ts index fdadc54be..7b0a5bfda 100644 --- a/src/types/events/base-events.ts +++ b/src/types/events/base-events.ts @@ -66,7 +66,8 @@ export type SlackEvent = | TeamJoinEvent | TeamRenameEvent | TokensRevokedEvent - | UserChangeEvent; + | UserChangeEvent + | WorkflowStepExecuteEvent; /** * Any event in Slack's Events API @@ -736,5 +737,23 @@ export interface UserChangeEvent extends StringIndexed { }; } +export interface WorkflowStepExecuteEvent extends StringIndexed { + type: 'workflow_step_execute'; + callback_id: string; + workflow_step: { + workflow_step_execute_id: string; + workflow_id: string; + workflow_instance_id: string; + step_id: string; + inputs: object; + outputs: { + name: string; + type: string; + label: string; + }[]; + }; + event_ts: string; +} + // NOTE: `user_resourced_denied`, `user_resource_granted`, `user_resourced_removed` are left out because they are // deprecated as part of the Workspace Apps Developer Preview