Behio Storefront SDK
Catalog & Products

FAQ

Questions and answers the owner writes in Behio in every language of the site, read by the website and used by the AI chat

FAQ is a module of the Behio admin (Web or E-shop, FAQ): the owner splits questions into groups such as Shipping, Payments or Returns and writes every question and answer in each language of the site. The same questions feed the website, search engines (FAQPage structured data) and, with one switch, the AI chat knowledge. An edit is live without a new deploy.

FAQ endpoints work with both e-shop keys and website keys, so a company website without a shop can use them too. Available since SDK 2.21.0.

List the groups

const { data, error } = await client.faq.list();
if (error) throw new Error(error.message);

// data.items: [{ id, slug: 'shipping', name: 'Shipping', description, itemCount: 6 }]
// data.locale: the language the names are in

client.faq.list(query?: { locale?: string }): Promise<SdkResult<StorefrontFaqGroups>>

Read one group

import { errorCode } from '@behio/storefront-sdk';

const { data: faq, error } = await client.faq.get('shipping');
if (errorCode(error) === 'be.faq.groupNotFound') return null;
if (error) throw new Error(error.message);

// faq.name, faq.description
// faq.items: [{ id, question: 'How long does shipping take?', answer: '<p>Two working days.</p>' }]

client.faq.get(group: string, query?: { locale?: string }): Promise<SdkResult<StorefrontFaqGroup>>

  • group is the slug the owner sees in the admin (stable, use it in code) or the group id.
  • Only visible questions are returned, in the order the owner set in the admin. Hidden questions never leave Behio.
  • answer is sanitised HTML (paragraphs, emphasis, links, lists). Render it with RichText.
  • Texts come in locale (defaults to the client locale). A question without a translation falls back to the main language of the site, so a page is never empty.
  • The response is cached by Behio and invalidated on every change in the admin, so fetch it server-side on every request without your own cache.

Render it with structured data

import { RichText } from '@behio/storefront-sdk/react';
import { errorCode } from '@behio/storefront-sdk';

export default async function Faq() {
  const { data: faq, error } = await client.faq.get('shipping');
  if (errorCode(error) === 'be.faq.groupNotFound') return null;
  if (error) throw new Error(error.message);
  if (!faq?.items.length) return null;
  const jsonLd = {
    '@context': 'https://schema.org',
    '@type': 'FAQPage',
    mainEntity: faq.items.map((item) => ({
      '@type': 'Question',
      name: item.question,
      acceptedAnswer: { '@type': 'Answer', text: item.answer },
    })),
  };
  return (
    <section>
      <h2>{faq.name}</h2>
      {faq.items.map((item) => (
        <details key={item.id}>
          <summary>{item.question}</summary>
          <RichText html={item.answer} />
        </details>
      ))}
      <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd).replace(/</g, '\\u003c') }} />
    </section>
  );
}

Put one FAQPage object per page and only the questions the page really shows. Behio Themes websites do this automatically. Escape < in the serialized JSON so merchant text cannot close the script tag. Only a missing group or a successful empty response should hide the section; handle other failures with the page's error and retry UI.

React hooks

import { useFaqGroups, useFaqGroup } from '@behio/storefront-sdk/react';

const { data: groups } = useFaqGroups();
const { data: shipping } = useFaqGroup('shipping');

Prefer the server-side client.faq.get for the first render; the hooks are for parts that load later.

Writing questions

Questions are written in the Behio admin (Web or E-shop, FAQ), in the mobile app, or by an AI agent through the Behio MCP tools site-faq-groups-list, site-faq-group-create-update and site-faq-items-upsert. On a Behio Themes website the FAQ section and the FAQ block choose which group (or which questions) they show. See Build with AI.

On this page