A custom function is executed as a step in a workflow

Facts

Works with

Events API
Custom functions for Bolt are in beta and under active development.

This event notifies you when a custom function is executed as a step in a workflow.

{
  type: 'function_executed',
  function: {
    id: 'Fn123456789O',
    callback_id: 'sample_function',
    title: 'Sample function',
    description: 'Runs sample function',
    type: 'app',
    input_parameters: [
      {
        type: 'slack#/types/user_id',
        name: 'user_id',
        description: 'Message recipient',
        title: 'User',
        is_required: true
      }
    ],
    output_parameters: [
      {
        type: 'slack#/types/user_id',
        name: 'user_id',
        description: 'User that completed the function',
        title: 'Greeting',
        is_required: true
      }
    ],
    app_id: 'AP123456789',
    date_created: 1694727597,
    date_updated: 1698947481,
    date_deleted: 0
  },
  inputs: { user_id: 'USER12345678' },
  function_execution_id: 'Fx1234567O9L',
  workflow_execution_id: 'WxABC123DEF0',
  event_ts: '1698958075.998738',
  bot_access_token: 'abcd-1325532282098-1322446258629-6123648410839-527a1cab3979cad288c9e20330d212cf'
}

Usage info

The function_executed event is a unique event in that you cannot subscribe to it like other events associated with the Events API. Instead, your app must have a function declared that is executed as part of a workflow invoked by a trigger. These events are generated exclusively in the context of a workflow run.

In order for this event to execute, the following must be true about the app:

  • It is subscribed to the Events API
  • It has a function defined that is part of a coded workflow or a step in Workflow Builder. For apps built with the Bolt SDK, read about custom functions here. For apps built with the Deno SDK, read about custom functions here.
  • It has a trigger that invokes the workflow

When an event occurs, we will send an HTTP POST request to your Request URL. The outer payload is uniform across all Events API methods, and contains fields like team_id and event. Learn more