Help with Webhooks
# 🤝help
f
Hello everyone, I am attempting to use webhooks to send a payload to my bot so that I can send data from N8N (Zapier/Make Alternative) to Botpress and use it in conversation. To do this, I am using an HTTP Request node and sending a "Post" request (see picture 1, 2 and 3). The Bot receives the request just fine, and I am able to see the payload in the Botpress emulator. However, when I try to use the data in an active conversation after publishing the bot, I keep getting this error: error: Bt [Error]: request/body must have required property 'userId'. I have the user Id correct, as I get it from botpress, send it to N8N, attach it to the payload, and then send the N8N data (along with the conversation and user ID) back to Botpress. I was getting this error with "conversationId" as well, but that has since stopped, so it appears to be receiving the conversationId correctly, but not the user ID for some reason. Anybody know why this is happening and what I might be able to do to fix it? Any help is greatly appreciated! Thank you. https://cdn.discordapp.com/attachments/1223702597408522240/1223702597731618836/HTTP_Headers.png?ex=661ad0da&is=66085bda&hm=59627d3b8304ccacdf1c8dfca96aec64abc9bddc889631f2761f99b916b3c28d& https://cdn.discordapp.com/attachments/1223702597408522240/1223702598092197918/HTTP_Body.png?ex=661ad0da&is=66085bda&hm=e5fbfffe8c18b42aa3e141cb635d97b76f36f935c36e257060f863213001b0cb& https://cdn.discordapp.com/attachments/1223702597408522240/1223702598444515418/HTTP_Body_2.png?ex=661ad0da&is=66085bda&hm=aa9cdc5041e390ad96288941c4c0bb0a745eb739ff2a400b6583e0df78594397& https://cdn.discordapp.com/attachments/1223702597408522240/1223702598687920300/Payload_body_in_Botpress_Emulator.png?ex=661ad0da&is=66085bda&hm=fa91542e9c3438951fdaf57cffcc157b0746efe9a56e87acaa80d770be825275& https://cdn.discordapp.com/attachments/1223702597408522240/1223702598956224642/Error_Message.png?ex=661ad0da&is=66085bda&hm=ba18cc3aa1570d2e0b2af5d592222c569759c00bbe99b6187dcedbec104639c8&
f
Can you send a screenshot of your workflow in Botpress
f
Here is the workflow and here is a screenshot of the other execute codeblock which is attatched to the "Start" node of the conversation - if it helps. The way I have it setup is the conversation starts, then the code block captures the conversation Id and user Id and sends it to N8N via webhook. Then I have a "Wait for User" card that I wait to reply to until the Webhook trigger has captured the necessary data. I've tried also discarding the initial node and using the Webhook trigger to start the conversation, but I still run into the same problem. The webhook is capturing the data I'm sending (see above picture), but when I try to use it in conversation I keep getting that same error. https://cdn.discordapp.com/attachments/1223702597408522240/1223768775023923311/Botpress_Workflow.png?ex=661b0e7c&is=6608997c&hm=5018b655239f79c0c9278a3e614e231bd44606ab354233dec6b9979b31a75590& https://cdn.discordapp.com/attachments/1223702597408522240/1223768775309131868/Execute_Code_Block_Start.png?ex=661b0e7c&is=6608997c&hm=7ff0bfd3c441ae469758096a51a2ba6a2fff605ba05109e32feb1ee7d6cfc7a9&
I'm getting this error in N8N (if it helps), which is weird because the data is being received within the Botpress emulator, I just can't use it in conversation. https://cdn.discordapp.com/attachments/1223702597408522240/1223770104261775461/N8N_Error.png?ex=661b0fb9&is=66089ab9&hm=9d41727ef48c3b5837b2c993658c22f06314a92757ac079b1af55a2472cd26b3&
What are you sending back to N8N?
You can't use the text card in the flow of a webhook.
You can use the Botpress client to send messages if you want https://botpress.com/docs/api-documentation/#introduction
f
Hey @fresh-fireman-491, the issue I'm running into sending information from N8N to Botpress. When I send from Botpress to N8N, it works great! However, when I try to send a payload to Botpress from N8N, that is where I'm having difficulty. The payload sends, and it is received from N8N and appears in the Botpress emulator (see picture), however, when I try to assign it to a workflow variable and use it in conversation, that is where I'm getting the "userId" issue. https://cdn.discordapp.com/attachments/1223702597408522240/1224059189140131860/Payload_body_in_Botpress_Emulator.png?ex=661c1cf4&is=6609a7f4&hm=5576174f6e54477847b5e3937b76981b4f3ac3da961fc0d835c4610a20da0c01& https://cdn.discordapp.com/attachments/1223702597408522240/1224059189517750432/Error_Message.png?ex=661c1cf4&is=6609a7f4&hm=e325ce6aca162e61806f8e7e0c981c26025ae7195694388eb7b5846fbcd4f27b&
f
You cannot use a text card in the flow of a Webhook, as of my knowledge
Maybe a @User knows a way to do it? Otherwise you can use the API which I gave link to earlier
b
Hey @freezing-morning-36045! Did you test the bot in studio emulator, or in the sharable link?
f
Hey @bland-agent-12616 Both! Within the studio emulator, I am able to use the discover events within the "Webhook trigger" and use the data in conversation effectively! It's when I use it outside of the emulator (such as the shareable link) that I run into issues. I'm not not sure why it's happening, but I think it has something to do with the "userId" not being attached to the payload correctly. I found this thread which appears very similar to the issue I'm having, however mine is "userId" and not "conversationId": https://github.com/botpress/botpress/issues/12787
b
I did something similar for a shopify bot
And this is the only code I had after the webhook trigger
Copy code
event.conversationId = event.payload.body.conversationId
So I'm guessing its a problem with your make setup
Can you show the make scenario modules?
f
@careful-kitchen-31087 Here is my setup and current code cards. I've kind of just been putting together what I've seen work for other people, but I'd be very interested to try your method!
Hey @bland-agent-12616, thanks! I tried attaching the conversation and userId to the payload after it had been received using a code card, but I kept running into the same issue. I think you're right and it something with my setup. I'm using N8N instead of Make, so probably some differences in the payload structure.
@careful-kitchen-31087
125 Views