Jobst
03/24/2024, 4:11 PMNate
03/24/2024, 4:23 PMMarvin
03/24/2024, 4:24 PMNate
03/24/2024, 4:40 PMEvent Feed
and open up the Raw tab for the webhook event you want to use, to see where the data you want is located in there
the whole content of the raw tab is event
from which you can access subsets like event.payload
or event.payload.headers
with the templating syntaxJobst
03/24/2024, 5:46 PM{
"event": "{{body.id}}",
"resource": {
"prefect.resource.id": "product.models.{{ body.id }}",
"prefect.first_name": "{{ body.first_name }}",
"prefect.last_name": "{{ body.last_name }}",
"prefect.email": "{{ body.email }}",
"prefect.question": "{{ body.question }}"
}
}
Then I was hoping to launch the automation with those parameters in step 2:
{
"first_name" : "prefect.first_name",
"last_name" : "prefect.last_name",
"email" : "prefect.email",
"question" : "prefect.question"
}
But unfortunately the answer starts with:
"Hallo prefect.first_name,
vielen Dank für deine Anfrage..."
So I guess I completely misunderstand the concept for now, how Prefect is propagating variables? Or is there any mistake I don't see right now?Nate
03/24/2024, 5:50 PMRaw
tab for the webhook event you want to use
are you able to share your event's Raw tab here? i think that would help make it clearer e.g.Nate
03/24/2024, 5:51 PMJobst
03/24/2024, 5:52 PM{
"id": "30131e29-49d1-4806-b2c0-3f0fce0dd10e",
"account": "bd38eca5-4b77-448c-9fcf-b192dc2fc2ae",
"event": "305227000016678376",
"occurred": "2024-03-24T17:44:48.265Z",
"payload": {
"method": "POST",
"headers": {
"host": "api.prefect.cloud",
"content-type": "application/x-www-form-urlencoded;charset=UTF-8",
"user-agent": "<https://crm.zoho.eu>",
"x-zoho-crm-feature": "webhook",
"content-length": "111",
"accept-encoding": "gzip,deflate",
"zsec_user_import_url": "true",
"x-request-id": "46ded30a-2c95-4e3b-bf18-01b54010dea6"
},
"body": "question=What+are+the+USPs+of+aiio%3F&last_name=Doe&id=305227000016678376&first_name=John&email=test%40test.com",
"raw_body": "question=What+are+the+USPs+of+aiio%3F&last_name=Doe&id=305227000016678376&first_name=John&email=test%40test.com"
},
"received": "2024-03-24T17:44:48.267Z",
"related": [
{
"prefect.resource.id": "prefect-cloud.webhook.3c949d8b-73b6-4aae-afd5-bb1419912f4b",
"prefect.resource.name": "ZOHOTestHook",
"prefect.resource.role": "webhook"
}
],
"resource": {
"prefect.resource.id": "product.models.305227000016678376",
"prefect.first_name": "John",
"prefect.last_name": "Doe",
"prefect.email": "test@test.com",
"prefect.question": "What are the USPs of aiio?"
},
"workspace": "3c333271-d8a8-428f-b435-3ce8e988d14e"
}
Nate
03/24/2024, 5:53 PMNate
03/24/2024, 5:54 PMparameters
from this webhook to
how have you created this deployment?
• serve
(like the example I showed above)
• prefect deploy
(and you have some worker
running someplace?)
• somehow else?Jobst
03/24/2024, 5:55 PMJobst
03/24/2024, 5:59 PMNate
03/24/2024, 6:21 PMtriggers
section of your deployment definition in prefect.yaml
like this (see docs) where my flow signature looks like this). defining a deployment trigger is just a short way of the following step
◦ in simulating this, I skipped the webhook part and emitted the following event, but again, whatever you can see in your Raw
tab is what you have access to as you template your parameters
here
In [1]: from prefect.events import emit_event
In [2]: emit_event(
...: event="external.resource.pinged",
...: resource={
...: "prefect.resource.id": "some.external.resource.foo",
...: "first_name": "nate",
...: "last_name": "nowack"
...: }
...: )
• go the UI route and setup an Automation
that matches on your webhook event and configures a Run Deployment
action. again, this is just a UI focused way of doing the previous thingNate
03/24/2024, 6:21 PMthe error might be in the flow hereif there's a specific error you've encountered, can you share what it is?
Nate
03/24/2024, 6:29 PMNate
03/24/2024, 6:40 PM