Skip to content

How to Automatically Generate Scripts Using OpenAI and Notion

  • by

This article will explore the process of integrating Notion with OpenAI, allowing you to effortlessly generate scripts by inputting a topic into your Notion database. With this integration, you can easily generate high-quality content for your blog, social media, or other platforms by simply entering a topic in your Notion database.
This automation requires a one-time setup, for which we will use Pabbly Connect.
Initially, we’ll establish a connection between Notion and Pabbly Connect to gather the subject matter for your script. Subsequently, we’ll link Pabbly Connect with OpenAI to produce scripts based on the captured topics, and ultimately, save the resulting script in a novel document that is uploaded to Google Drive.

Steps to Create Scripts with OpenAI and Notion Automatically

1. Sign In / Sign Up to Pabbly Connect and Create a Workflow
2. Setup Notion as the Trigger App to Fetch Topics
3. Setup OpenAI as the Action App to Generate Scripts
4. Setup Google Drive as the Action App to Create File
5. Setup Google Drive as the Action App to Store Scripts

Step 1:- Sign In / Sign Up to Pabbly Connect and Create a Workflow

A. Sign In / Sign Up

To begin this process, visit Pabbly Connect and create your account by clicking on the ‘Sign Up Free’ button. You can also click on Sign In if you already have an account.

Click on the Pabbly Connect ‘Access Now’ button

B. Create Workflow

To create a new workflow, click the ‘Create Workflow’ button.

Name your workflow, and click on ‘Create’.

Step 2:- Setup Notion as the Trigger App to Fetch Topics

We will now look at the process for establishing a connection between Notion and Pabbly Connect. This will allow us to retrieve topics from your Notion database.

A. Trigger App

Trigger enables us to select the application from which Pabbly Connect will retrieve the data. In this instance, it would be Notion.

Choose ‘Notion’ as the Trigger App, select ‘New Database Item’ as a Trigger Event, and click on ‘Connect’.

B. Connect Notion Account

To link your Notion account, select ‘Add New Connection’, and click on ‘Connect With Notion’. Additionally, grant permission by authorizing access.

Select the Database ID from which you want to fetch topics and then click on ‘Save & Send Test Request’.

Expand the Received Response section to view the topic retrieved from your Notion database. This indicates that the connection has been successfully established.

Step 3:- Setup OpenAI as the Action App to Generate Scripts

Action allows us to choose the application that will get executed by the workflow trigger.
Our objective is to generate scripts based on the topics obtained from Notion database with the help of OpenAI. Thus, OpenAI will serve as our Action App.

A. Action App

Choose ‘OpenAI’ as the Action App, select ‘Generate Content’ as an Action Event, and click on ‘Connect’.

B. Connect OpenAI Account

To connect with your OpenAI account, first select the ‘Add New Connection’ option. Then, enter your API Token as prompted. You can find your API Token by clicking on the ‘OpenAI API Keys page’ button.

Create your API token, then paste it into the designated field and finally click on the ‘Save’ button.

Choose the desired AI model for generating the scripts.

C. Enter / Map the Necessary Fields

Once you have successfully connected your OpenAI account, the next step is to map the topics from the previous step. By implementing this mapping process, we ensure that our data remains dynamic and adapts to changes based on the received responses.

Give a Prompt by mapping the topic obtained from the step above.

Likewise, select/enter the remaining fields that are required, while leaving any unnecessary ones blank, then proceed to click on the ‘Save & Send Test Request’ button.

After you click on Save & Send Test Request, OpenAI will automatically generate a script on the topic you provided.

Step 4:- Setup Google Drive as the Action App to Create File

Prior to saving the script produced by OpenAI to a Google Docs document, we need to create a new doc file in a particular folder within your Google Drive. To do this, we will configure Google Drive as our Action App.

A. Action App

Choose ‘Google Drive’ as the Action App, select ‘Create a File in a Specific Folder’, and click on ‘Connect’.

B. Connect Google Drive Account

To establish a connection with your Google Drive account, choose ‘Add New Connection’ and then click on ‘Sign in with Google’. You will then be prompted to grant the required permissions.

Choose the Folder in which you would like to save the script, map the File Name from the trigger step, select ‘Document’ as the File Type, and finally, click on the ‘Save & Send Test Request’ button.

Doing this will create a blank document in your chosen Google Drive folder.

Step 5:- Setup Google Drive as the Action App to Store Scripts

Finally, we will configure Google Drive once more as the Action App, but this time to save the scripts generated by OpenAI in the empty document that we created in the previous step.

A. Action App

Choose ‘Google Drive’ as the Action App, select ‘Update Content in a File’ as the Action Event, and click on ‘Connect’.

B. Establish Connection

As we have already established a connection with the Google Drive account, all that is required is to select ‘Select Existing Connection’ and then click on ‘Save’.

Choose the File where you would like to save the script, map the File Content from above, and click on ‘Save & Send Test Request’.

The moment you click on ‘Save & Send Request’, the chosen document will be updated, and the generated script will be saved automatically.

The integration of Notion with OpenAI and Google Drive is now fully automated, allowing for seamless generation and storage of articles. Whenever a new topic is added to your Notion database, an article on the same subject will be automatically created using OpenAI and saved as a document in your Google Drive.

You can copy this entire workflow by clicking this link.

Sign Up for a free Pabbly Connect account, and start automating your business
Subscribe to our Youtube Channel for more such automation
For any other queries, visit our forum