Skip to main content

Description

Manage the storage of data associated with a user within your bot.
The user cache stores unique information about each person who interacts with your conversational experience and can be used within your skills to:
  • Associate operational data, such as an order number, to a user.
  • Allow the bot to know user properties before the conversation begins.
  • Store information needed to query internal or external services from specific skills.
Additionally, the cache enables shortcuts for default bot actions, such as:
  • Defining reactions or executing a skill before the user initiates the conversation (coming soon).

Get User Cache

Endpoint

GET https://api.jelou.ai/v1/users/{userId}/cache

Path Parameters

userId
string
required
User’s phone number (without the + sign).

Response Example

The response may include any data previously stored in the user’s cache.
{
  "groupId": "grp-67890",
  "orderNumber": "ORD-12345"
}

Set user cache

Endpoint

POST https://api.jelou.ai/v1/users/{userId}/cache

Path Parameters

userId
string
required
User’s phone number (without the + sign).

Request Body

params
object
Object with the data that will be merged with the user’s current cache.
botId
string
required
Identifier of the bot associated with the user.

Request Example

curl --request POST \
  --url https://api.jelou.ai/v1/users/{userId}/cache \
  --header 'Authorization: Basic <Base64Encoded clientId:clientSecret>' \
  --header 'Content-Type: application/json' \
  --data '{
    "params": {
      "groupId": "grp-67890",
      "orderNumber": "ORD-12345"
    },
    "botId": "bot-12345"
  }'

Response Example

{
  "message": [
    "User cache set successfully."
  ],
  "status": "success"
}

Common Errors

  • 400 - Could not get or update the user’s status.
  • 401 - Invalid or missing credentials.
  • 404 - User or bot not found.
  • 200 - Logic error when obtaining the cache (when status is “failed”).
The cache is merged with existing data. If you reuse already defined keys, their value will be overwritten. Make sure to maintain a consistent structure to avoid unexpected behavior in your skills.