Slack
| Schemes | slack:// |
| Cargo feature | service-slack |
| Service | https://slack.com/ |
| Body formats | markdown, text (first is the default) |
| Attachments | yes |
| Title length | 250 characters |
| Body length | 35,000 characters |
| Body lines | unlimited |
| Request throttle | 1200 ms between requests |
| Vendor URLs accepted | yes |
URL formats
{schema}://{token_a}/{token_b}/{token_c}
{schema}://{botname}@{token_a}/{token_b}/{token_c}
{schema}://{token_a}/{token_b}/{token_c}/{targets}
{schema}://{botname}@{token_a}/{token_b}/{token_c}/{targets}
{schema}://{access_token}/
{schema}://{access_token}/{targets}
{schema} is one of slack://.
URL tokens
| Token | Meaning | Type | Required | Default | Notes |
|---|---|---|---|---|---|
{access_token} | OAuth Access Token | string | yes | secret; must match ^(?:xoxe\.)?xox[abp]-[A-Z0-9-]+$ | |
{botname} | Bot Name | string | no | ||
{target_channels} | Target Channel | string | no | prefix # | |
{target_email} | Target Email | no | |||
{target_encoded_id} | Target Encoded ID | string | no | prefix + | |
{target_user} | Target User | string | no | prefix @ | |
{targets} | Targets | list | no | any of target_channels, target_email, target_encoded_id, target_user; separated by / | |
{token_a} | Token A | string | yes | secret; must match ^[A-Z0-9]+$ | |
{token_b} | Token B | string | yes | secret; must match ^[A-Z0-9]+$ | |
{token_c} | Token C | string | yes | secret; must match ^[A-Za-z0-9]+$ | |
{workflow_path} | Workflow Path | string | no | secret |
Query parameters
| Parameter | Meaning | Type | Default | Notes |
|---|---|---|---|---|
blocks | Use Blocks | bool | no | |
footer | Include Footer | bool | yes | |
image | Include Image | bool | yes | |
mode | Message Mode | choice | one of hook, gov-hook, bot, workflow, trigger | |
template | Template Path | string | secret | |
timestamp | Include Timestamp | bool | yes | |
to | Targets | list | sets {targets} | |
token | OAuth Access Token | string | sets {access_token}, {token_a}, {token_b}, {token_c} |
Prefixed parameters:
:name=value: Template Tokens
The common URL parameters (format, overflow, verify, redirect, cto, rto, retry, wait, store, tag, tz, user, password, port, optional, emojis) apply as well.
Examples
Accepted URLs (tokens are fake):
slack://xoxb-1234-1234-abc124
slack://xoxb-1234-1234-abc124/#a/#b
slack://xoxb-1234-1234-abc124/#nuxref
slack://T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/
slack://username@T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ
slack://T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/+id/@id/plain
slack://T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/#hmm/#-invalid-
https://hooks.slack.com/workflows/T1JJ3T3L2/Ft07XXXX/XXXXXXXX/YYYYYYYY
Rejected URLs:
slack://
slack://:@/
slack://T1JJ3T3L2
slack://T1JJ3T3L2/A1BRTD4JD/
Send one from the command line:
mercurio -t 'Backup' -b 'Finished in 42s' 'slack://xoxb-1234-1234-abc124'
Notes
Slack (slack://): messages through incoming webhooks (hook, gov-hook), bot tokens (bot, with e-mail lookups and the external file-upload flow) and workflow webhooks (workflow, trigger).
E-mail lookups are cached for the lifetime of the parsed URL. On ?retry=, channels that accepted the message are skipped and their remembered channel ids still receive the attachments that have not been delivered yet.