https://discord.gg/botpress logo
writing to a variable doesn't work
# 🤝help
b
The bot worked for three months without changes or errors. WhatsApp integration. A week ago, errors appeared. In the emulator, the response is written to the variable without errors. But if I repeat the action in WhatsApp, the value is not written to the variable. I definitely haven't changed anything in the bot; the problem is on the BotPress side.
I'm an experienced user who's been creating bots on BotPress for over three years. I've tried every possible solution. I've changed field types, written variables through code, but nothing works. Expression cards don't work because the variable doesn't have any values.
l
Whats your workspace ID?
@breezy-piano-23067
Will ask for some insight and get back!
g
Hey @breezy-piano-23067, What response do you want to write in a variable ? Is it from an action ? If so which one is it ? We will want to reproduce the issue on our side to debug, so if you can give us reproduction steps it would be appreciated.
b
Here's the sequence of actions: 1. The user enters a number using the "numer@" card. 2. Next, an expresion is used to redirect it to the correct branch. 3. No expresion works because the data isn't written to the variable. 4. I tried workarounds like using text instead of text, but it didn't help. 5. For some unknown reason, the user's response data, entered through WhatsApp integration, isn't written to the variable. Important! Everything works flawlessly in the emulator.
wkspace_01JV2J73SAFDHC7HGWKQ85KEAX
Now I've come up with this: 1. I take any answer 2. I write it to a variable through code (workflow.num_admin = event.preview) 3. Then I use the value of that variable in the expression It works for now, but the previous version also worked and then broke https://cdn.discordapp.com/attachments/1491107429457592653/1492058859668373616/image.png?ex=69d9f399&is=69d8a219&hm=b44f39673edb62f910cc8335b1e067d75200fbe202158a9ed9a1102eee559f28&
My guess is that there's a bug with the WhatsApp integration. My client has one administrator account, but three people work there—one on a smartphone, one on a desktop, and one on the web version. Something breaks when the admin user writes a response, but the value isn't written to the variable.
I'd also like to add the ability to end all conversations in the integration. If we have WhatsApp integration, any update will only apply to new conversations. If a user has a critical error in a conversation, we won't be able to resolve it with an update, and we need the user to end the conversation and start a new one. Often, users can't end a conversation due to an error, and the timeout is set to 5 hours. We need the ability to end conversations for specific users through the bot administrator so that updates are applied immediately.
I see it in the logs
Copy code
Apr 10, 2026, 12:48:03 PM
[1a27e9856b]    [dm]    :     Waiting for user input
Apr 10, 2026, 12:48:03 PM
[1a27e9856b]    [dm]    :     Saved states: agentsConversationVariables, agentsWorkflowsVariables, userVariables, context, session, conversation (Conversation: conv_01K8QKEHS1FQGXFN0YXYYZ3NEA)
Apr 10, 2026, 12:48:03 PM
[1a27e9856b]    [dm]    :     Running hook after_incoming_message for plugin conversation-insights
Apr 10, 2026, 12:48:03 PM
[1a27e9856b]    [dm]    :     Stack trace for event
I don't use the conversation-insights plugin!! Next comes this in the logs
Copy code
Apr 10, 2026, 12:48:03 PM
[1a27e9856b]    [dm]    :     FINISHED PROCESSING MESSAGE
Apr 10, 2026, 12:48:04 PM
[b42a489a9c]    [dm]    :     Event of type whatsapp:messageSent received.
Apr 10, 2026, 12:48:06 PM
[84f4a7cf9a]    [dm]    :     Event of type whatsapp:messageSent received.
Apr 10, 2026, 12:48:06 PM
[da209e26f9]    [dm]    :     Event of type whatsapp:messageDelivered received.
Apr 10, 2026, 12:48:06 PM
[d00b22fa19]    [dm]    :     Event of type whatsapp:messageDelivered received.
Apr 10, 2026, 12:48:07 PM
[a7b760f942]    [dm]    :     Event of type whatsapp:messageRead received.
Apr 10, 2026, 12:48:07 PM
[c8d8cfa5eb]    [dm]    :     Event of type whatsapp:messageDelivered received.
Apr 10, 2026, 12:48:08 PM
[95751b1a94]    [dm]    :     Event of type whatsapp:messageRead received.
and lately I've been seeing this in the emulator logs
Cannot save state agentsUserVariables for user because the ID is missing ({"bot":"e87b6072-2691-4da4-ac48-41bda22c43","user":"","conversation":""})
I found the root of the problem. How can I solve it? https://discord.com/channels/1108396290624213082/1492511471790461040
7 Views