How to Connect OpenAI to your WordPress site
Our OpenAI integration offers the ability to generate intelligent, human-readable content and use this content automatically in your WordPress workflows. Automatically generate content using any of the OpenAI GPT-3 models to create new blog posts, Facebook posts, tweets, and much more. Connect the input to a form and you have a powerful way to let users generate content without leaving the front end of your site.
If you have the free version of Uncanny Automator, you’ll first need to connect your site with a free Uncanny Automator account, which will give you 250 free credits to use with OpenAI. If you have Uncanny Automator Pro, simply activate your Pro license key to get unlimited usage of the OpenAI integration.
Once you’ve connected your free account or activated your Pro license key, return to the recipe page and click on the OpenAI icon.
You’ll need a secret API key from your OpenAI account to connect your WordPress site to OpenAI.
Click here to generate a secret API key for use with Uncanny Automator. (You’ll need to log in to your OpenAI account.)
Enter the generated API key into the Secret key field and click Connect OpenAI account.
That’s it! You’ll now be able to add OpenAI actions to generate action tokens that you can use in subsequent actions.
Action – Use a prompt to generate text
The action Use a prompt to generate text enables AI text generation with OpenAI’s GPT-3 natural language generator for use in your workflows. This is the same engine used by ChatGPT. It includes a number of options:
- Model: OpenAI offers a number of different models for generating text. The main differences between them are speed and cost. In the free version of Uncanny Automator, the available models are Curie, Babbage and Ada.
- Temperature: This basically controls the amount of randomness in the text returned by GPT-3.
- Maximum length: This number doesn’t indicate word length, but rather a number of token to be used for the response. OpenAI’s pricing model is based on token usage. From OpenAI: “You can think of tokens as pieces of words, where 1,000 tokens is about 750 words.” For more info on tokens, see this page.
- Prompt: This is the prompt that will be sent to OpenAI to tell the AI what text to generate. Examples could be:
- Write a blog post about how to connect WordPress to ChatGPT using Uncanny Automator.
- Write a poem about using AI to write WordPress blog posts.
- Write a story about the best automation plugin for WordPress adding support for OpenAI.
Action – Use a prompt to generate text with the Davinci model
This action is available in Uncanny Automator Pro. The options available in this action are the same as the action above, but without a Model dropdown as the Davinci model is pre-selected. Davinci is the slowest, most expensive and most capable GPT-3 model for generating text.
Responses typically take 15-30 seconds or longer, so when using this action there will be a delay before the text is returned from OpenAI. For this reason, depending on limitations in your hosting environment, the action may time out while waiting for a reply. Consider lowering the value in the Maximum length field if you do run into any timeout issues (for more information about action settings, make sure to check out the Knowledge Base article).
Action – Use a prompt to generate text with the GPT model
To use the same language model used by the popular ChatGPT tool, the gpt-3.5-turbo models are available for reasonably fast, inexpensive, accurate and context-sensitive replies. The main difference between this and other models is its support for a “System message” field, which is a way to add context so GPT knows how to respond to the prompt. Perhaps the response should be in a certain language, the reply should be structured as a support rep for a specific company, etc. Here’s how this action is set up inside recipes:
Tips on User Experience
OpenAI is a powerful tool, but responses can take a while (typically 5-30 seconds). In the free version of Uncanny Automator, actions in a recipe that come after OpenAI actions are blocked from running until we get a response from OpenAI. That way we can ensure that data from OpenAI is available to later actions before they run.
For user activities that involve OpenAI, waiting for the response could make the site seem briefly unresponsive. If this is an issue for your users, consider adding a delay to the OpenAI and subsequent actions. This causes the action to be scheduled for execution in the background, and the user won’t need to wait for the action to complete.
You can schedule the OpenAI action for 1-2 seconds after recipe completion, and any actions that rely on the OpenAI action for 45 seconds or longer to ensure the response is received by the time those actions run.
Generate WordPress blog posts with AI
Here’s a simple recipe that shows how you can use a form submission to generate new blog posts:
Here’s how the recipe works:
- The recipe uses a form submission trigger to start the automation.
- The OpenAI action sends the text in the Content Prompt field of the form to the GPT processor of OpenAI.
- This generates a response token with the AI-generated text that can be used in the subsequent Create a post action.
Voilà! An easy way to generate new blog posts with a simple front-end interface!
In addition to blog posts, the OpenAI integration can be used in recipes to generate:
- Email content
- Facebook, Twitter, LinkedIn content
- Support responses
- WhatsApp replies
- Product descriptions
- Forum replies
- And much more!
We’re excited to see what other uses our customers come up with for this next-generation integration.