Functions

Business Data you can trust

Trigger functions provide a means to seamlessly integrate ChatGPT with your automation tools and external systems. These functions enable you to effortlessly gather user information and initiate predefined flows. The triggered flow has the capability to execute various automations, retrieve data from external sources, and relay the information back to ChatGPT.

Business Data has included a pre-configured tigger that allows the user to stop bot automation and talk with a human agent. This Trigger function is already active on your account.

How to create a ChatGPT Trigger Function

Navigate to Settings > Integrations > AI Triggers and click the Manage button

 
On the AI Triggers page, click the Add button

Name

Name 

Best practice is to Name your Trigger Function in a way that it allows you, and others, to know exactly what it does at first sight. For example, instead of using “weather” as a name, use “get_current_weather”. 

Tip: Always include a verb in the name (book, get, set) and avoid any special characters such as: ‘ , & , á or ñ.

What Does this Trigger Do?

This field should clarify even more what the purpose of the Function is. Always start with “Allows the user to …”. For example, “Allows the user to book an appointment”. This section should help OpenAI to match “intention” with “function, if user “wants to book an appointment” it will use Trigger Name and this description to find the best match.

Tip: If you are working in more than one language, please keep each function in a single language. If choosing a different language than English, keep in mind this works just as a prompt, you might need to test and make modifications.

Tip:  If you are having issues with Functions not saving special characters correctly you can try Simon Johansson’s (user) solution: I told it to handle all user data with UTF-8 encoding in the field “what does this trigger do?”, and that worked like a charm.

 

What Data to Collect?

Naming must be clear and specific. For example, if you want your function to collect user email, use “email”. 

Tip: Keep in mind, Bot will wait until user provides all requested data BEFORE it triggers.

What Flow is Triggered?

You can trigger any flow that you have already created. For the best user experience, if the response depends on the data collected, set the final response in a single custom field and use it in the “What is the output message?” below. Go to “Examples” below to see some use cases.

What is the Output Message?

The result of triggering this Function. For example, “Your booking was confirmed”. The output message will not be sent exactly as specified. OpenAI will rewrite and send it to the user. 

Tip: This step it’s optional, leave it empty if you need/want to ONLY trigger the flow and skip the AI generated text from the Default Response.

Examples

Name: book_appointment

What does this trigger do?: Allows the user to book an appointment.

What data to collect?: date, email, reason

What is the output message?: You have successfully booked an appointment.

Name: connect_user_to_human

What does this trigger do?: Allows the user to speak, talk or contact a human agent or team. This function will connect the user to a human agent.

What flow is triggered?: [Choose your flow from drop down] 

What is the output message?: You are now connected to a human agent. We will get back to you soon.

Name: get_current_weather

What does this trigger do?: Allows the user to get the current weather in a given location

What data to collect?: city

What flow is triggered?: [Choose your flow from drop down] 

What is the output message?: {{data_from_api}}

Name: join_email_list

What does this trigger do?: Allows the user to join our email list.

What data to collect?: email

What is the output message?: Success

Name: request_shipping_quote

What does this trigger do?: Allows the user to request a quote for shipping a package.

What data to collect?: origin_address, destination_address, dimensions, weight

What flow is triggered? [Choose your flow from drop down]

What is the output message?: {{quote}}

Enable a Trigger Function

After creating your Trigger Function, you need to attach it to the OpenAI action or attach it to the OpenAI Settings.

Important notes

Your prompt can and most likely will affect the way your Trigger Functions work.

If your trigger function is not working as expected, please verify your main prompt and business description to make sure there is NO text that might be in conflict with your trigger.


How to use this in your favour? If, for example, you have a restaurant reservation function, you might find useful for Bot to remember and reuse user’s name and phone number, but it won’t make sense to reuse its last reservation’s date or guest’s number. In this case, you could include in your prompt something like: “It is very important to ask the user for the date and number of guests each time the user wants to make a reservation.” to make sure OpenAI do NOT complete the missing data and/or reuse it from past conversations.

Functions work similar to a “complementary prompt”

Just as any prompt, you might need some testing the wording in name and description before you get it working perfectly.

Stay updated

Get our free newsletter for the latest news and insights on lo-code AI, intelligent assistants and tips to make sure your business stays head of the curve.