Pulling information from Zapier into Botpress
# 🤝help
n
Hi there, there was a post i was following that Bassam linked me but i think it may have become deleted. I'm in the process of trying to set up functionality of sending and receiving info from zapier via webhooks and i'm able to grab the information in zapier, however when i go to push it out i keep getting an error. I put the url from webhook integration in botpress into the url within the zap task so to my knowledge it should be going to the right direction, however it's not working (the zap is set up currently to receive a webhook, which it takes the information, and the zap finishes with a post webhook) Request failed with status code 502 ^^ that's the error code i keep getting. Anyone able to help me resolve this issue? The code i'm using in the execute code card is as follows, i could also be utilizing this wrong as well so if this can be altered/changed please advise as well 🙂 const currentDateAndTime = luxon.DateTime.now().toISO() const sendData = { "curDateTime": currentDateAndTime, "info1": "test" } const webhookUrl = try { const response = await axios.post(webhookUrl, sendData) const webhookResponse = response.data console.log(webhookResponse) workflow.test2 = webhookResponse; } catch (error) { console.log(error) }
f
I believe this is the post you are looking for https://discord.com/channels/1108396290624213082/1139488698354913412/1139606586348797952 Are you trying to test this in the emulator?
n
that's exactly what i was looking for, thank you! No i'm not in the emulator, i've published the bot and have the proper zapier subscription to facilitate the functionality so now it's just a matter of getting it all set up properly. Here's what i've done: I set up an execute code card to perform the following post webhook: const currentDateAndTime = luxon.DateTime.now().toISO() const sendData = { "conversationId": event.conversationId, "curDateTime": currentDateAndTime, "info1": "test" } const webhookUrl = try { const response = await axios.post(webhookUrl, sendData) const webhookResponse = response.data console.log(webhookResponse) workflow.test2 = webhookResponse; } catch (error) { console.log(error) } This sends perfectly and is passing the information directly to zapier, and i'm even getting the proper information in the post webhook that is leaving zapier I set up a trigger which goes to an execute code card, and the following is the code i currently have in there (i think this is probably where i'm falling short in establishing the connection) const webhookUrl = 'my botpress webhook url' try { const response = await axios.get(webhookUrl) const webhookResponse = response.data event.conversationId = event.payload.body.conversationId workflow.test2 = webhookResponse; console.log(webhookResponse) } catch (error) { console.log(error) } when i run the chatbot through the chat option in the dashboard (not in the emulator) and go to zapier, its still giving me a 502 error code when it tries to send the info to botpress. Looking forward to your response! This will be super helpful once this gets set up
f
Let me verify a few things and I will get back to you on this
n
Much appreciated!
f
,Hey Brenagain. Just to clarify do you see the 502 on sending or receiving?
Okay Brenagain. We looked over this again. You are getting the 502 because you code is calling the webhook again.
The information has already be sent in via the trigger.
n
the 502 error code shows up in the 2nd zapier webhook (first webhook in zapier is the trigger to catch the post webhook from botpress, 2nd webhook in zapier is a post webhook to send back to botpress). the 2nd webhook in zapier is going to the proper botpress url, however when it sends out the information or tries to execute that webhook it gives me the 502
since the 502 error is from the 2nd webhook in a zap which im using to send back to botpress, the info isn't being sent back to botpress
I'm not sure if it helps but here's a screenshot from the zap history

https://cdn.discordapp.com/attachments/1140719001094340762/1141100428654821447/image.png

for anyone who might be following this thread - i opened up a new thread which may have an easier solution for this option (currently waiting on direction from the Botpress team to help finalize the set up!) https://discord.com/channels/1108396290624213082/1141443975778152468
The issue was resolved and is working in the thread linked above!
20 Views