Hi,
This tutorial aims to give you a basic example about how to use a webhook to send message from your OpenMP/SA-MP server into a discord channel.
Requirements :
1) Install pawn-requests package on your server
2) Creating a Discord webhook
Create text channel
Click "Edit Channel" => Integrations => Create Webhook
Click on the Webhook => Copy Webhook url (save it for later)
3) Send message from server
Add requests include and create a RequestsClient with your webhook url
#include <requests>
new RequestsClient:client;
main()
{
client = RequestsClient("replace with your webhookurl");
}
Send message to discrod
public OnPlayerConnect(playerid)
{
new name;
GetPlayerName(playerid, name, sizeof(name));
new string;
format(string, sizeof(string), "%s has joined the server.", name);
RequestJSON(
client,
"",
HTTP_METHOD_POST,
"OnPostJson",
JsonObject(
"content", JsonString(string)
)
);
return 1;
}
forward OnPostJson(Request:id, E_HTTP_STATUS:status, Node:node);
public OnPostJson(Request:id, E_HTTP_STATUS:status, Node:node)
{
if(status == HTTP_STATUS_NO_CONTENT) {
printf("successfully posted message");
}
else
{
printf("failed to post message");
}
}
Now when a player connect to the server, a message will be sent on the discord channel.

Credits
Southclaws for the requests package
Regards