Guides / Articles

Node.js SDK/Guides

Articles

Articles

Search and list knowledge base articles for the website identified by your API key. Use this to power in-app help, pre-ticket suggestions, or your own support UI.

List categories

Returns every knowledge base category, including nested articles and topics.

const categories = await meridesk.articles.listCategories();

for (const category of categories) {
  console.log(category.name);
  for (const article of category.articles) {
    console.log(`  ${article.title}`);
  }
}

Search articles

Full-text search across article titles and topics.

const results = await meridesk.articles.search('refund policy');

for (const result of results) {
  console.log(result.article.title, 'in', result.category.name);
}

The q query parameter is required. An empty search string returns a 400 error.

Typical use

Suggest articles before opening a ticket:

app.post('/api/support/suggest', async (req, res) => {
  const results = await meridesk.articles.search(req.body.query);
  res.json({ results });
});

Next Steps