<@ULVA73B9P> webhook fails with ```{ "id": "0686...
# marvin-ai
m
@Marvin webhook fails with
Copy code
{
  "id": "06866c9a-c6d3-7882-8000-3b45ad481e80",
  "account": "1f68ce6c-568d-4d7a-ae99-9641099300bd",
  "event": "prefect-cloud.webhook.failed",
  "occurred": "2025-07-03T18:19:24.426Z",
  "payload": {
    "method": "POST",
    "headers": {
      "host": "api.prefect.cloud",
      "user-agent": "python-requests/2.32.3",
      "accept-encoding": "gzip, deflate",
      "accept": "*/*",
      "content-type": "application/json",
      "content-length": "3336",
      "x-request-id": "97d2c8e4-59b5-9374-bc7a-41a6da081a59"
    },
    "body": "{\"data\": [{\"__record_id\": \"variant_id1__unifydmaster\", \"__unifyd_master\": \"1\", \"category_src_normalized\": \"Flower\", \"strain_dict_extract2\": \"WEDDING PIE\", \"product_id_src\": \"fa6c87ff5ca1ba3abe0c78dd2830b420\", \"source\": \"dutchie\", \"uom\": \"gram\", \"price\": \"21.0\", \"product_id\": null, \"segment\": \"Buds\", \"state\": \"Ontario\", \"cannabis_type\": \"INDICA\", \"brand\": \"BACK FORTY\", \"product_presentation\": \"3.50 gram\", \"strain\": \"WEDDING PIE\", \"variant_url\": \"<https://dutchie.com/dispensary/true-north-cannabis-welland/product/wedding-pie-wedding-cake-x-grape-pie-3-5g>\", ...",
    "compiled": null,
    "reason": "unexpected character: line 5 column 19 (char 121)"
  },
  "received": "2025-07-03T18:19:24.426Z",
  "related": [],
  "resource": {
    "prefect.resource.id": "prefect-cloud.webhook.283c8f61-321f-4336-99a8-b679b2206dbf",
    "prefect.resource.name": "Upsert Catsy Products"
  },
  "workspace": "8f854e6c-4fe7-49b7-860c-8f2e7973c905"
}
how to fix. webhook template
Copy code
"event": "pim.unifyd.catsy",
  "resource": {
    "prefect.resource.id": "pim.unifyd.catsy.handle",
    "payload": "{{ body | tojson }}"
  }
}
m
thought for 7.2 seconds
The error message indicates there's an issue with malformed JSON in your webhook payload, specifically at line 5, column 19. The problem appears to be with the URL in your data that contains angle brackets (
<
and
>
). Here's how to fix it: 1. Remove the angle brackets from URLs in your payload. Instead of:
Copy code
json
"variant_url": "<https://dutchie.com/...>"
It should be:
Copy code
json
"variant_url": "<https://dutchie.com/...>"
2. Your webhook template looks incomplete. For Prefect webhooks, you'll want a complete template like this:
Copy code
json
{
  "event": "pim.unifyd.catsy",
  "resource": {
    "prefect.resource.id": "pim.unifyd.catsy.handle",
    "prefect.resource.name": "Catsy Product Handler",
    "payload": {{ body | tojson }}
  }
}
Note that: - The
payload
field uses
{{ body | tojson }}
without quotes since it's already being converted to JSON - Make sure all your JSON data is properly escaped - URLs should not contain angle brackets - The template should be a complete JSON object You can validate your JSON payload using a JSON validator before sending it to ensure it's properly formatted. The error "unexpected character" typically means there's a syntax error in your JSON structure. For more details on webhook configuration, you can refer to the Prefect Webhook documentation.