# Calling Webhook

***

In this use case tutorial, we are going to create a custom tool that will be able to call a webhook endpoint, and pass in the necessary parameters into the webhook body. We'll be using [Make.com](https://www.make.com/en) to create the webhook workflow.

## Make

Head over to Make.com, after registering an account, create a workflow that has a Webhook module and Discord module, which looks like below:

<figure><img src="/files/obdKdk7prDPrqejz5Kwq" alt=""><figcaption></figcaption></figure>

From the Webhook module, you should be able to see a webhook URL:

<figure><img src="/files/fb4sZDcDtcqVYgYrn8zs" alt="" width="563"><figcaption></figcaption></figure>

From the Discord module, we are passing the `message` body from the Webhook as the message to send to Discord channel:

<figure><img src="/files/CvgCjDbK5Y7pDkwgZ4Ms" alt="" width="563"><figcaption></figcaption></figure>

To test it out, you can click Run once at the bottom left corner, and send a POST request with a JSON body

```json
{
    "message": "Hello Discord!"
}
```

<figure><img src="/files/7PMik8kJ1JrzhsI2bEyc" alt="" width="563"><figcaption></figcaption></figure>

You'll be able to see a Discord message sent to the channel:

<figure><img src="/files/yDNzmYJDfcIrNqbzYyTk" alt="" width="249"><figcaption></figcaption></figure>

Perfect! We have successfully configured a workflow that is able to pass a message and send to Discord channel [🎉 ](https://emojiterra.com/party-popper/)[🎉](https://emojiterra.com/party-popper/)

## Tailwinds

In Tailwinds, we are going to create a custom tool that is able to call the Webhook POST request, with the message body.

From the dashboard, click **Tools**, then click **Create**

<figure><img src="/files/VfZlXT5c6IlcpdNDNXss" alt=""><figcaption></figcaption></figure>

We can then fill in the following fields (feel free to change this according to your needs):

* **Tool Name**: make\_webhook (must be in snake\_case)
* **Tool Description**: Useful when you need to send message to Discord
* **Input Schema**:

<figure><img src="/files/oDQky17NTDDjXdX79SKC" alt=""><figcaption></figcaption></figure>

* **JavaScript Function**:

```javascript
const fetch = require('node-fetch');
const webhookUrl = 'https://hook.eu1.make.com/abcdef';
const body = {
	"message": $message
};
const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(body)
};
try {
    const response = await fetch(webhookUrl, options);
    const text = await response.text();
    return text;
} catch (error) {
    console.error(error);
    return '';
}
```

Click **Add** to save the custom tool, and you should be able to see it now:

<figure><img src="/files/qSad9kh4qlyMuibmcR6g" alt="" width="279"><figcaption></figcaption></figure>

Now, create a new canvas with following nodes:

* **Buffer Memory**
* **ChatOpenAI**
* **Custom Tool** (select the make\_webhook tool we just created)
* **OpenAI Function Agent**

It should looks like below after connecting them up:

<figure><img src="/files/cAtofvRF4LPSdMNSkLCv" alt=""><figcaption></figcaption></figure>

Save the chatflow, and start testing it!

For example, we can ask question like *"how to cook an egg"*

<figure><img src="/files/bbenkwmmEf4sbU82sevX" alt="" width="563"><figcaption></figcaption></figure>

Then ask the agent to send all of these to Discord:

<figure><img src="/files/SoaZn4iyM1E5ZLHxwZvC" alt="" width="563"><figcaption></figcaption></figure>

Go to the Discord channel, and you will be able to see the message:

<figure><img src="/files/QbhRx2cZRClbhLtnoxbd" alt=""><figcaption></figcaption></figure>

That's it! OpenAI Function Agent will be able to automatically figure out what to pass as the message and send it over to Discord. This is just a quick example of how to trigger a webhook workflow with dynamic body. The same idea can be applied to workflow that has a webhook and Gmail, GoogleSheets etc.

You can read more on how to pass chat information like `sessionId`, `flowid` and `variables` to custom tool


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tailwindsdocs.innovativesol.com/readme/use-cases/webhook-tool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
