Discord Integration
Introduction
This guide explains how to connect the Surpuissant SDK to Discord to automate message sending.
Configuration
Function Configuration
Create the Function
To integrate the function that executes a webhook, start by defining the parameters that the Surpuissant SDK will use. Name the webhook discord_webhook and use the following description:
The user will say a phrase that will be sent to another person. Extract from the sentence said, the content the user wants to send.
Then, fill in the function parameters as follows:
{
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"type": "string"
}
}
}
The goal here is to capture the content of the message orally and inject it into the webhook.
Webhook Configuration
Create the Webhook
Create a new webhook with the function_name corresponding to the name of the function configured earlier. The function_name indicates which webhook should be triggered when the selected function is executed. Use your WebhookDiscord endpoint_url, which you can find in the settings of a channel, for example.
Configure the Webhook
- method: Set the method to POST.
- headers: Set the headers as follows:
{
"Content-Type": "application/json"
}
- body_template : Define the body_template with the following json
{
"content": "{{content}}",
"username": "SDK Surpuissant",
"avatar_url": "https://static.wikia.nocookie.net/lunivers-cinematique-dc/images/5/50/HenryCavill.jpg/revision/latest?cb=20150420135507&path-prefix=fr"
}
Everything is good, your webhook is now configured!
Integration test
So now we can just run the SDK as usual with WakeWord and then say a phrase "send a message, hello how’s it going" so that it runs the webhook and can send a message.
By following these steps, you can automate the sending of Discord messages using the Surpuissant SDK.