Hi All , I am just exploring Prefect and trying to...
# ask-community
v
Hi All , I am just exploring Prefect and trying to replicate one use case , starting with send a webohook event . completed the below steps. 1. Created the webhook listener in prefect cloud 2. and created a sample code to send the json request. but getting below error - please let me know what I am doing wrong
Copy code
1 validation error for Event\npayload\n  Input should be a valid dictionary [type=dict_type, input_value='{\"userid\": \"1234\", \"stre...23456\", \"balance\":
Raw payload
Copy code
{
  "id": "5e2ecc1f-7e5e-4465-b20a-f828a0644bbb",
  "account": "c6c40f5d-a16d-4608-a783-cf8631ab61dc",
  "event": "prefect-cloud.webhook.failed",
  "occurred": "2024-12-23T19:42:39.404Z",
  "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": "107",
      "x-request-id": "c3c4e8f1-9e57-9089-94b3-49e067b224aa"
    },
    "body": "\"{\\\"userid\\\": \\\"1234\\\", \\\"streamName\\\": \\\"PostionEvent\\\", \\\"accountNumber\\\": \\\"123456\\\", \\\"balance\\\": 100}\"",
    "rendered": {
      "event": "customer.created",
      "resource": {
        "prefect.resource.id": "product.models"
      },
      "payload": "{\"userid\": \"1234\", \"streamName\": \"PostionEvent\", \"accountNumber\": \"123456\", \"balance\": 100}"
    },
    "compiled": null,
    "reason": "1 validation error for Event\npayload\n  Input should be a valid dictionary [type=dict_type, input_value='{\"userid\": \"1234\", \"stre...23456\", \"balance\": 100}', input_type=str]\n    For further information visit <https://errors.pydantic.dev/2.9/v/dict_type>"
  },
  "received": "2024-12-23T19:42:39.404Z",
  "related": [],
  "resource": {
    "prefect.resource.id": "prefect-cloud.webhook.19f93309-a58e-4cc5-a3a5-2953101f4b4f",
    "prefect.resource.name": "DemoUserSream"
  },
  "workspace": "043227ed-0a48-49be-9a34-d8e2a885f0a9"
}
template Webhooks DemoUserSream • DetailsTemplate
Copy code
{
   "event":  "customer.created",
    "resource": {"prefect.resource.id": "product.models"},
 "payload": {{ body|tojson }}
}