This actor is supposed to be run via webhooks to send Slack notifications about other actor/task's events.
This actor uses Incoming Webhooks for sending the messages. Refer to this article for the setup process.
To start getting notifications for an actor (or task) create a new webhook for that actor (or task). As a webhook URL, use:
https://api.apify.com/v2/acts/tlinhart~slack-notification-webhook/runs?token=<APIFY_TOKEN>
where APIFY_TOKEN
is your Apify API token. You can find the token on the
Integrations page in the Apify
console. You can also add other parameters supported by the
Run actor
endpoint to the URL, such as timeout
and memory
. Select events for which you
would like to receive notifications. Update the default webhook payload template
with slackWebhookUrl
and optionally slackWebhookArguments
to override
the defaults (see default-webhook-args.json):
{
"slackWebhookUrl": "https://hooks.slack.com/services/TXXXXX/BXXXXX/XXXXX",
"slackWebhookArguments": { ... },
"userId": {{userId}},
"createdAt": {{createdAt}},
"eventType": {{eventType}},
"eventData": {{eventData}},
"resource": {{resource}}
}
The slackWebhookArguments
parameter supports most of the arguments supported
by the Node Slack SDK, namely:
channel
username
iconEmoji
iconUrl
text
blocks
attachments
linkNames
unfurlLinks
unfurlMedia
To make the message format more flexible and customizable, all the string values support JavaScript-like string interpolation. The variables that are available for interpolation are those provided by the Apify platform in the default payload template and also variables provided by this actor:
actor
– object returned by the Get actor endpointtask
– object returned by the Get task endpointrunLog
– actor run log returned by the Get log endpoint
By default, the message contains information about the actor (and the task if available) and its run together with the last 15 lines of the run log.