Initiating WhatsApp Conversation on Database Updat...
# 🤝help
f
Hello everyone, I'm working on a Botpress project where I need to initiate a WhatsApp conversation each time a new row is created in my database. I also need to incorporate custom information from the database into Botpress. I have considered using a WhatsApp trigger, but I am not sure if it is possible to pull additional data into Botpress through this method. Does anyone know if this is possible? Alternatively, I am considering setting up a webhook that pulls all the necessary information from the database. When the webhook is triggered, it would execute a 'Code Execution' node to initiate the WhatsApp conversation. This seems like it could work, as I would have access to all necessary variables inside Botpress. The attached screenshot illustrates my setup. My question is, how do I access the variables I receive via webhook inside Botpress? For instance, you can see in the screenshot that I am receiving data in the body of the webhook. Specifically, how could I use the 'phone' variable inside my code? Any help or advice would be greatly appreciated. Thanks in advance!

https://cdn.discordapp.com/attachments/1135892830930354330/1135892831676928103/Bildschirmfoto_2023-08-01_um_13.09.34.png

https://cdn.discordapp.com/attachments/1135892830930354330/1135892831987310682/Bildschirmfoto_2023-08-01_um_13.10.28.png

https://cdn.discordapp.com/attachments/1135892830930354330/1135892832259948586/Bildschirmfoto_2023-08-01_um_13.11.38.png

a
@bright-magazine-792
I haven't done this in a while, but I would peruse the JSON tab (bottom of your screenshot) to see where the webhook info might be stored.
f
Hi Patrick, the JSON and logs tab and is empty when receiving a new webhook event. I see there only content when typing something in the emulator

https://cdn.discordapp.com/attachments/1135892830930354330/1135935841609461820/Bildschirmfoto_2023-08-01_um_16.01.57.png

a
fair point. Then after your webhook node, add an execute code card, and have it console.log('event',JSON.stringify(event))
you should see info that way, unless there's an error
f
Okay so I choose an example record from the "Discover Events" list and pushed the blue button labeled "Trigger this event" on the right in the screenshot. Afterwards something in the logs appear

https://cdn.discordapp.com/attachments/1135892830930354330/1135940172593233950/Bildschirmfoto_2023-08-01_um_16.16.56.png

Since the trigger function is still in beta, could it be that there is still some function missing that initiate a conversation when a webhook event is received - Or do I miss something? @acceptable-gold-88171 @bright-magazine-792