https://discord.gg/botpress logo
Reset State via Code Execution
# 🤝help
c
I am upserting data to a KB Table in Botpress Cloud via the "client.upsertTableRows({...})" function. Since it contains many rows, I am upserting in chunks (50 rows each iteration). After 14 chunks or so, I receive a warning log: "State swap/conversation/convo-8/session.json is too big" I would like to reset or null the current state within my loop after each chunk being upserted. However, I couldn't figure out how, since I need a state ID and name to manipulate it (both for getState and setState: https://botpress.com/docs/api-reference/runtime-api/openapi/getState) Is there a way to either a) Disable the state recording temporarily or b) Reset the State at runtime with the Code Execution Card I appreciate your help!
p
To find your state IDs in Botpress Cloud, you need to know the state type, ID, and name. Here’s how you can identify them: 1. State Types Common types are: conversation, user, bot, integration, and workflow. 2. State IDs Conversation State: The ID is the conversation ID. User State: The ID is the user ID. Bot State: The ID is your bot ID. Workflow State: The ID is the workflow ID. You can retrieve these IDs programmatically in your bot code or via API: - Conversation ID and User ID are available in event/session variables during execution. - To list all conversations or users (and get their IDs), use the listConversations or listUsers endpoints. 3. State Names The state name is defined by your bot or integration when creating or updating state. If you’re not sure, check your code or integration definition. ref: https://botpress.com/docs/api-reference/runtime-api/concepts You should be able to reset the states in an execute code card with this information. Hope it helps!