DEV Community

Cover image for [Discord] Send message through Bot
nicha
nicha

Posted on

3 1 1

[Discord] Send message through Bot

I am a newbie to Discord. Recently, my friend and I started a discord channel for a live talk session to interview people and share our experiences with interested people.

When sending a message, I'm thinking about a way to send a message through a bot instead of using my account, so my friend taught me a way to do that. And today, you will know it too!!



First of all, you have to be an admin of that server. Then, visit the server setting > integration > webhook.

Webhook-setting

Then, click "New Webhook" and choose the channel that you want to send message to
Create-webhook

Later on, click on the button "Copy Webhook URL" to copy the webhook URL

Lastly, you can send a message by inputting it into the curl.

curl --location --request POST '{YOUR_WEBHOOK_URL}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "content": "{YOUR_MESSAGE}",
    "username": "{SENDER_NAME}",
    "avatar_url": "{PICTURE_URL}"
}
'
Enter fullscreen mode Exit fullscreen mode

Please feel free to share interesting bot and command in discord with me 👾

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
thomasbnt profile image
Thomas Bnt

Hello nice post about Discord and Curl!

Don't hesitate to put colors on your codeblock like this example for have to have a better understanding of your code 😎

console.log('Hello world!');
Enter fullscreen mode Exit fullscreen mode

Example of how to add colors and syntax in codeblocks

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay