Skip to main content
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();
{
  "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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
question
string
required

The FAQ question

Example:

"How do I connect WhatsApp?"

answer
string
required

The FAQ answer

Example:

"You can connect WhatsApp by scanning the QR code in Settings."

Response

201 Created

context_id
string

The unique identifier for this FAQ

type
string

Type of entry (faq)

question
string

The FAQ question

answer
string

The FAQ answer

embedding
array

The vector embedding of the FAQ (Dimension: 768)

attachments
array

Array of attachment URLs

created_at
string

Creation timestamp