🧩How to use Gooey Functions?

In this guide, we will learn how to create a functions call on Gooey.AI and add it to our Gooey.AI workflows.

We'll take the example of our Copilot Analysis Scripts. All copilots have an integrated LLM script to analyze various user data. This could be user location, question category, user sentiment, etc. Once you have the data, you might want to push it to your servers, or database, or combine it with your other services.

Scenario

We will take the "Gooey Chat Bot Analysis Script" in this example. This LLM script analyzes the incoming messages to our Gooey.AI Support Bot and categorizes the user's query into buckets like API Usage, Pricing, Sales, etc.

We want to push this output to our CRM so we get deeper analytics which helps us respond better to our customers.

How do you add functions to your Gooey workflows?

Step 1

Head over the Functions workflow

Step 2

Create your POST Request with AFTER Function:

Here is a basic fetch call, you can copy or edit this code as per your needs, and paste it in the code editor on the Functions workflow.

Currently, we have added httpbin for our POST request, you can change this for your preferred API. You can find more examples here

A basic fetch call
async (variables) => {
  const res = await fetch("https://httpbin.org/post", {
    method: "POST",
    body: JSON.stringify(variables),
    headers: {
      "Content-Type": "application/json",
    },
  });
  return { response: await res.json() };
};

Step 3

Add your relevant variables.

Step 4

Hit Submit, if your code is working fine you will get your outputs on the right side. Use the β€œSave as New” button and update the run name.

Step 5

Now head over to the Gooey workflow where you want to add the saved functions.

Head over to the example below:

Check the Functions, choose β€œAFTER” and add your Saved example. And then hit "SUBMIT!

You can check your Functions output in the Workflow at the end of the page in "Details" section.

How do I find all the available functions and how can I contribute?

All the functions are available here:

Choose any of the Examples and Fork them!

More resources

Last updated