Gradient Handbook / Tools We Use / Slack / Slack Notifications from R Edit this page

Slack Notifications from R

This page is meant for ??? and presents the content of the ???.

Writing to Slack from R

This document is based on Slack’s Documentation regarding Incoming Webhooks.

Below is the Step by Step guide

    1. Select Incoming Hooks
    1. Activate Incoming Hooks
    1. Add New Webhook to Workspace and pick a channel

    1. 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.