https://discord.gg/botpress logo
How to completely disable the automatic WhatsApp t...
# 🤝help
r
The Problem: I am consistently getting 500 errors because of a timeout on the whatsapp:stopTypingIndicator action. It seems Botpress is triggering this automatically, and when the API hangs, it waits for over 107 seconds before failing, which makes my bot unusable. Error Log: Error stopping typing indicator Ze [Error]: timeout of 107307ms exceeded data: '{"type":"whatsapp:stopTypingIndicator", ...}' My Questions: Since there is no toggle in the WhatsApp Integration settings, what is the official way to stop the bot from sending these typing events? Is there a way to reduce this 107s timeout? It’s far too long for a simple UI indicator. If I use a Before Outgoing Message hook to event.skip = true for typing events, will that stop the internal engine from attempting these API calls, or will it still timeout in the background?
l
Hey @red-motorcycle-9381 sorry for the troubles and thank you for reaching out! 🙂 According to the docs, the recommended way to stop these events is to use a Before Outgoing Message hook and skip the typing events.
r
Please can you guide me on how can I disable it via hook
l
// In a
beforeOutgoingMessage
hook if (event.type === "whatsapp:startTypingIndicator" || event.type === "whatsapp:stopTypingIndicator") { // Prevent the engine from sending the typing indicator to WhatsApp event.skip = true }
Will get help to confirm this, this is according to our docs AI agent, I am. Not 100% @User
r
@loud-crowd-60573 it is not working, reason being when I tried to log the event in the hook I found that event of type text are being logged but typing indicator events are not, which means that typing indicator events doesn't even come to hooks. I can't find any help on this and I am in urgent need of this because it's happening and disrupting my production system sometimes. Please help me out on how can I completely disable this typing indicator for whatsapp.
There should be a toggle in the configuration settings have you removed it ?
r
@loud-crowd-60573 I tried that but this typing indicator emoji is something else, when it's enabled there comes another eye emoji "👀" reaction on msg but didn't have anything to do with typing indicator. I mean even if I disable it it's only removing that emoji not the typing indicator.
l
The emoji represents the typing indicator on the Botpress side
The WhatsApp Cloud API does not expose a typing indicator feature. Therefore the Botpress WhatsApp integration cannot enable or disable a typing indicator.
r
@loud-crowd-60573 then why am I am getting this error in botpress sometimes Error Log: Error stopping typing indicator Ze [Error]: timeout of 107307ms exceeded data: '{"type":"whatsapp:stopTypingIndicator", ...}' I think botpress backend might be internally calling some way to the whatsapp which turns this indicator on and off.
And the problem is that this timeout is halting the flows execution for that user who is interacting with the bot for atleast 2 minutes minimum, which is much bothering and this can be confirmed by looking at logs in botpress. Only what user sent as msg to bot is visible in the log of botpress for example "hi", but after that this error of typing indicator is seen and no other log of any flow execution until 2-5 minutes. Note : this happens only sometimes like 2 out of 100 times. But it is exploiting the whole experience on the user side.
l
I'll ask team and double confirm
r
Hey @loud-crowd-60573 , I found the exact bug in botpress github code for the problem with WhatsApp integration that forces the typing indicator to stay on and also below msg would help in resolving it. Problem: In the Botpress repo, specifically in typing-indicator.ts (line 18), the markAsRead method is currently hardcoded to pass 'text' as the third parameter: This third parameter is nothing but typingIndicator itself which can be of type "text" or something else or undefined( if no typing indicator needed) https://github.com/botpress/botpress/blob/61613f9cccf542848cf47f9cd9bf8b0c2d22b8aa/integrations/whatsapp/src/actions/typing-indicator.ts#L18 Because this is hardcoded, the typing indicator is triggered every time a message is marked as read, even if the user wants it off.
Solution: --References-- Here is the breakdown from the underlying library and Meta's docs: The Library which botpress uses: whatsapp-api-js (line 434), if that third parameter is not passed, it remains undefined and is not sent in the API body: https://github.com/Secreto31126/whatsapp-api-js/blob/419716a3407cc0b8d672eb68d401a62919b98273/src/index.ts#L434 Meta Docs: Their Mark Message as Read and Typing Indicators docs show that the indicator is only triggered if that specific field is included in the payload. (doc links : https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/mark-message-as-read/, https://developers.facebook.com/documentation/business-messaging/whatsapp/typing-indicators) The Fix: We should make this parameter optional. If a user turns off typing indicators in the config, Botpress should not pass the 'text' string.
@User I hope this information is useful! If you’d like me to look into a fix or help out with a PR, just let me know—I’m happy to support however I can.
l
Thank you for sharing! Team is taking a look
r
Hi @loud-crowd-60573, please do let me know whenever the typing indicator issue is resolved. I’m really looking forward to using it! Thanks so much for your help.
l
Update @red-motorcycle-9381 We have pushed a PR to add this action! Will let you know future updates when we can.
I appreciate all the help!
7 Views