Discord Webhooks from Microcontroller
Sending a Discord webhook (message to a channel) from an ESP8266 (D1 Mini).

Test webhooks with a POST request
curl -X POST -H "Content-type: application/json" -d "@webhook_example.json" "${WEBHOOK_URL}"
The simplest webhook only needs a content field.
{
"content": "hello!"
}
To turn a JSON file into something you can put in .cpp files (i.e., escape the quotes), run something like:
cat webhook.json | jq -c | sed 's/"/\\"/g'
Programming
set up secrets
cp src/secrets.h.example src/secrets.h
nano src/secrets.h
Install https://platformio.org/, then:
build code
pio run -e blink # blink (to test microcontroller)
pio run -e request # send request
upload code
pio run -e blink -t upload # blink (to test microcontroller)
pio run -e request -t upload # send request
attach to serial monitor
pio device monitor
