-
Just for testing purposes, using github.com/laravel-notification-channels/discord.
- After cloning the project, run:
composer install
-
Create a Discord application.
-
Click the Create a Bot User button on your Discord application.
-
Paste your bot's API token, found under App Bot User, in your services.php config file:
// config/services.php
'discord' => [
'token' => 'YOUR_API_TOKEN',
],
- Add the bot to your server and identify it by running the artisan command:
php artisan discord:setup
- Make a post request (example: http://localhost:8000/api/send):
- The "message" attribute generates a simple text message.
- The "embed" attribute is an object and each attribute is responsible for generating an embed.
- The "channel_id" attribute is the id of the channel where you want to send the message.
$ curl -d '{
"message": "",
"embed": {
"title": "Embed Title",
"type": "rich",
"description": "content embed",
"color": "777",
"timestamp": "2022-04-18T22:42Z"
},
"channel_id": "000000000000"
}' -H 'Content-Type: application/json' http://localhost:8000/api/send