Create a webhook for the current project. Args: url: The URL to send the webhook to. name: The name of the webhook. event_types: List of event types to trigger the webhook for. Returns: Dictionary containing the created webhook detail
(self, url: str, name: str, project_id: str, event_types: List[str])
| 549 | |
| 550 | @api_error_handler |
| 551 | def create_webhook(self, url: str, name: str, project_id: str, event_types: List[str]) -> Dict[str, Any]: |
| 552 | """Create a webhook for the current project. |
| 553 | |
| 554 | Args: |
| 555 | url: The URL to send the webhook to. |
| 556 | name: The name of the webhook. |
| 557 | event_types: List of event types to trigger the webhook for. |
| 558 | |
| 559 | Returns: |
| 560 | Dictionary containing the created webhook details. |
| 561 | |
| 562 | Raises: |
| 563 | APIError: If the API request fails. |
| 564 | ValueError: If project_id is not set. |
| 565 | """ |
| 566 | |
| 567 | payload = {"url": url, "name": name, "event_types": event_types} |
| 568 | response = self.client.post(f"api/v1/webhooks/projects/{project_id}/", json=payload) |
| 569 | response.raise_for_status() |
| 570 | capture_client_event("client.create_webhook", self) |
| 571 | return response.json() |
| 572 | |
| 573 | @api_error_handler |
| 574 | def update_webhook( |
nothing calls this directly
no test coverage detected