Home / All Integrations / Strapi

free

Connect Strapi to your chatbot

Use Strapi as a chatbot backend


Use a Strapi Headless CMS instance as your custom chatbot backend

Description

Strapi makes it easy to create powerful headless backends. Using this App, you will be able to connect your bot to your Strapi instance and manage your content directly inside Strapi.

To get started, simply retrieve your Strapi instance endpoint and a Public user's credentials.

Usage

This App only allows read-only access to your Strapi instance and requires that you set the correct permissions on your configured user and role. For more information about users and roles, please refer to this section of the Strapi API documentation.

This App is a thin wrapper on top of Strapi's API. To query your data, you will need to reach it using its GET endpoints and optional parameters. You can find Strapi's documentation about endpoints and parameters on their website. Only GET requests are available.

Below is a sample code example for querying the first 10 items from the Kittens collection, sorted by ascending price, with a maximum price value of 42, and where the title field contains the word blue.

do App(
  "strapi",
  endpoint="/kittens",
  parameters={"_sort": "price:ASC", "price_lte": "42", "title_contains": "blue", "_limit": "10" }
)

Auth

This App also contains a special auth method that allows you to simply retrieve the authenticated user's JWT and perform subsequent methods using pure CSML HTTP requests. The above request would hence translate to:

do auth = App(
  "strapi",
  method="auth"
)

do kittens = HTTP("{{STRAPI_URL}}/kittens").get().set({"Authorization": "Bearer {{auth.data.jwt}}"}).query({"_sort": "price:ASC", "price_lte": "42", "title_contains": "blue", "_limit": "10" }).send()

Join the Community
on Slack Slack

Come and learn all about CSML with other chatbot enthusiasts on the CSML Community Slack! 🤗