Skip to main content

Integrating with Docusaurus

This guide explains how to integrate FormAgent.ai with your Docusaurus site. By doing so, you can provide an AI assistant to your Docusaurus site visitors.

Prerequisites

  • You have a Docusaurus project set up
  • You have a FormAgent.ai account
  • You have obtained your Agent ID

Integration Steps

1. Configure docusaurus.config.js

Open your docusaurus.config.js file and add or edit the scripts section as follows:

const config = {
title: 'Your Site',

scripts: [
{
id: 'formagent-script',
src: 'https://formagent.ai/embed.js',
async: true,
defer: true,
'data-agent-id': 'YOUR_AGENT_ID', // Agent ID from FormAgent.ai
},
],

// Other settings
presets: [
// ...
],
};

module.exports = config;

2. Explanation of Settings

ParameterDescription
idUnique identifier for the script
srcURL of the FormAgent.ai embed script
asyncEnables asynchronous script loading
deferEnables deferred script loading
data-agent-idAgent ID obtained from FormAgent.ai

Verifying Operation

  1. After saving your changes, rebuild your Docusaurus site:
npm run build
  1. Start the development server to check:
npm run start
  1. Open your site in a browser and confirm that the FormAgent.ai chat widget appears.

Troubleshooting

If the Chat Widget Does Not Appear

  1. Check for error messages in the browser console
  2. Confirm that your Agent ID is set correctly
  3. In the network tab, verify that embed.js is being loaded

Support

If you still have issues, you can get support in the following ways: