Integrate powerful FAQ management into your applications with our simple, REST-based API. Get started in minutes.
Install our TypeScript/JavaScript client for easy integration:
npm install @reasked/node
# or
yarn add @reasked/node
# or
pnpm add @reasked/node
Create a client instance with your API token:
import { Reasked } from '@reasked/node';
const reasked = new Reasked('your-api-key');
Retrieve FAQ groups with all their questions and answers:
// Get FAQ group by slug
const response = await reasked.faq.getFaqGroupBySlug('getting-started', {
status: 'published', // 'all', 'draft', or 'published'
langs: ['en', 'de'] // optional language filter
});
if (response.status === 'success') {
const group = response.data;
console.log('Group:', group.translations[0].name);
console.log('FAQs:', group.faqs.length);
// Access individual FAQs
group.faqs.forEach(faq => {
faq.translations.forEach(translation => {
console.log('Q:', translation.question);
console.log('A:', translation.answer);
});
});
}
// Or get by ID
const responseById = await reasked.faq.getFaqGroupById('00000000-0000-0000-0000-000000000000', {
status: 'published',
langs: ['en']
});
Here's what you'll receive when fetching an FAQ group:
{
"status": "success",
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"status": "published",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:22:00Z",
"translations": [
{
"id": "trans-456",
"name": "Getting Started",
"description": "Basic setup and configuration",
"lang": "en",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
],
"faqs": [
{
"id": "faq-789",
"status": "published",
"position": 1,
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-20T14:22:00Z",
"translations": [
{
"id": "faq-trans-101",
"question": "How do I get started?",
"answer": "Simply sign up for an account and follow our quick start guide.",
"lang": "en",
"createdAt": "2024-01-15T10:35:00Z",
"updatedAt": "2024-01-20T14:22:00Z"
}
]
}
]
}
}
The API uses consistent error responses:
// Error handling
try {
const response = await reasked.faq.getFaqGroupBySlug('non-existent');
if (response.status === 'error') {
console.error('API Error:', response.message);
return;
}
// Handle success
console.log(response.data);
} catch (error) {
console.error('Network Error:', error.message);
}
Create a React component to display FAQs:
import { useState, useEffect } from 'react';
import { Reasked } from '@reasked/node';
const reasked = new Reasked(process.env.REASKED_API_KEY);
export function FAQList({ groupSlug }) {
const [faqs, setFaqs] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchFAQs = async () => {
const response = await reasked.faq.getFaqGroupBySlug(groupSlug, {
status: 'published'
});
if (response.status === 'success') {
setFaqs(response.data.faqs);
}
setLoading(false);
};
fetchFAQs();
}, [groupSlug]);
if (loading) return <div>Loading...</div>;
return (
<div className="faq-list">
{faqs.map(faq => (
<div key={faq.id} className="faq-item">
<h3>{faq.translations[0].question}</h3>
<p>{faq.translations[0].answer}</p>
</div>
))}
</div>
);
}
Use server-side rendering for better SEO:
import { Reasked } from '@reasked/node';
const reasked = new Reasked(process.env.REASKED_API_KEY);
export default async function FAQPage({ params }) {
const response = await reasked.faq.getFaqGroupBySlug(params.groupSlug, {
status: 'published',
langs: [params.lang]
});
if (response.status === 'error') {
return <div>Error loading FAQs</div>;
}
const group = response.data;
return (
<div>
<h1>{group.translations[0].name}</h1>
<p>{group.translations[0].description}</p>
{group.faqs.map(faq => (
<article key={faq.id}>
<h2>{faq.translations[0].question}</h2>
<div dangerouslySetInnerHTML={{
__html: faq.translations[0].answer
}} />
</article>
))}
</div>
);
}
Keep it secret, keep it safe
You can find it in your ReAsked dashboard
Default: 30000ms (30 seconds)
Configure request timeout for your needs
Default: 3 attempts
Automatic retry with exponential backoff
Sign up for a free account and get your API token. Start integrating FAQs into your application today.