https://discord.gg/botpress logo
Whatsapp starter - NEED HELP!
# 🤝help
b
I am developing a bot that actively starts a conversation on WhatsApp with a lead and is able to respond to its questions. The way I set it up currently is webhook trigger (with lead data inc. number) -> Standard node with whatsapp starter + wait for answer -> Autonomous node to carry on the conversation -> tag whatsapp conversation with custom code Questions: - Will this bot be answering to people in other conversations from this whatsapp account? - Why is it going back to the start node, even tohugh it is not connected to anything (I want only the webhook trigger to start he flow) Am I missing something here?
l
The bot should answer questions to users. Your conversation from the webhook will end at the WhatsApp starter card. As during this phase the conversation with the user is not established. Also you might be attaching a conversationId to the trigger that is static from an earlier conversation and it is only scoped to that user. When the user responds it will start from the start node as the conversation establishes when the user responds for the first time. Hope this answers the behaviour
b
Huge thanks Lijo!
s
hi hi i had the same issue with william so you are saying that, when i use botpress standard node, put a whatsapp start conversation card and send message, botpress do not identify a conversation has started by default ya? that's why when the user reply on whatsapp, it will go to the start node? if that's the case, is there any default way or built in way that botpress can identify if this user is answering to the whatsapp message sent by the whatsapp start conversation card? OR i will need to manually save the conversation ID from the whatsapp start conversation card, and send a request to my bot's webhook, and trigger the next node from there? because i do not want the bot to trigger the start node... else another way i can think of is to set a check RIGHT after the start node to confirm that the user is replying to the message sent by the whatsapp start conversation card... ... i start to think using botpress start conversation card is not really a good idea here... but i DO need the conversation ID from botpress to resume the conversation...
l
You really do not have any options here and it is not about Botpress, but WhatsApp and the use case of Template Message Card
s
right 😦 hmm let me think of how to solve this... if simple workflow is still fine, but if i need my bot to send a lot of whatsapp starter message, the debugging will be really scary after that (like, how do i know user A is replying to whatsapp starter A, if all is going back to start node)
s
Hi guys!!! @blue-lamp-6042 how did you work your way around this??? @steep-processor-45408 ??
s
Hi yes i did found a better way to do this Will record a video on this soon
s
Great!!!!
s
here @swift-spoon-5391

https://youtu.be/pH9ZCT2JT94▾

https://discord.com/channels/1108396290624213082/1400481002228285480
l
have you tested this to work with multiple phone number? In your video you took a static conversationId and used it to send you a message. However, for each new WhatsApp number interating with the bot in botpress there will be a different conversationId. Also, after sending the template message the business still cannot do a free text conversation with the user, unless the user replied with a message back - opening the 24 hour window with the business I am not 100% sure is that it right- when you sent the start conversation message in the beginning of the video, you received a conversationId that you displayed in the emulator. typically in the emulator all conversationId starts like convo_1,2,3... You received the correct conversationId, this is because you had previously interacted with the bot, and hence you were able to search the conversation in events. So, I doubt when you send a template message to a new WhatsApp number using start conversation that has never interacted with the bot or send the template message using pabbly, botpress will create a new conversationId or allow the user to interact with the bot using the same static conversationId for all WhatsApp number
s
I've tested this with 200 phone numbers, and we are gonna be doing more soon. And yes u are right on the 24 hours window. So from user perspective we are waiting them to respond after the first message. Botpress will create a new conversation Id for new numbers. The 200 numbers I mentioned are all new numbers. They are not static, because of the get or create API from botpress. Can give it a test 👍🏻 we are running ads and soon doing this to more new phone numbers already
One more thing to note @limited-pencil-78283 If u are handling people from multiple countries Make sure before u send the phone number into get or create API, u clean up the phone number in a fix format I tried before sending +60xxxx or 60xxxx into WhatsApp API, it will still get send out with + or not But from botpress, they treat it differently. And will accidentally request a new conversation ID. So make sure its cleaned up properly before passing into botpress, and use the same format moving on, so that ur things don't haywire
l
While in theory it works, conversationIds are not created for the new numbers till they reply, however it does not change anything since sending template messages work from any conversationId
s
If conversation Id are only created for new numbers till they reply Why can we use whatsapp starter card and send to new number and still get conversation Id then? 🤔
l
for every new number? then I may be wrong
s
Amazing, thank youuu
b
Hello all, hope u are well! I'm trying to use the createConversation endpoint of the Runtime API. When I run this snippet in the terminal: Bash curl --request POST \ --url https://api.botpress.cloud/v1/chat/conversations/ \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $BAK" \ --header "x-bot-id: $BOT_ID" \ --data '{ "integrationName": "whatsapp", "channel": "channel", "tags": { "whatsapp:userPhone": "85265738671", "whatsapp:botPhoneNumberId": "7122628786784366" } }' I get the following output: JSON {"id":"36356d64b583d44e98442c37e64d4997","code":403,"type":"Forbidden","message":"Bot "d343faf4-9e32-b046-6973a3d24" cannot create conversations for channel "channel" of integration "intver_01JZTQH453N747KN3YQCE""} Why am I not able to create a conversation with my Bot Access Token? Is it because botpress is not able to create a conversationId since the user did not answer yet on whatsapp?
s
it says 403 forbidden can you try check in ur conversation, if it is also channel? (refer to my screenshot) please check it on the whatsapp conversation that is not created with start message template u should have already tested before the bot on whatsapp without start message template, and got the default correct JSON see what is it, and use it also, check ur botpress log, if there is more information https://cdn.discordapp.com/attachments/1362739966802788464/1401921141567782922/image.png?ex=6892084e&is=6890b6ce&hm=b49d6d1fb22fb00d3b77bd1023f64b7cc6343352e70babc329250c8930a2110e&
s
b
get the same error if there is no conversation at all at the beginning
i think it's authorization access from my Bot access token idk why
s
even changing the URL in post request to this also dont work? hmm https://api.botpress.cloud/v1/chat/conversations/get-or-create cause i see the URL in the version u share dont have "get-or-create" behind it, so suspect accessed the wrong API endpoint
b
coz when im listing all the conversations, it is right
s
cause the one u used is another one https://botpress.com/docs/api-reference/runtime-api/openapi/createConversation get or create is better, because if u only use create conversation, u will always need to create a new id get or create will allow u "get" the existing id first, if dont have only "create" a new one
b
sren@IWEPC028:~$ curl --request POST \ --url https://api.botpress.cloud/v1/chat/conversations/get-or-create \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $PAT" \ --header "x-bot-id: $BOT_ID" \ --data '{ "integrationName": "whatsapp", "tags": { "whatsapp:userPhone": "85265738671", "whatsapp:botPhoneNumberId": "7122628786784366" }, "channel": "channel" }' {"id":"d70ba2ef0649a29207888fad03559605","code":403,"type":"Forbidden","message":"Bot \"d343faf4-4b3f-b046-6973a3633d24\" cannot create conversations for channel \"channel\" of integration \"intver_01JZTQH453N747KH3YSWQCE\""}sren@IWEPC028:~$
s
TRY #1 if u change the value of channel to whatsapp can work? or try leave it empty? last time i used to use that, until a point it changed... TRY #2 else can try x-integration-id in header instead of integrationName, check if the whatsapp id is the same as intver_01JZTQH453N747KH3YSWQCE mentioned? TRY #3 since it keeps saying cannot create conversation channel for channel, can try if u converse with the bot normally, what event.channel it prints? try like how i put in the screeshot {{event.channel}} or log out the whole {{event}} see or try look into the Events to see what is captured OTHER THING TO CHECK can confirm if ur botphonenumberId is correct? compare to mine, urs got 1 extra number this suppose to be taken from whatsApp API there, in facebook developer https://cdn.discordapp.com/attachments/1362739966802788464/1401943016327090277/image.png?ex=68921cad&is=6890cb2d&hm=33f7c39dfe98e473dc80ad998c337327f360f2fd97a7356f94081498fa32b2e4&
no it's 403 forbidden error still, meaning that authentication is good but my bot doesn't have permissions to create conversation i guess?
anyway, is someone stuck at the same level??
const conversation = await client.createConversation({ integrationName: 'whatsapp', channel: 'channel', tags: { 'whatsapp:userPhone': '+1 504 123 456 78', 'whatsapp:templateName': 'test_message', 'whatsapp:templateLanguage': 'en_US', }, }) I even tried this without success as well 🙁
8 Views