Slack Notifications from R
This page is meant for ??? and presents the content of the ???.
This document is based on Slack’s Documentation regarding Incoming Webhooks.
Below is the Step by Step guide
-
- Create a Slack app
-
- Select Incoming Hooks
-
- Activate Incoming Hooks
-
- Add New Webhook to Workspace and pick a channel
-
- Use webhook in R code
The webhook will appear, like this;
https://hooks.slack.com/services/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
Use this webhook to call a Slack channel with the following code
httr::POST(url = 'https://hooks.slack.com/services/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',
add_headers(`Content-type` = 'application/json'),
encode = "json",
body = list(text = your_text_to_be_posted))
where your_text_to_be_posted is the text you want to provide in the Slack channel.