Skip to main content

Slack integration

Run Apify Actors, get notified about run status, and receive scraped results straight in Slack - without leaving the app or opening a browser.

For a step-by-step walkthrough, see the Apify integration for Slack tutorial.

Get started

To use the Apify integration for Slack, you need:

Step 1: Set up the integration for Slack

You can find all integrations on an Actor's or task's Integrations tab. For example, you can try using Google Shopping Scraper.

Find the integration for Slack, then click the Configure button. Log in with your Slack account when prompted, then select your workspace in the Settings > API & Integrations window.

Apify Integrations tab listing available integration options with Configure buttons next to each

Head back to your task to finish the setup. Select the events you want to receive notifications for (run created, run succeeded, run failed, and so on), your workspace, and the channel for the notifications. You can use an ad-hoc channel to test. In the Message field, preview the default notification or craft a custom one. See Custom message format for the template syntax and the full list of available variables.

Slack integration setup form with event type selection, workspace, channel, and Message template fields

Click the Save button.

Step 2: Give the Apify integration a trial run

Click the Start button and head to the Slack channel you selected to see your first Apify integration notifications.

Step 3: Start your run directly from Slack

You can now run the same Actor or task directly from Slack by typing /apify call [Actor or task ID] into the Slack message box.

Slack message field showing the /apify call command with an Actor or task ID

When an Actor doesn't require you to fill in any input fields, you can run it by typing /apify call [Actor or task ID].

You're all set! If you have questions or need help, reach out on the Apify Discord channel.

Custom message format

The Message field on the Slack integration setup screen accepts a Handlebars template. When the integration fires, Apify renders the template with data from the triggering event and posts the result to the configured channel.

The Slack integration uses Handlebars, so all built-in helpers ({{#if}}, {{#each}}, {{#unless}}, and so on) work in your template. Webhook actions use a separate JSON payload template engine; don't mix the two.

A few rules apply to every template:

  • The template must be between 2 and 4000 characters long.
  • The text supports Slack's mrkdwn syntax, which uses single-asterisk bold (*bold*) and <url|label> for links rather than the standard Markdown [label](url).
  • Apify automatically appends a "Sent by Apify" attribution line that links to apify.com, so you don't need to add one yourself.
  • TEST events ignore the template and post a fixed test message. Use them to verify channel delivery.
  • An empty template falls back to Apify's built-in run-status preset.

Template variables

The following variables are available in every template. Reference nested fields with dot notation (for example, {{resource.id}}).

VariableTypeDescription
userIdstringID of the Apify user who owns the integration.
eventTypestringType of the trigger event. See Webhook events for the full list.
createdAtstringISO 8601 timestamp of when the event was dispatched.
eventDataobjectIdentifiers of the entities involved in the event.
resourceobjectFull snapshot of the triggering resource (an Actor run or an Actor build).

Event data

The eventData object identifies the entities involved in the trigger event.

PathTypeWhen present
eventData.actorIdstringAlways.
eventData.actorTaskIdstring | nullWhen the run was started from a task.
eventData.actorRunIdstringOn ACTOR.RUN.* events.
eventData.actorBuildIdstringOn ACTOR.BUILD.* events.

Resource (Actor run)

For ACTOR.RUN.* events, resource is the run document - the same object returned by the Get run API endpoint. Frequently used fields include:

PathTypeDescription
resource.idstringRun ID.
resource.actIdstringID of the Actor that produced the run.
resource.actorTaskIdstring | nullSource task, if the run was started from a task.
resource.userIdstringOwner of the run.
resource.statusstringCurrent status of the run. See Status values.
resource.statusMessagestringMost recent status message reported by the run.
resource.startedAtstringISO 8601 timestamp of when the run started.
resource.finishedAtstring | nullISO 8601 timestamp of when the run finished, or null while still running.
resource.exitCodenumberContainer exit code.
resource.buildIdstringID of the Actor build the run executed.
resource.buildNumberstringSemver build number.
resource.defaultDatasetIdstringDefault dataset attached to the run.
resource.defaultKeyValueStoreIdstringDefault key-value store attached to the run.
resource.defaultRequestQueueIdstringDefault request queue attached to the run.
resource.options.memoryMbytesnumberMemory allocated to the run, in megabytes.
resource.options.timeoutSecsnumberConfigured timeout, in seconds.
resource.stats.runTimeSecsnumberTotal runtime, in seconds.
resource.stats.computeUnitsnumberCompute units consumed by the run.
resource.meta.originstringWhat triggered the run, such as API, WEB, or SCHEDULER.

Resource (Actor build)

For ACTOR.BUILD.* events, resource is the build document - the same object returned by the Get build API endpoint. Frequently used fields include:

PathTypeDescription
resource.idstringBuild ID.
resource.actIdstringID of the Actor being built.
resource.statusstringCurrent status of the build. See Status values.
resource.startedAtstringISO 8601 timestamp of when the build started.
resource.finishedAtstring | nullISO 8601 timestamp of when the build finished, or null while still running.
resource.buildNumberstringSemver number assigned to the build.
resource.usageTotalUsdnumberBuild cost in USD.
resource.meta.originstringWhat triggered the build.

Status values

The resource.status field uses these values:

  • Actor run: READY, RUNNING, SUCCEEDED, FAILED, ABORTED, TIMED-OUT, ABORTING.
  • Actor build: READY, RUNNING, SUCCEEDED, FAILED, ABORTED, TIMED-OUT.
Full resource object

resource contains every field returned by the corresponding API endpoint, not just the fields listed above. Inspect a sample run or build with the API to discover additional values you can reference.

Message template examples

Minimal run status notification

:rocket: Run *{{resource.id}}* of Actor `{{eventData.actorId}}` finished with status `{{resource.status}}`.
*{{eventType}}*

• Actor: <https://console.apify.com/actors/{{eventData.actorId}}|{{eventData.actorId}}>
• Run: <https://console.apify.com/actors/runs/{{resource.id}}|{{resource.id}}>
• Status: `{{resource.status}}`
• Started: {{resource.startedAt}}
• Finished: {{resource.finishedAt}}
• Compute units: {{resource.stats.computeUnits}}
• Dataset: <https://console.apify.com/storage/datasets/{{resource.defaultDatasetId}}|open>
• Key-value store: <https://console.apify.com/storage/key-value-stores/{{resource.defaultKeyValueStoreId}}|open>

Failure alert with conditional copy

:rotating_light: *Run failed*
Actor `{{eventData.actorId}}`{{#if eventData.actorTaskId}} (task `{{eventData.actorTaskId}}`){{/if}}
Run: <https://console.apify.com/actors/runs/{{resource.id}}|{{resource.id}}>
Status: `{{resource.status}}`
{{#if resource.statusMessage}}Reason: {{resource.statusMessage}}{{/if}}
Triggered at: {{createdAt}}

Build notification

:hammer_and_wrench: Build *{{resource.buildNumber}}* of Actor `{{eventData.actorId}}` ended with `{{resource.status}}`.
Build ID: `{{eventData.actorBuildId}}`
Debug your template

Send a test event from the integration setup screen to verify the channel and workspace are wired correctly, then iterate on the template against a real run or build event.