Send Messages From Devices to Slack Using ThingSpeak

Slack is a team collaboration tool. Slack is an extremely popular way to receive messages from team members all in one place and integrate with external web services. One possible integration is with ThingSpeak. ThingSpeak is an open data platform for the Internet of Things. Devices all around the world are using ThingSpeak to collect data from sensors and send data to apps and other devices. By following this tutorial, you will be able to use ThingSpeak to send messages to your team’s Slack channel. This will also allow devices like an Arduino to use Slack since ThingSpeak will take care of authentication and HTTPS.
Arduino Slack ThingSpeak

Setup Slackbot

  • From Slack, select “Configure Integrations”
  • Search for “Slackbot”
  • Click “Add Slackbot Integration”
  • Note your “Your slackbot URL” for later steps

Add Slackbot Integration

Setup ThingSpeak

  • Sign into ThingSpeak or sign up for a new account
  • Select “Apps”
  • Select “ThingHTTP”
  • Click “New ThingHTTP”
  • Enter the following settings:
    • Name: Slackbot
    • URL: (Enter the Slackbot URL)
    • Method: POST
    • Body: Test from ThingSpeak
  • Click “Save ThingHTTP”

Slack ThingSpeak ThingHTTP Settings

Test ThingSpeak + Slack Integration

ThingHTTP generates a URL that you can use HTTP GET from a device or other ThingSpeak Apps such as MATLAB or React. Enter the ThingHTTP URL in a new browser tab. You will see a response of “ok” if the request is successful. You will also see a new Slack message on your General channel.
Slack_Response

Next Steps

  • With small changes you can send data to other Slack channels other than “general”
  • A device can trigger a Slack message by getting the ThingHTTP URL
  • Custom messages can be written by using ThingHTTP replacements
  • Setup a ThingSpeak React to send data to Slack when your sensor data goes above a certain value
  • Use MATLAB to write analyzed sensor data to a Slack channel