- Published on
How to Integrate an OpenAI Chatbot into Wordpress - Step-by-Step Guide
- Authors
- Name
- Jai
- @jkntji
Integrating an OpenAI chatbot into your Wordpress site is easy and does not require extensive coding skills. With just a few simple steps, your Wordpress site will have an interactive chatbot powered by OpenAI. This guide shows you exactly how to add a chatbot to a Wordpress site using HTML provided by Predictable Dialogs. You can add an OpenAI Chatbot to your Wordpress site very easily by inserting a few lines of html in your Wordpress site. You don't even have to write the html, but use the generated html from the predictable dialogs app.
Haven't created your openai assistant yet? Check out our comprehensive guide to get started. If you’ve already generated your html using the predictable dialogs app, keep reading!
OpenAI Chatbot For Wordpress
This will be a two-step process of generating the JS needed to embed on your website and adding it on your wordpress site.
Generate embed code for wordpress
To embed your OpenAI Assistant on your website, follow these steps:
Login to Predictable Dialogs:
- Go to create agents and click on the first option, i.e., “Open AI Assistant v2”.
- You will then be taken to a screen with a drop down, in which you select + Enter new assistant.
Input OpenAI API Key:
- Enter your OpenAI API Key in the input field. Your API keys are encrypted and stored securely.
Input OpenAI Assistant ID:
- Enter your OpenAI Assistant ID in the next input window.
Thats it. You would now have the HTML code which you could use to embed the openAI assistant to your website.
Embed on Your Wordpress Website
You have two easy options:
Method 1: Wordpress Site Editor
- Go to Appearance → Editor → Pages.
- Choose "Add New Page", and title it (e.g., "OpenAI Chatbot").
- Select "Type / to choose a block", a "+" would show, click on it and select **Custom Html"
- Paste the chatbot code.
- Click Publish.
- Click on "View Page" Icon to interact with your new chatbot.
Similarly the custom HTML can be added to the templates and other places in Wordpress where html can be added.
Method 2: Use WPCode Plugin
WPCode plugin simplifies Wordpress OpenAI integration:
- Install the WPCode plugin (formerly "Insert Headers and Footers").
- Go to WPCode → Code Snippets → Add New.

- Select "Add Your Custom Code (New Snippet) as shown in the image.
- Select "HTML Snippet" from the options as shown in the image.
Give it a title (e.g., "Wordpress open ai").
Paste the generated OpenAI Wordpress Script.
<script type="module"> import Agent from 'https://cdn.jsdelivr.net/npm/@agent-embed/js@latest/dist/web.js' Agent.initStandard({ agentName: 'Assistant OpenAI-e042a', apiHost: 'https://app.predictabledialogs.com/web/incoming', initialPrompt: 'Hi', }) </script> <agent-standard style="width: 100%; height: 600px;"></agent-standard>

- Toggle "Activate" and click "Save Snippet".
- Visit your website—the Wordpress OpenAI chatbot is now live!
Now your Wordpress site has a fully integrated, interactive chatbot, enhancing user experience and engagement.
Thanks for reading, and enjoy your new Wordpress OpenAI chatbot!
FAQ: Adding an OpenAI Chatbot to WordPress
How do I add a chatbot to my WordPress site?
You can easily add a chatbot to your WordPress site by generating embed code using Predictable Dialogs and inserting the provided HTML into your WordPress editor or by using the WPCode plugin.
Can I add an OpenAI chatbot to WordPress without coding?
Yes, you can integrate an OpenAI chatbot into your WordPress site without coding. Simply copy and paste the generated HTML code from the Predictable Dialogs app into your WordPress pages or use the WPCode plugin.
What plugin can I use to add custom chatbot code to WordPress?
The WPCode plugin (formerly Insert Headers and Footers) is recommended for easily adding custom HTML snippets, including chatbot code, to your WordPress site.
Is adding an OpenAI chatbot to WordPress free?
While WordPress integration itself is free, you will need an OpenAI API key, which typically involves costs based on your OpenAI usage. The WPCode plugin and Predictable Dialogs HTML embed methods mentioned are free.
Where do I place chatbot HTML code in WordPress?
You can place chatbot HTML code directly into pages using the WordPress Site Editor (Appearance → Editor → Pages) or insert it globally using the WPCode plugin under "Custom HTML Snippets."
What details do I need from OpenAI to embed a chatbot?
You'll need your OpenAI API Key and your OpenAI Assistant ID, which you enter into Predictable Dialogs to generate the HTML embed code.
Can I customize the chatbot's appearance on my WordPress website?
Yes, you can customize aspects like chatbot size and position by adjusting the provided HTML embed code or through settings in the Predictable Dialogs platform.
Why should I integrate an OpenAI chatbot into my WordPress site?
Integrating an OpenAI chatbot enhances user engagement by providing instant, automated responses to visitors, improving customer experience and website interaction.