Stop Insert Record Card
# 🤝help
f
Hi there. I'm looking for a way to stop the bot from taking records at a specific record number. Does anyone knows how to achieve that? Thanks a lot 🙏🏻
f
Hey there, I am not sure that I fully understand, could you elaborate a bit more?
f
Sure thing man, thank you. The thing is that I want to stop the bot from taking records once the table has reached a certain amount of records. Imagine that I have a party organized for 40 friends. I want the bot to know when the 40th person has reached the limit and tell the user that the registration could not go through.
f
Ah okay, good idea! Let me see if I can cook up an example for you, just a min 🙂
Here it is
So it starts out by using a capture information card, specifically the "Person Name" card. It saves the name in an object with just the first and last name, so even if the user writes "My name is Henry King" it will just save "Henry" and "King". Then we use the execute code card with the Botpress client to retrieve all of the rows from the table, and then we check if the length of the
rows
array is greater than or equal to 6, which you should change to 40. We store the result, which is either true or false in the
tooManyPeople
variable. We then use the expression card to check if the variable is true, and if its true we go to the
sorry
node. Else we just continue with the register node, and create a new row in the table with the Botpress client.
The register node loops, so you can just send 1 name, which will make it loop, then send another name, which will trigger the expression, because there will be more than 6 people registered for your party.
f
Wow man, I was just checking how many minutes you took hahahahahah you're a true beast. Thank you so much. I can clearly understand the sense of it and I can implement it in my bot and make some changes along the way. Super grateful for it. Oh by the way, do you know how to use the webchat 2 version of Botpress? I couldn't find anything online so... Any clues?
f
Thank you, and that is amazing to hear! You should see a button in the webchat integration that says something like "switch to the new version"
f
Ok I get this version but I want to take out that blue frame and try some of the styling templates and it doesn't seem to show. Do you know how to do that? And sorry for the excessive questions by the way 😕 https://cdn.discordapp.com/attachments/1253831712937607199/1254384703956586557/Screenshot_20240623-063415.png?ex=66794c4a&is=6677faca&hm=3a83a2722d6660f72b02ca9245efdaaf4537ab9c7bc5e27e28b1f6da3bb09db6&
f
No worries. You should see some code at the bottom of the settings of the webchat integration. You can put that on a website and customize most things from there
f
Ok, great. Thanks for everything 🙏🏻
s
is the webchat styler outdated?
this one?
because i tried putting a stylesheet link on a bet im embedding but they're not applying
r
Hey, what is going on with the styler? when does the feature come back? right now you added a stylesheet text area but when I paste all the style from styler it breaks the bot.