How do I sent a POST request body with a custom webhook in an automation? #17946
Replies: 5 comments 2 replies
-
@NicholasPini could you share some more information? For example, a screenshot of the automation along with information about the block connected to it. |
Beta Was this translation helpful? Give feedback.
-
I'm using this website to test the API request: https://beeceptor.com. I've configured a custom webhook block for a POST request with this URL: https://test-prefect.free.beeceptor.com/running. This comes from the website above, it's a test hook I have configured. Everything else in the webhook block is empty. Then, I've configured an automation. This is set to trigger every time any flow gets to the Running state. The automation is set to trigger a notification, and I've passed the webhook block I've just described. In the automation I also have a body (the default one, already present in the UI, just to test things). When I launch a flow, the automation is correctly triggered, and beeceptor.com receives the POST request, but the body of the request is empty. Now, if instead I modify the webhook block's JSON data field, filling it with a random JSON just to test things, and I run the flows again, beeceptor not only receives the POST request, but it also contains the JSON data in the body as configured in the webhook block. I haven't tested it in any other way, so it may be beeceptor the problem, but it does receive the body of the POST request when I write it into the webhook block directly, instead of writing it into the automation, so I'm not sure. Btw, I'm using Prefect 3.2.15 with a custom, local running server and I've configured all of the above through the UI. |
Beta Was this translation helpful? Give feedback.
-
@cicdw I've tried setting various Content-Type in the header block. The problem is that whatever I do, the the Content-Length is always zero. This is what the block looks like: The request is sent, but Content-Length is zero, and no body is present. If I put a body in the block itself, instead of inside the automation, it works, but the block doesn't have access to information about the flow triggering the automation. |
Beta Was this translation helpful? Give feedback.
-
Hi @NicholasPini , I ran into the same issue as you. Please fill in the
![]() It worked for me - hopefully it helps you as well π |
Beta Was this translation helpful? Give feedback.
-
Hi, I recently ran into the same issue, also the answer above by @sonthai-de didn't work for me. This wasn't exactly your question, but FWIW I solved it by using a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Prefect 3 server in which I've set an automation to trigger every time a flow is in the Running state. I connected this automation to a custom webhook, which contains the URL to send the POST request to. I've also filled the "body" field during automation creation: the problem is that this body is not sent along with the POST request. If I set the body field in the webhook block, it gets sent correctly, but this body field doesn't have access to the flow state using Jinja templating. What do I do?
Beta Was this translation helpful? Give feedback.
All reactions