https://discord.gg/botpress logo
Posting to Messaging API via Zapier is causing a 5...
# 🤝help
m
Hello Botpress folks! We are trying to post to the Messaging API webhook via Zapier to generate a response - when we try, it looks like the payload goes through but returns a 502 error - can you help me investigate the trace ID and what could be stopping this from going all the way through? https://gists.security.zapier.com/gists/3fe7b598-82a2-458d-b602-7d52e99e568e
l
When Zapier returns a 502, Botpress received the request but could not forward it to the internal Messaging API. The following could potentially be causes: - verify the webhook url > The URL must be the full Botpress Messaging API endpoint (e.g., https:///api/v1/bots//events) - check the auth token > The request needs a valid Authorization: Bearer header. If the token is expired or missing, Botpress will reject the call. - Confirm the payload format & size > JSON payload follows the required schema and is under the size limit - Use the Trace ID to locate the failure in Botpress traces - Examine Botpress logs for any detailed error messages
Update me when you can 🙂
m
@loud-crowd-60573 thanks for the reply! It doesn't look like they even made it into the log - can you let me know where to find the Traces dashboard?
The webhook url and auth token are definitely correct
and the payload format looks accurate as far as I can tell - maybe you can take a look and let me know if anything looks off
what are the minimum required fields in they payload? I can simplify it just for testing to see if that's causing the 502.
l
whats your workspace ID?
m
@loud-crowd-60573 wkspace_01K72MHEY4G9YDHPHF1HANRF77
@loud-crowd-60573 any more updates on this? 🤞
l
Will get back when I have insight!
m
@loud-crowd-60573 had a bit of a breakthrough, essentially there seems to be a message length limit or something on this, for example:
l
After looking at your workflow, there seems to be no issues on our side
oh nice!
m
Copy code
{
  "userId": "kevin@efogi.com",
  "messageId": "19aa80679f214dce",
  "conversationId": "19aa80679f214dce",
  "type": "text",
  "text": "Hello, I am an agent who wants to add PFLI to their repertoire.  Should I add PFLI to my list of services? Who does PFLI work best for?",
  "payload": {
    "text": "Hello, I am an agent who wants to add PFLI to their repertoire.  Should I add PFLI to my list of services? Who does PFLI work best for?"
  }
}
l
Were you able to fix it?
m
works, but as soon as the message is longer, it 502's
@loud-crowd-60573 not quite, but I found where the line is and wondering if you can help the rest of the way
{ "userId": "kevin@efogi.com", "messageId": "19aa80679f214dce", "conversationId": "19aa80679f214dce", "type": "text", "text": "Hello, I am an agent who wants to add PFLI to their repertoire. Should I add PFLI to my list of services? Who does PFLI work best for? Why is Lionsmark the best PFLI provider?", "payload": { "text": "Hello, I am an agent who wants to add PFLI to their repertoire. Should I add PFLI to my list of services? Who does PFLI work best for? Why is Lionsmark the best PFLI provider?" } }
@loud-crowd-60573 ^ this one does 502, the only difference is just that last bit of text "Why is Lionsmark the best PFLI provider?" - it seems to be a length thing - is there a limit and is there a way to beat that limit?
@loud-crowd-60573 - any more info on this? Found that the message length is the sole reason for the 502 - what are the rules about message length and how can we work with it so we can post longer messages to the API?
l
Have you tested using the zapier integration as opposed to the messaging API?
m
@loud-crowd-60573 no - but that may be the ticket - do you have any documentation? Essentially we're just trying to set up an email address that responds with chatbot answers - perhaps you have a better workflow or stack to make this happen?
l
I was not able to get more info, I'll try messaging someone else!
m
@loud-crowd-60573 appreciate it big time!
l
Can you send the complete error payload @miniature-eve-55794
m
Response {"id":"err_20251202215237xDA7150B2","code":500,"type":"Unknown","message":"Request failed with status code 502 (Trace ID: c975bba4f14c06be0545127ac3e48e6f)"} Status 200 Headers connection: keep-alive content-length: 157 content-type: application/json; charset=utf-8 date: Tue, 02 Dec 2025 21:52:37 GMT etag: W/"9d-uPJJTjBH4nXuRm/c8nUcCu260Rk" x-trace-id: c975bba4f14c06be0545127ac3e48e6f
@loud-crowd-60573 also the length is definitely it - I can swap the text length back and forth and get the error or the OK response
w
the length is almost not definitely it i think
i think you just luck out with getting a sucessful response before a longer message triggers the error
502 is BAD GATEWAY so if there was a server problem i think there would be more reports
i have no experience with zapier but i use the messaging api with n8n on the daily
could you send a screenshot of how you have your API POST block set up?
also it's not entirely clear if this error is from botpress or the zapier donstream
m
I switch it back and forth one complete loop
w
let mi see
m
Even with the 502, we get a 200 status so Zapier definitely delivers the payload correctly, confirmed with Zapier tech support. The 502 comes from Botpress
w
why do you duplicate the text input in the payload?
m
@wide-umbrella-5226 the documentation is unclear if the text should be in the payload or outside of it
w
yeah there's not even documentation for this unfortunately
you can pass the text ouside of the payload though
m
@wide-umbrella-5226 right, we put it in thepayload at somepoint trying to test different scenarios for the 502
w
oh also
it looks like you're passing duplicate message ids
that could mess things up
m
so I removed the message ID, and removed text from payload, get the same error based on length
w
could you try sending an empty payload please
i really don't want to believe this is length-based
m
same exact interaction
w
i think this is some bizarre error that comes from some sort of payload malformation
because you don't even get an error message for some reason
all my problems with the messaging api were fairly straightforward
oh delete this by the way
m
right, this is super bizarre, did not expect it to be this
w
your personal access token is completely exposed
m
good call good call, when this is working I will make a fresh one for sure
w
do you know if you can run functions inside of the data field?
calling JSON.stringify() on your field could help
i had to do that in mine
i can send them normally in n8n
m
testing stringify - so it looks like you keep all the text inside the payload?
w
no
that test is without stringify by the way
Copy code
js
{
  "userId": "test",
  "messageId": "test1",
  "conversationId": "test",
  "type": "text",
  "text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "payload": {}
}
try sending this body
also maybe try adding Content-Type application/json; charset=utf-8 to your headers
m
that works!
w
which one?
m
the test body you just sent
w
oh nice
then your payload is malformed
can you send it here?
either 1. the fields being autofilled from gmail are malformed because they're not being stringified correctly 2. there's a json syntax error 3. there's some invisible thing breaking json (which is solved by stringify)
m
so I replaced the aaaaa's with the sample text I was using, and that broke it again - is it like spaces or special characters? Hello, I am an agent who wants to add PFLI to their repertoire. I have a couple of questions - is PFLI a scam? Who does PFLI work best for? Why is Lionsmark the best PFLI provider?
w
yeah it's a zapier downstream problem i think
n8n immediately flags it as invalid json
you have invalid line breaks
Hello, I am an agent who wants to add PFLI to their repertoire. I have a couple of questions - is PFLI a scam? Who does PFLI work best for? Why is Lionsmark the best PFLI provider?
paste this directly into your body and try it
m
that was it! omg
w
haha that's why you always stringify it
json is a silent killer
m
you're an expert! thanks so much! and just since I have you here - when you send this to the Messaging API, do you have to build a separate workflow in botpress for it to send the response back to the webhook or does it do it based on the bot automatically?
w
by the way if you don't strigify it your zapier instance will immediately break if your user or the bot send anything that breaks json
like quotes
when you interact with the message API it just runs whatever step that conversation's workflow is on
l
They call @User the 🐐 for a reason
w
so you just need another zapier block that receives the webhook calls sent by the Messaging API integration
m
the 🐐 for real!
w
you set that url in the messaging api integration as well
m
okay so no workflow on botpress's end?
w
not at all thankfully
very simple
message has been deleted
m
🙏
w
message has been deleted
m
lmk if you have a venmo or something so I can buy you a cup of coffee!
w
no need bro i do it for the love of the game
message has been deleted
m
based
w
feel free to ping me with any other questions by the way
m
I will do my best not to have to bother you but its great to know ya!