Webhook set-up in Twilio
# 🤝help
t
Hi! I'm creating 3 separate chatbots using Botpress and Twilio. I aim to direct incoming messages to a specific chatbot based on the initial text sent by the user, for example: "Bot1", "Bot2" or "Bot3". I need to set-up 3 different webhooks for each chatbot so I try to make it using workflows in Twilio. As of now I have a problem with set-up the first one. I get an error code (below) when sending SMS to my Twilio numer. Please find the screenshot with the current HTTP request attached. I think that there is a mistake in "Request Body" part, so JSON is wrong, but I'm not sure why. Error code: {"id":"err_20240107172755x0EE3097A","code":500,"type":"Unknown","message":"Request failed with status code 502 (Error ID: err_20240107172755x0EE3097A)"} I will appreciate any help!
b
is that the number Twilio gives you to test or one you are paying?
t
It's the one i'm paying for.
a
Hi Piotr! I am also getting this vague webhook response today in my application. I am trying to debug now and will let you know if I find anything helpful!
t
Hi Alex! Perfect, I will appreciate any help with it!
e
Hello @tall-tiger-81408, have you added a secret in the Webhook integration settings? If so, you have to pass a header
x-bp-secret
with the secret value
t
Hello Guilhermy, thanks for your message. No I have not added a secret, I left it as it was default.
a
Any progress on this @tall-tiger-81408 ? I solved my bug, it had to do with formatting of the request payload- I was using the python requests library instead of axios and there were a few differences. Make sure your request payload isn't being parsed multiple times anywhere, and double check that it's valid JSON... but from your pic it looks correctly formatted.
t
I asked Twilio support to take a look on the existing workflow and for letting me know if my JSON is not parsed multiple times as you @aloof-spring-75081 have advised (thanks for that!). I will let you know if I will get any updates 🙂
Oh, and they send me back to Botpress support 😅
e
Hey @tall-tiger-81408 sorry that you are having this issue! The error 502 indicates that there's something wrong with the request, maybe the payload is invalid or the Webhook integration is not installed/enabled
Try deleting the Webhook integration and installing it again from the Hub
c
Thanks a lot @guilhermy, I wonder why this is not clearly stated in the documentation anywhere, I've been loosing hours to properly authenticate and only your comment enlighted such an important detail : x-bp-secret is the Key name to be added in the headers with the Webhook endpoint secret ( or key or password ) in the Value! here is a screenshot of Insomnia with it : https://cdn.discordapp.com/attachments/1193985105941770362/1253319771886456884/image.png?ex=66756c7f&is=66741aff&hm=3e3755b6783a31fbc3b48d9a6a2768dd8b10cc9dfe78646bdfae28c625ec0bd3&
7 Views