Cloudflare Pages Build Status Notifications

Hey folks, just looking for some guidance. We’ve got build triggers set up with CloudFlare Pages, and while these do work I don’t currently get any build notifications. I can configure webhooks for both successful and failed build events, but I can’t specify the payload to include the status flag. Example of a correct payload below.

curl -n -X POST https://webhooks.datocms.com/XXXXXXXXXD/deploy-results \
  -H 'Content-Type: application/json' \
  -d '{ "status": "success" }'

Below is an example of what Cloudflare includes in its webhooks for deployment events.

{
  "name": "Webhook Test",
  "text": "\n⚡️ Cloudflare Pages: A production deployment has started for Project Name ⚡️\n\nBuild Link: https://dash.cloudflare.com/xxx/pages/view/Project Name/11111111111\nCommit Hash: b2c77bd4590bdcb0cb4849ced0b9cd08a64963f482d0c0f5d5b3757b730bee15\nEnvironment: ENVIRONMENT_PRODUCTION\nTimestamp: 2022-10-27T06:00:22Z\n\n\n",
  "data": {
    "alert_name": "pages_event_alert",
    "account_tag": "xxx",
    "project_id": "11111111111",
    "deployment_id": "11111111111",
    "project_name": "Project Name",
    "event": "EVENT_DEPLOYMENT_STARTED",
    "environment": "ENVIRONMENT_PRODUCTION",
    "commit_hash": "xxx",
    "custom_domain": "example.com",
    "pages_dev_url": "example.com",
    "branch_alias_url": "example.com",
    "preview_url": "example.com",
    "timestamp": "2022-10-27T06:00:22Z"
  },
  "ts": 1681832973,
  "account_id": "xxx",
  "policy_id": "xxx",
  "alert_type": "pages_event_alert"
}

Is there any known way of configuring notifications from Cloudflare to DatoCMS for these build events?

Hello @macdara and welcome to the community!

From what i understood, Cloudflare pages does not allow you to set a custom payload to the webhook they send, and therefore you can’t send back to Dato the webhook with the payload we specified, is that correct?

Hey @m.finamor - yes, that’s correct. I’m wondering if there’s a known way of changing the webhook Dato expects to receive? Not sure if that’s an option via a plugin or some other settings. It’s not the end of the world right now, as there are only developers working on the site and we can see the build statuses, but it will be quite awkward once we have our marketing team working on the site.

Hello @macdara , for now not unfortunately :frowning:
The webhook expected by Dato is not modifiable for now, but you should open a feature request for it, as i can see how it could be useful specially for cloudflare pages in this case
Sorry about that