Back to Dashboard

Documentation

Learn how to use Asyntai

Payload CMS Integration

Add an AI chatbot to your Payload website that answers from your published content

Create Account

Overview

The payload-ai-chatbot plugin connects your Payload CMS website to an Asyntai AI chatbot. The chatbot answers your visitors around the clock, from your website and from the pages and posts you publish in Payload, and links them to the page with the answer.

Each time you publish, Asyntai receives the new version. When you unpublish or delete a document, Asyntai removes it. Your editors keep working in Payload, and your chatbot always answers from the current content.

How It Works

  • You add the plugin to your Payload config and name the collections the chatbot should know, such as pages, posts and FAQs.
  • You connect your Asyntai account from the Asyntai AI Chatbot screen in the Payload admin panel. Asyntai reads your website and prepares the first answers.
  • One component in your root layout shows the chat on every page of your website.
  • With your Asyntai API key, every published document goes to your Asyntai knowledge base with its page address. Rich text, blocks, arrays, tabs and groups all become text.
  • Saving a draft keeps the published version in the chatbot. Only changed text is sent again.

Requirements

  • Payload 3 with the Next.js admin panel.
  • An Asyntai account. The free plan is enough to put the chat on your website.
  • To send your Payload content to the knowledge base: an Asyntai Starter plan or higher, and an API key.

Installation

Follow these steps to add Asyntai to Payload:

1

Install the Plugin

pnpm add payload-ai-chatbot

npm and yarn work the same way.

2

Add It to Your Payload Config

Add the plugin to payload.config.ts. The url function tells the chatbot the public page of each document, so it can link visitors there.

import { asyntaiChatbot } from 'payload-ai-chatbot'

export default buildConfig({
  // ...
  plugins: [
    asyntaiChatbot({
      collections: {
        pages: { url: ({ doc }) => (doc.slug === 'home' ? '/' : `/${doc.slug}`) },
        posts: { url: ({ doc }) => `/posts/${doc.slug}` },
      },
    }),
  ],
})

The plugin adds a settings screen and one small table. Create a migration as for any schema change, then regenerate the admin import map:

pnpm payload migrate:create
pnpm payload generate:importmap
3

Show the Chat on Your Website

Add the component once to your root layout, for example src/app/(frontend)/layout.tsx, just before the closing </body>:

import config from '@payload-config'
import { getPayload } from 'payload'
import { AsyntaiChatbot } from 'payload-ai-chatbot/rsc'

// inside your layout component
const payload = await getPayload({ config })
// ...
<AsyntaiChatbot payload={payload} />
4

Connect Your Asyntai Account

In the Payload admin panel, open Asyntai → Asyntai AI Chatbot and press Connect Asyntai. Sign in to Asyntai, or create a free account, in the window that opens. The screen saves the connection by itself, and the chat appears on your website.

5

Send Your Content

Open API settings in Asyntai and create an API key. Add it to the environment of your Payload server and restart Payload:

ASYNTAI_API_KEY=your-api-key

Open the Asyntai screen in the admin panel again and press Send all published content now. From now on, every publish reaches your chatbot by itself.

Tip: Name only the collections your visitors need, such as pages, posts, products and FAQs. Your chatbot then answers from exactly the content you want customers to see.

What Happens on Each Change

  • Publish: the document is added to your knowledge base.
  • Update a published document: the new text replaces the old one.
  • Save a draft: the published text stays in the chatbot.
  • Unpublish or delete: the document is removed.

Options

  • collections: the collections to send, each with an optional url and titleField.
  • siteUrl: your public website address. Defaults to serverURL, then NEXT_PUBLIC_SERVER_URL.
  • websiteId: send content to a different Asyntai website than the connected one.
  • background: send after the save finishes. Use it only on a server that keeps running, not on serverless hosting.
  • disabled: turn the sync off and keep the settings screen.

Hiding the Chat

On the Asyntai screen in the admin panel, turn off Show the chatbot on the website and press Save. Your account stays connected. Press Disconnect to remove the connection.

Changing the AI Answers

Open your Asyntai dashboard to change the chat look, the AI instructions and the languages, and to read your conversations.

Plans & Pricing

The chat on your website works on all Asyntai plans, including Free. Sending your Payload content to the knowledge base needs the Starter plan or higher. View pricing.

Need Help?

If you have any questions or run into issues, contact us at [email protected].