This site was created with notaku.so! πŸ”₯

Send messages to Slack

You can send messages to Slack from vals.
In this guide you’ll create an incoming webhook for your Slack workspace, and send a request to it with a message payload.
Image without caption

1. Create a Slack app

Visit https://api.slack.com/apps?new_app=1, create a new app From Scratch, and choose your App Name and your workspace.
Image without caption

2. Go to the incoming webhooks page

On the next page (or in the side bar), click Incoming Webhooks.
Image without caption

3. Create an incoming webhook

Click the Activate Incoming Webhooks toggle.
Image without caption
Scroll down, and click Add New Webhook to Workspace.
Image without caption
Select the channel which the webhook will send messages to.
Image without caption

4. Save the webhook address as a secret

You’ll be taken back to the Incoming Webhooks page (if not, you can find it via the side bar).
Image without caption
Copy the Webhook URL for the webhook you just created and save it as a Val Town secret as slackWebhookURL.

5. Use fetch to send a message

Translate the sample cURL request to a fetch request. You can copy and paste the following val.
If it worked, you will get a message in the channel you configured earlier!
Image without caption
Ran into a problem? Get help on the Val Town Discord.