All Collections
OpenAI Request Action
OpenAI Request Action
Justin Yan avatar
Written by Justin Yan
Updated over a week ago

Frontly's OpenAI Request custom action is the newest entry to an already diverse list of actions that can be triggered from certain events in your user flow. Unlike any of the other custom actions in this list however, OpenAI Request enables a level of content generation that hasn't previously existed in Frontly before. Find how to work this into your workflow and play with the possibilities that lay at your fingertips!


Entering Your API Key from OpenAI

This feature is available for Tier 5 AppSumo LTD, Frontly Unlimited, or AI Token monthly add-on users only.

If you choose to integrate your OpenAI account into Frontly, you will first need to create an API key from it. To do so, head over to and click '+Create new secret key'.

Enter a name for it that is easily traceable and save your newly generated API key in a secure location.

Once collected, head over to your Frontly app settings over to the 'Integrations' tab and copy + paste your API key in the 'Open AI API key' field. Don't forget to save!

You are all set up now!

Selecting Your Trigger in Frontly

All custom actions begin with a Frontly defined event that is triggered by your users. . First, decide on what that event is, and then select the OpenAI Request custom action as your first action. As a quick reminder, multi-layered customs will always resolve in the order they are configured in

Click here to learn more about Custom Action events and other Custom Actions.

For your prompt, decide on what sort of content you wish to generate for your app. This can be anything you would typically enter as a prompt into ChatGPT: a creative art, a list of items or an explanation of a complex subject. The choice is yours!

Of the text you can enter into your prompt, you can also inject your dynamic variables into it!

If you have integrated your own OpenAI account into Frontly, you may also choose between GPT models too.

Click here to learn more about Dynamic Variables at Frontly.

Displaying Responses

Responses generated from your OpenAI Request require an output for your responses to surface on your app. This can be done through two methods:

Create a Local State

To store the the response value within your users session, simply set the second action of your custom action sequence to 'Update Local State' (where the Key can be anything) and it's Value to the dynamic variable {{actionSteps.1.response}}.

Click here to learn more about Local State Variables

Here's a detailed breakdown of the dynamic variable {{actionSteps.1.response}}:

actionSteps - Refers to the custom action sequence you've created for that event. Layered custom actions that are created from a single event always resolve in the sequence they are ordered in.

1 - In a multi-layered custom action sequence, this number makes direct reference to a specific step of the sequence. In this case, it is the first one. But if your set up is different from the one above, you'll want to reference the action step number that corresponds with your OpenAI Request one.

response - Is the generated text response from the OpenAI request.

Upon saving the generated response (as a value) into a local state, you can reference its key in a local state dynamic variable to surface its contents however you wish!

In Edit Mode

In Live Mode (once requested)

Save Responses into Your Sheets

To save your AI generated responses into your Google Sheets so they can be recorded and referenced later, you can instead select the 'Google Sheet' custom action and choose between the Create or Edit Action Type listed, whichever meets your specific app needs. To save generated responses, simply inject the {{actionSteps.1.response}} dynamic variable into your desired column and they will update there moving forward.

From there, since your AI generated responses will now exist as data in your sheets, it is entirely up to you how and where you want to surface it!

Using Training Examples to Improve Responses

To boost the quality and consistency of your responses, use training examples to refine the format of your outputs. By incorporating more examples, you will guide the AI towards a response that more closely align with your expectations. It's a simple yet effective way to fine-tune the AI's responses and enhance their relevance and consistency over time.

For each training example you create, start by adding an additional prompt that offers deeper context to your main prompt. In the 'Response' field, enter a response you'd want the OpenAI to replicate. These inputs will influence the generation process, ensuring that subsequent outputs reflect your desired style and tone.

Remember πŸ’‘: Manually entering any relevant dynamic variables into these fields will be factored into the OpenAI's generation as well!

Did this answer your question?