Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function updateFaq() {
const response = await client.knowledgeBase.updateFaq({
context_id: 'ai-context-aaauajhjdgjnomr',
question: 'How do I connect my WhatsApp account?',
answer: 'You can connect your WhatsApp account by scanning the QR code in the Settings page.',
});
console.log(response);
}
updateFaq();curl -X PATCH \
https://api.periskope.app/v1/knowledge-base/faq/ai-context-aaauajhjdgjnomr \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"question": "How do I connect my WhatsApp account?",
"answer": "You can connect your WhatsApp account by scanning the QR code in the Settings page.",
}'{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect my WhatsApp account?",
"answer": "You can connect your WhatsApp account by scanning the QR code in the Settings page.",
"embedding": [
-0.020637017,
-0.0148050785,
0.02985098,
0.023778915,
"..."
],
"updated_at": "2025-01-20T11:00:00Z"
}Knowledge Base APIs
Update FAQ
Update an FAQ’s question and answer (regenerates embedding)
Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function updateFaq() {
const response = await client.knowledgeBase.updateFaq({
context_id: 'ai-context-aaauajhjdgjnomr',
question: 'How do I connect my WhatsApp account?',
answer: 'You can connect your WhatsApp account by scanning the QR code in the Settings page.',
});
console.log(response);
}
updateFaq();curl -X PATCH \
https://api.periskope.app/v1/knowledge-base/faq/ai-context-aaauajhjdgjnomr \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"question": "How do I connect my WhatsApp account?",
"answer": "You can connect your WhatsApp account by scanning the QR code in the Settings page.",
}'{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect my WhatsApp account?",
"answer": "You can connect your WhatsApp account by scanning the QR code in the Settings page.",
"embedding": [
-0.020637017,
-0.0148050785,
0.02985098,
0.023778915,
"..."
],
"updated_at": "2025-01-20T11:00:00Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The context ID of the FAQ to update
Example:
"ai-context-aaauajhjdgjnomr"
Body
application/json
The updated question
Example:
"How do I connect my WhatsApp account?"
The updated answer
Example:
"You can connect your WhatsApp account by scanning the QR code in the Settings page."
Optional array of embedding values
Example:
[
-0.020637017,
-0.0148050785,
0.02985098,
0.023778915,
"..."
]
Whether the FAQ is active (default: false)
Example:
true
Was this page helpful?