Send a Message on Discord

Send a Message on Discord © CC BY

Do you want to send message on Discord using an Arduino? It is really easy thanks to webhooks.

  • 5,448 views
  • 1 comment
  • 9 respects

Components and supplies

Apps and online services

About this project

Discord server has a system to send messages automatically to a channel.

This system uses webhook, so you just have to send a web request to a URL and a message will be written on the selected channel.

https://en.wikipedia.org/wiki/Webhook

This could be used in many ways, for example:

  • Make a badge reader using RFID to send a message when someone is at your fablab.
  • Display the temperature of a room each hour.

Create a Webhook

First we need to create a webhook in our server:

https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks

Click on your discord servername → Discord Settings Then click on Webhook → Create WebHook

Copy the Webhook URL

Arduino Code

I used Arduino Create to write my code, but you can also use the classic IDE.

Here is a link to the code: https://create.arduino.cc/editor/madnerd/429197a3-8a40-4d2c-bc16-1a502cb26cd9/preview

Settings

Settings are inside arduino_secrets.h or the Secrettab

  • SECRET_SSID: your Wi-Fi network name
  • SECRET_PASS: your Wi-Fi password
  • SECRET_TTS: true to enable text to speech or false to disable it

Upload your code on your Arduino MKR 1010, you should see this message:

You can find more information on how to use Discord webhook here: https://discordapp.com/developers/docs/resources/webhook#execute-webhook

Here is also some information for text-to-speech: https://support.discordapp.com/hc/en-us/articles/212517297-Text-to-Speech-101

To send a message on discord, just type:

discord_send("Hello World");

Library

I used two libraries for this code:

  • WiFiNINA: Wi-Fi manager
  • ArduinoHttpClient: Web request

Code

Discord
Github repository
Code for mkr1010/esp32/esp8266

Comments

Similar projects you might like

MKR1000 Message of the Day

Project showcase by Metonymy

  • 1,787 views
  • 0 comments
  • 1 respect

Send SMTP email with Arduino and ESP8266

by Team Hans

  • 2,788 views
  • 3 comments
  • 8 respects

Send messages to the Arduino Yun with your internet browser

Project tutorial by Arduino_Scuola

  • 2,369 views
  • 2 comments
  • 5 respects

Send and Receive Text Messages (SMS) with GSM SIM900 Shield

Project tutorial by Boian Mitov

  • 61,558 views
  • 5 comments
  • 29 respects

Intruder Alarm with Text Message Notification

Project tutorial by Matthew Hallberg

  • 26,093 views
  • 13 comments
  • 53 respects
Add projectSign up / Login