Can my bot send messages to lists?
# 🤝help
m
I am building a salesbot that will send messages to my clients, trying to upsell other stuff. So I need a way to start the conversation with the list of clients. Can I do it somehow? Maybe with one of the available integrations?
f
Where would it start this conversation? Mail, WhatsApp?
m
Whatsapp!
You could store the information needed in a table https://botpress.com/docs/cloud/studio/tables/
m
I have though about that, but how can I insert the information from the table to the Start Conversation card?
f
Going to ping 2 experts here 🙂 @bumpy-addition-21507 @limited-pencil-78283
m
Okay! Thank you for the help 😄
l
@miniature-balloon-68733 what is the logic you want to use to send messages. What I meant is if your table has 100s of records, will you be sending messages to all records all the time? The method of doing this is via 1) creating a WhatsApp message template in WhatsApp business templates and get it approved 2) use graph API (the one that you integrated into Botpress WhatsApp integration) and build the message payload with the information that will go the message template 3) Use your logic of sending messages to customers using the payload and contact number
m
I'm sorry, but I may have misunderstood some things. I'm not a programmer, just an entrepreneur trying to make this work. So first of all, I have a list of about 8k customers for this specific scenario. I do already have an approved message on my Meta BM Account. There are 2 things that I couldn't understand: How can I trigger the Start Conversation card to actually start the conversation (I didnt test it out yet though), and how can I insert the information on a table into the Start Conversation card, that being the user phones of course, to start the conversations with everyone... Some thing may sound kinda stupid. Like I said, new with this stuff
l
This is how a Start Conversation workflow looks. However, in your case, since you have 8k+ customers, you can 1. load them into a table on Botpress and run the this card in a loop or your desired logic Please note: you have sending limits in WhatsApp and you will need a logic to manage the limits to ensure your WA Business number is not getting blocked Like I mentioned, I would prefer to do this outside of Botpress as Botpress is not intended to run campaings https://cdn.discordapp.com/attachments/1232337094685491290/1232363892907446303/image.png?ex=66292fd0&is=6627de50&hm=fa279aee993c8ae38345ead262376add1fc51bda63b3b14494357cb191cba6b2&
m
Oh, I understand. I actually want to test and approve the bots ability to sell, and then I will probably move the message shooting to specific programs, like Zendesk or Twilio (keeping the Chatbot on Botpress though). It is the only platform I found able to so seamlessly use a trained GPT as a salesman; And I dont plan on shooting to all 8k at once, cause I do know about the Whatsapp limitations and blocking. I'm sorry for taking your time, but I have another question. I see you put "@workflow.phone" for the UserPhone. Does it actually pull the info from the variable? And how can I automatically pull the info from a table to the variable @workflow.phone? I think you can see where I'm going with this... I want to contact a client list, even a small one.
l
you can use the Find Records card to retrieve the phone number from the table and store the record in an array variable. from the variable assign the value column that has the phone number to the workflow.phone and then use the start conversation card to send the message
m
Hey there, its me again. Sorry about the delay... My whatsapp integration was not working yet because my BM account was not verified, but now its on! Welp, I did what you said, and the variables are technically working, I think. But my Conversation Starter is giving me an error message 😩
l
Is this is only error you get? Is your WhatsApp Integration enabled (in BotPress) and Bot is published?
m
Yes, and yes. If I put the Find Records and Start Conversation nodes out of the way, it is working perfectly with user first message
l
I see you are testing from the Emulator. This won't work @fresh-fireman-491 correct me. You must initiate a conversation, from a webchat or with the WhatsApp Business number integrated with your BotPress to make this work
Something like this. While I do not use this anymore, I had a keyword to initiate a workflow that would trigger messages to the phone numbers I provided. This is via Slack, but you could do this one via webchat and WhatsApp https://cdn.discordapp.com/attachments/1232337094685491290/1233422722931884143/image.png?ex=662d09ed&is=662bb86d&hm=4ddf2ea1a9fe66472f883859285d86176070eb1ce3ac10e510a42fb449c94c34&
f
The start conversation won't work or what are you referring to?
l
Trigger Start Conversation Card from Emulator
f
Could be Could also be an issue with the number
I can't see why he shouldn't be able to do it from the emulator, but somethings doesn't work in it.
l
Send Card & Integrations do not work from emulator as far as I know, you need to publish the bot
m
I see. Doing the keyword activation you told me rn, and I'll tell you if it works...
Tried it with a published bot, same error message... The word trigger worked pretty well though, very good idea (I was wondering the best way to trigger the lists) https://cdn.discordapp.com/attachments/1232337094685491290/1233436458392752208/image.png?ex=662d16b7&is=662bc537&hm=a6869760eeb5f022038a0bebb0182235f9a6bc462d1dc01b578e033a276b1d6c&
Somehow, for some reason, after trying the same exact thing 5 times, it worked! But only once. And it is not working anymore...
l
@fresh-fireman-491 Have no idea why the integration is failing
Can you check please
m
So... I've been doing some tests, and couldn't make it work yet, although sending direct messages (by putting the specific number at the "User Phone" box) works perfectly, even with emulator. Maybe a variation of the @ like this could make it work? Because with only "@workflow.phone" it doesn't turn green. Buuuut, it did work once with only the @... https://cdn.discordapp.com/attachments/1232337094685491290/1233494172594602014/image.png?ex=662d4c77&is=662bfaf7&hm=73482a84fb11da179ac882f222b366445f462c8d3d1bab276cf8585f3fc9fe27&
f
The phone number is incorrect, I am not sure why it says it is okay
You should either use @workflow.xxxx Or {{workflow.xxxx}}
Not a combination
m
I know... I've been trying both of them, with the emulator and outside using trigger word on a Chat with Whatsapp. Always get the message "Sorry, an error occurred. Please try again later".
f
Can you double check the template name
m
Okay so, I just made a bunch of tests, and the problem its definetily not the template name, because I can send messages directly to a number. So, either the "@workflow.phone" / "{{workflow.phone}}" thing doesnt work anymore, I didnt use the Find Record card properly, or the Botpress integration with Whatsapp has some sort of error... Like I said, with this exact same configuration, it worked once, but only once in my 80 tests by now. I'm really confused 😅
The variables are being saved like this... Maybe the additional data like "id", "createdAt" and "updateAt" could be the problem? https://cdn.discordapp.com/attachments/1232337094685491290/1234587888377921687/image.png?ex=66314712&is=662ff592&hm=98e803f31c5b060688e615be90381c77334b20de60374cc52131d756ac27beb5&
Made a code card that is actually successfully extracting the phone numbers into another variable, but got the same error message... @User sorry to bother you guys, but anyone got any ideas? https://cdn.discordapp.com/attachments/1232337094685491290/1234591746042630235/image.png?ex=66314aa9&is=662ff929&hm=144928074df02426a5bb094159fb335711c2dd0be96cbac77c6b38ba338657e4&
c
hi there Villon , any chance you can upload your bot so we can take a look ? what happens when you log
workflow.phone
and
{{workflow.phone}}
? also, what are you capturing on your single choice card ? if its the phone than it seems to be in the wrong position of your node stack, it should be before the find records. Hard to tell without having a peek within though.
m
Sure! Here is the bot. About your questions: Nothing happens when I log them, just get an Error message; The single choice card is just a question "Activate trigger?"... It was a theory I created that maybe the bot wasnt having enough time to pull the info from the table and then trigger the Start Conversation card, therefore a manual trigger would give it enough time (didnt work obviously). I really appreciate the help 😄 https://cdn.discordapp.com/attachments/1232337094685491290/1234860970665447495/devoted-hummingbird_-_2024_Apr_30.bpz?ex=66324566&is=6630f3e6&hm=e9567844384df18efc82b0e3f2b4b62ac0ac1fc75255ac1ad47a5b767890390e&
m
it looks like to me you have an error in the OAuth (but I am also an idiot lol)
c
bro your not an idiot, your a Goose! ⚡
c
"Press Space to Honk" 😁. EDIT Taking a look now 🙂
@Villon , here I translated your bot to English so its a bit easier for us to understand: - currently you are
always
moving on to the first video, the
find records
actually does nothing here since the bottom flow always triggers. Do you only want to show the next message if the phonenumber matches the ones in your database ? https://cdn.discordapp.com/attachments/1232337094685491290/1234874030943764511/brave_Qa3eF9mJtH.png?ex=6632518f&is=6631000f&hm=829c637f276fb2fb6f671c3f89ba211f87499673decb1c5eba97756ac3b110d4&
m
It is that way so the trigger only happens with a keyword (my name, Villon)...
If you are a client and dont randomly type my name, you go through the normal procedure
c
ok, what is the purpose of the filter/data table ? If you want to find e.g. phonenumbers starting with
+55
than I suggest the following code instead of the
Find records
:
Copy code
js
try {
  const clientNumbers = await Data1Table.findRecords({
    filter: {"Phone":{"$regex":"^\\+55"}},
    limit: 30,
    offset: 0
  })
  workflow.phonearray = clientNumbers.map((product) => {
    return {
      name: product.name,
      phone: product.Phone 
    }
  })
} catch (error) {
  console.log('Something went wrong: ', error)
}
m
Not exactly finding numbers that start with +55, but gathering the phone numbers from my table
c
if you want to find all the phonenumbers regardless of your search query than you can leave the filter"" empty and use the
limit
to determine how many numbers you want to return.
m
c
ah you need to make the
workflow.phone
variable before hand (try a string first, if that not works try Array) .
m
Do you need both the name and phone number in the variable for the Start Conversation card to work?
It is retrieving the phones correctly (I think), but I'm still getting the error message... Actually I got this same result with the Find Records card, I think. https://cdn.discordapp.com/attachments/1232337094685491290/1234948986423738429/image.png?ex=6632975e&is=663145de&hm=b016fd3dd324290a3e10f084674d84e965c5edd2384e1bda4e69f96ec6e7a7a5&
So, I made the variable first, but still doesnt work. Did it with both name and phone, and with only phone numbers inside variable, still nothing...
c
can you post the error message ?
m
An error occured while executing an integration action: Failed to start Whatsapp conversation using template "disparolistatiago" and language "pt_BR" - Error: {"message":"(#100) Invalid parameter","type":"OAuthException","code":100,"error_data":{"messaging_product":"whatsapp","details":"Parameter Invalid"},"fbtrace_id":"AfAjXdAR0srrC-b-tU91IYx"}
I deleted the past "issues" and the message changed. Same code though
c
your code is quite difficult to understand for me, did you code this yourself or was it GPT-generated ? This will help to formulate a better solution.
m
I just asked the AI to write it
c
Gotcha, no shame in that. Problem is that GPT often doesn’t know the context from where the code is executed (Botpress). As a result it often hallucinates parts or workflows that don’t really work as wed hope. Just to get a clearer picture: can you re-state what it is exactly that you want to achieve ?
m
I want to get the list of Whatsapp phone numbers from a table, and use them to send messages with the Start Conversation card, most probably through a variable
Does anybody have any idea on why this aint working?? 😅
g
l
if the phone number to which you are sending the message, has not interacted with the WhatsApp API number in the past 24 hours, you can only send template messages, that are chargeable
9 Views