Webhook
Trigger your Repeat via HTTP!
The webhook event allows you to trigger a Repeat upon HTTP requests to your Repeat’s URL.
You can view existing webhooks, or add additional ones, under the Events tab on the sidebar.
Event
Refer to the Request Web API.
Signature
export default {
async webhook(request: Request, env: Repeat.Env) {
// ...
},
};
Parameters
- request:
Request
The Request object represents the incoming request to your Repeat web hooks, and allows you to access information such as the headers or body of the request.
- env:
Env
The Env object represents the Repeat’s environment, such as variables, storage and metrics as well as the various webhook integrations for different platforms.
Returns
void
|response
Your webhook handler does not need to return a Response, but you return one optionally if necessary.
Examples
Echo the received headers
export default {
async webhook(request: Request, env: Repeat.Env) {
return Response.json(Object.fromEntries(request.headers.entries()));
},
};
// {
// "accept": "*/*",
// "accept-encoding": "gzip",
// ...
// }
Last updated on November 12, 2022