A Slack bot implementation for Fastly purge API.
This is not an official product.
-
Add
app_mentionon Subscriptions > Subscribe to bot events. -
Add
app_mentions:readandchat:writeon OAuth & Permissions > Scopes. -
Get and set to .env
SLACK_SIGNING_SECRETandSLACK_BOT_TOKEN.SLACK_SIGNING_SECRETis on Basic Information > App Credentials.SLACK_BOT_TOKENis on OAuth & Permissions > OAuth Tokens & Redirect URLs, after install to Workspace.
URL: https://manage.fastly.com/account/personal/tokens
Create a token with scope...
purge_selectglobal:read(for searching service id by name for convenience)
| Name | Description | Note |
|---|---|---|
| SLACK_SIGNING_SECRET | Slack signing secret | required |
| SLACK_BOT_TOKEN | Slack bot token | required |
| FASTLY_API_TOKEN | Fastly API token | required |
gcloud functions deploy handleFastlyPurgeBot \
--runtime=nodejs18 \
--allow-unauthenticated \
--trigger-http \
--region=asia-northeast1 \
--project=<your-project-id>https://developer.fastly.com/reference/api/purging/#purge-single-url
@BotMention purge <url>
https://developer.fastly.com/reference/api/purging/#purge-tag
@BotMention purge-key <service-name> <surrogate-key>
https://developer.fastly.com/reference/api/purging/#bulk-purge-tag
@BotMention purge-keys <service-name> <surrogate-key1> <surrogate-key2> ...
| Name | Description |
|---|---|
| --soft | set fastly-soft-purge header '1' |