For the complete documentation index, see llms.txt. This page is also available as Markdown.

Botpress

Botpress is an open-source platform for building AI-powered chatbots and conversational agents with a visual workflow builder.

Prerequisites

Configuration

Botpress uses the Execute Code card to make HTTP requests to external APIs like TensorX. This method gives you full control over the API integration.

Botpress has built-in AI models, but you can use the Execute Code card to integrate custom OpenAI-compatible providers like TensorX.

Method: Execute Code Card

Step 1: Create a Workflow

  1. Open your bot in Botpress Studio

  2. Create a new workflow or open an existing one

  3. Add a node where you want to call the AI

Step 2: Add Execute Code Card

  1. Click + to add a new card

  2. Select Execute Code

  3. This opens the code editor

Step 3: Write the API Call

Step 4: Set Environment Variable

  1. Go to Chatbot SettingsVariables

  2. Add a new Secret variable named TENSORX_API_KEY

  3. Paste your TensorX API key

Step 5: Display the Response

After the Execute Code card:

  1. Add a Text card

  2. Set the content to: {{workflow.aiResponse}}

Building a Complete Chatbot

Basic AI Chatbot Flow

  1. Start Node: Entry point of the conversation

  2. Capture: Stores user message in event.preview

  3. Execute Code: Calls TensorX API

  4. Text Card: Shows the AI response

Multi-Turn Conversation

For conversations with memory:

Example Implementations

Customer Support Bot

Intent Classifier

Use AI to classify user intent:

Then use Expression transitions to route based on workflow.userIntent.

FAQ Bot with Knowledge Base

For Coding Tasks:

  • z-ai/glm-5.1 - Best for tool calling and structured outputs

  • minimax/minimax-m2.5 - Best for complex reasoning tasks

Model ID
Best For

deepseek/deepseek-chat-v3.1

General conversation

z-ai/glm-5.1

Intent classification, structured output

minimax/minimax-m2.5

Complex reasoning

moonshotai/kimi-k2.5

Vision, long context

Error Handling

Add try-catch for robust error handling:

Best Practices

1. Use Environment Variables

Never hardcode API keys. Use Botpress secrets:

  • env.TENSORX_API_KEY

2. Set Appropriate Timeouts

AI responses can take a few seconds. Set reasonable timeouts:

3. Limit Conversation History

For multi-turn conversations, limit history to prevent token overflow:

4. Handle Edge Cases

  • Empty user messages

  • Very long messages

  • API failures

Troubleshooting

"axios is not defined"

Axios is available globally in Botpress Execute Code. If you get this error:

  • Check for typos in axios

  • Ensure you're using await for the API call

API Key Not Working

  • Verify the secret variable name matches: env.TENSORX_API_KEY

  • Check the key at app.tensorx.ai

  • Ensure there are no extra spaces

Timeout Errors

  • Increase timeout value

  • Use a faster model

  • Reduce max_tokens for quicker responses

Response Not Displaying

  • Check the variable name: workflow.aiResponse

  • Ensure the Text card references {{workflow.aiResponse}}

  • Debug by logging: console.log(response.data)

Support

Need help? Contact us at support@tensorx.ai

Last updated

Was this helpful?