FAQ sync through API
This page will describe how you can use our GraphQL API to synchronize FAQ AI Knowledge with your systems, with the aim to use this knowledge in your generative AI bots.
Introduction
This feature allows to keep knowledge about FAQs up to date, by allowing you to send updates, creations and deletion operations about the FAQ information your system holds. Upon receiving these events, we'll index the new knowledge such that your bot can use the very latest information to answer your visitors' questions.
To do so, we'll look into how you can create a knowledge source (your FAQ), and insert, update and delete knowledge items (your FAQ information).
Step 1: Create a new KnowledgeSource
This operation will only need to be done once, therefore there is no need to write any code for it.
It consists in using GraphQL to create a new KnowledgeSource, and taking note of the identifier that was attributed to it. This identifier will be used during step 3.
You can open the GraphQL mutation by clicking on this link. You'll need to:
Be logged in as an administrator.
Replace the variables in the bottom panel with the identifier of your project, the name of the knowledge you're about to create ("API sync FAQ" for instance).
Execute the query by clicking the KnowledgeSourceCreate blue button.
Write down the identifier of the KnowledgeSource that will appear in the right panel.
Step 2: Synchronize your FAQs with us
Now you have a KnowledgeSource, you can add, update or delete items within that source. In order to do this, you'll need to react to events within your system and call our GraphQL API.
Create or update an FAQ item
You can use this mutation, bearing in mind you can submit up to 100 FAQs in a single mutation.
mutation KnowledgeFAQsUpsert($input: KnowledgeFAQsUpsertInput!) {
knowledgeFAQsUpsert(input: $input) {
upsertedFAQs {
faqId
status
}
}
}
{
"input": {
"knowledgeSourceId": "<id from step 1>",
"faqs": [
{
"id": "1",
"question": "How to return a product?",
"answer": "You must send it to <your address>"
}
],
}
}
Delete FAQ items
mutation KnowledgeFAQsDelete($input: KnowledgeFAQsDeleteInput!) {
knowledgeFAQsDelete(input: $input) {
deletedFAQs {
faqId
status
}
}
}
{
"input": {
"knowledgeSourceId": "<id from step 1>",
"faqIds": [
"<FAQ item id from your system to delete>"
]
}
}
Last updated
Was this helpful?