docs.langflux.space
  • Welcome to LangFlux
  • Using LangFlux
    • API
    • Streaming
    • Embed
    • Variables
  • Configuration
    • Auth
      • Chatflow Level
    • Rate Limit
  • Integrations
    • Cache
      • InMemory Cache
    • Chains
      • Conversational Retrieval QA Chain
      • Vectara QA Chain
    • Document Loaders
      • S3 File Loader
      • PDF Files
    • Chat Models
      • Azure ChatOpenAI
      • ChatLocalAI
      • Google VertexAI
    • Embeddings
      • Azure OpenAI Embeddings
      • LocalAI Embeddings
    • Memory
      • Short Term Memory
      • Long Term Memory
        • Zep Memory
      • Threads
    • Text Splitters
      • Character Text Splitter
    • Tools
      • Custom Tool
    • Vector Stores
      • Chroma
      • Pinecone
      • Elastic
      • Qdrant
      • SingleStore
      • Supabase
      • Vectara
    • Utilities
      • Set/Get Variable
      • If Else
    • External Integrations
      • Zapier Zaps
  • Use Cases
    • Web Scrape QnA
    • Webhook Tool
Powered by GitBook
On this page
  • Make
  • LangFlux
  • Tutorials

Was this helpful?

  1. Use Cases

Webhook Tool

PreviousWeb Scrape QnA

Last updated 1 year ago

Was this helpful?

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 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:

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

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

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

{
    "message": "Hello Discord!"
}

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

LangFlux

In LangFlux, 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

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

  • Output Schema:

  • JavaScript Function:

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:

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:

Save the chatflow, and start testing it!

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

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

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

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.

Tutorials

  • Watch a step-by-step instruction video on using Webhooks with LangFlux custom tools.

  • Watch how to connect LangFlux to Google Sheets using webhooks

  • Watch how to connect LangFlux to Microsoft Excel using webhooks

Perfect! We have successfully configured a workflow that is able to pass a message and send to Discord channel

Tool Icon Src:

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

🎉
🎉
https://github.com/FlowiseAI/Flowise/assets/26460777/517fdab2-8a6e-4781-b3c8-fb92cc78aa0b
Make.com
Additional