Integrating Wix Chat with ChatGPT via API can elevate customer engagement on your Wix website, providing visitors with real-time assistance and a seamless conversational experience. In this guide, we’ll walk through the steps to connect Wix Chat’s live chat capabilities with the powerful AI of ChatGPT, enabling automated responses that enhance user interaction, improve response times, and keep your visitors engaged around the clock.
Achieve reliable response times for your live chat without the need to hire dedicated 24/7 support staff.
Start With Wix Chat
Wix Chat is a native application/plugin developed by the Wix team, designed to enable real-time conversations on your site. For this integration, you’ll use the wix-chat-backend
Velo API, specifically leveraging the sendMessage()
function to send replies back to users on the frontend. This function is based on the channelId
created each time a user initiates a chat, which serves as a unique identifier for each conversation. The backend event onMessage()
captures every message sent by a user on the frontend, allowing your application to interact seamlessly with user queries.
Since conversation history cannot be stored in memory alone, utilizing Wix Databases (CMS) is essential to maintain records of each chat. To best organize this data, store channelId
in a dedicated column and each message in a separate column. This structure enables easy querying of the entire chat history based on a single variable, ensuring you can reference previous exchanges if needed.
OpenAI
For this project, you’ll employ OpenAI’s text-davinci-003
model. Begin by setting an initial prompt such as, “You are a customer support agent for my company X, which specializes in Y. Please respond to customer inquiries.” This can then be followed by the user’s message for context. It’s recommended to review OpenAI’s documentation to set additional parameters for optimal results.
To relay GPT’s response back to the user, use the sendMessage()
function previously discussed. For the AI to retain context, assign a user ID for each visitor. This can be done with the Wix Users function on the frontend or by generating a unique user ID and storing it locally using the Wix Session API.
Wrapping Up
If you need further assistance, feel free to contact us via our website’s contact form. We’ll be happy to discuss your requirements and provide a quote.