N8N Tools - Botpress API icon

N8N Tools - Botpress API

Complete Botpress integration - Enterprise conversational AI with advanced NLP

State → Set State

AI-generated

Overview

The node integrates with the Botpress conversational AI platform, specifically managing conversation state variables when using the Set State operation under the State resource. It allows users to update or set state variables for a specific conversation by sending JSON-formatted data representing the new or updated state.

This is useful in scenarios where you want to programmatically control or modify the context or memory of a conversation, such as storing user preferences, tracking progress through a dialog, or saving temporary data that influences bot behavior.

Practical example:
You have a chatbot running on Botpress and want to update the user's current step in a multi-step form. Using this node, you can set a state variable like { "currentStep": 3 } for the conversation, so the bot knows which question to ask next.


Properties

Name Meaning
Conversation ID The unique identifier of the conversation whose state you want to set.
Additional Fields A collection of optional fields to customize the state update:
- Tags Comma-separated list of tags (not used directly in Set State but available in additionalFields).
- Integration Channel Name of the integration channel (e.g., telegram, slack).
- User Name Display name for the user.
- User Picture URL Profile picture URL for the user.
- Metadata Additional metadata as a JSON object (not directly used in Set State).
- State Variables JSON object containing the state variables to set or update. This is the main payload for the Set State operation.
- Event Type Type of event to create (not used in Set State).
- Event Payload Event payload as JSON (not used in Set State).
- Quick Replies Comma-separated list of quick reply options (not used in Set State).
- Actions Card/message actions as JSON array (not used in Set State).
- Limit Maximum number of results to return (not used in Set State).
- Page Token Token for pagination (not used in Set State).

Output

The node outputs the response from the Botpress API after setting the state variables. The output is a JSON object reflecting the updated state or confirmation of the update.

  • The json field contains the API response, typically including the updated state data.
  • No binary data output is produced by this operation.

Example output snippet (conceptual):

{
  "state": {
    "currentStep": 3,
    "userPreference": "darkMode"
  }
}

Dependencies

  • Requires an active Botpress API credential with:
    • An API key credential.
    • API URL endpoint.
    • Access token for authorization.
    • Bot ID to specify which bot instance to interact with.
  • The node sends authenticated requests to the Botpress API via a proxy service.
  • Proper configuration of these credentials in n8n is necessary for successful execution.

Troubleshooting

  • Common issues:

    • Invalid or missing conversation ID will cause the API call to fail.
    • Malformed JSON in the "State Variables" property will result in parsing errors.
    • Insufficient permissions or invalid API tokens may lead to authorization errors.
    • Network connectivity problems to the Botpress API endpoint or proxy service.
  • Error messages:

    • "Unknown state operation: setState": Indicates a misconfiguration or unsupported operation; ensure the operation is correctly set to "Set State".
    • JSON parse errors when providing state variables: Validate JSON syntax before input.
    • Authorization errors: Verify API keys and tokens are correct and have required scopes.
    • If the node returns an error JSON, enabling "Continue On Fail" allows workflow continuation with error details.

Links and References

Discussion