Spaces:
Running
Running
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| from datetime import datetime | |
| from typing import Any | |
| from pydantic import BaseModel, ConfigDict | |
| class NormalizedWebhookEvent(BaseModel): | |
| model_config = ConfigDict(extra="forbid") | |
| provider: str | |
| event_type: str | |
| external_event_id: str | |
| workspace_id: str | None = None | |
| payload: dict[str, Any] | |
| received_at: datetime | |
| class SocialWebhookAdapter(ABC): | |
| provider: str | |
| async def verify_and_normalize( | |
| self, *, headers: dict[str, str], body: bytes | |
| ) -> list[NormalizedWebhookEvent]: | |
| """Verify the provider signature before returning normalized events.""" | |