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 createFaq() {
const response = await client.knowledgeBase.createFaq({
question: 'How do I connect WhatsApp?',
answer: 'You can connect WhatsApp by scanning the QR code in Settings.',
attachments: ['https://example.com/image.png']
});
console.log(response);
}
createFaq();curl -X POST \
https://api.periskope.app/v1/knowledge-base/faq/create \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": ["https://example.com/image.png"]
}'{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": [
"https://example.com/image.png"
],
"created_at": "2025-01-20T10:00:00Z",
"updated_at": "2025-01-20T10:00:00Z"
}Knowledge Base APIs
Create FAQ
Create a new FAQ entry in the knowledge base
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 createFaq() {
const response = await client.knowledgeBase.createFaq({
question: 'How do I connect WhatsApp?',
answer: 'You can connect WhatsApp by scanning the QR code in Settings.',
attachments: ['https://example.com/image.png']
});
console.log(response);
}
createFaq();curl -X POST \
https://api.periskope.app/v1/knowledge-base/faq/create \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": ["https://example.com/image.png"]
}'{
"context_id": "ai-context-aaauajhjdgjnomr",
"type": "faq",
"question": "How do I connect WhatsApp?",
"answer": "You can connect WhatsApp by scanning the QR code in Settings.",
"attachments": [
"https://example.com/image.png"
],
"created_at": "2025-01-20T10:00:00Z",
"updated_at": "2025-01-20T10:00:00Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?