Webhook
Trigger your Repeat via HTTP!
The webhook event allows you to trigger a Repeat upon HTTP requests to your Repeat’s URL.
![Notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F04f54a16-c803-43c2-936a-6b082145d0c8%2FUntitled.png?table=block&id=69a7d416-17fb-4fbc-b11d-2f4a4832a634&cache=v2)
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