Generate ChatGPT Message

Integrate your Feathery form with GPT or any AI service to generate intelligent responses to form inputs that are editable and can power logic.

Overview

This rule runs after a location and time is collected on Step 1 and the step is submitted. The field entries are used to query ChatGPT to generate a customized invite message that is editable in a text area field on Step 2.

This pattern can be used to integrate with any AI service to generate any content from any user inputs.

Rule Logic

const location = AILocation.value;
const time = AITime.value;
const eventType = AIEventType.value;

const res = await feathery.http.POST('https://api.openai.com/v1/chat/completions', {
    "model": "gpt-3.5-turbo",
    "messages": [
      {
        "role": "system",
        "content": "You are a friendly event planner. Maximum 50 word responses."
      },
      {
        "role": "user",
        "content": `Create an invitation message for an event. The location is ${location}. The time is ${time}. The event type is ${eventType}.`
      }
    ]
})

AIMessage.value = res.choices[0].message.content;

API Connector

Under the API connectors tab, create a connector with the following configuration:

Fill in {{OPENAI_API_KEY}} with your OpenAI API key.

Last updated