Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

 
alt

Daniel Nashed

 

Discord Webhooks -- Sending messages via REST-API

Daniel Nashed  21 April 2024 18:31:51

I have been looking for a simple way to send messages to a messaging application.

In Discord it is pretty simple to create a simple webhook.

You just go to your channel and create the hook.
The webhook URL contains the authentication and the target.


Here is how the result looks like. Below you find the simple bash script and the configuration.


-- Daniel


Image:Discord Webhooks -- Sending messages via REST-API


#!/bin/bash


discord_url="
https://discord.com/api/webhooks/1231669332577350000/6nmsJWzTmkpiq1n4vyQVmlOCsdZolkA6TZJAjhUYxRrvpAv9SZ91Vu26amxxxx"

send_discord_msg()

{

curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"$1\"}" $discord_url

}


send_discord_msg "Hello, World!"




Image:Discord Webhooks -- Sending messages via REST-API


Comments
No Comments Found

Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]