Setting response body in Webhooks

Hey,

Seems like response body is not implemented. It's pretty critical in order for github actions to work. Any plans on this?

Thanks

Hi @Martynas,

Please can you provide more context and examples of what is required by Github actions?

Looking forward to your reply,
Fares

@Fares It's required by the Github API to send a body with the parameter event_type to be able to trigger a github action workflow: Repositories - GitHub Docs

Example body:

{
"event_type": "prismic_publish_trigger"
}

I've tried it with Postman and it works, but since it can't be set inside Prismic, I can't trigger it via the webhook.

If it's omitted I get this error from Github:

{
    "message": "Invalid request.\n\n\"event_type\" wasn't supplied.",
    "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event"
}

The only option to get it working right now is to create our own serverless function that works as a middle-man between Prismic and Github and adds the correct body. Would be awesome to get this working without having to create a separate serverless function.

Hi,

In fact, the Webhook payload isn't compatible with the current Github dispatch endpoint, and we already have an open issue in our tracker related to this and well will let you know in case of any updates.

For more info, please refer to this thread:

A workaround can be to use a middleware (lambda function, for example) to do the mapping similar to what is mentioned in this thread

Hey @Fares setting up a server/cloudfunction as middleware to modify the body of the webhook is not really a solution. Can you keep this thread open until this feature is implemented or an official solution is decided upon. I think prismic will benefit by supporting triggering github dispatch events via webhooks.

Hello @aaron.renoir, we understand your concern and suggestions. We actively keep up with feature requests on the backlog, including yours :ok_hand:

Thanks

1 Like

I need this as well to rebuild my static nextjs site when prismic content changes. Would really appreciate this getting prioritized.