Spaces:
Running
Running
File size: 697 Bytes
e1104b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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
@abstractmethod
async def verify_and_normalize(
self, *, headers: dict[str, str], body: bytes
) -> list[NormalizedWebhookEvent]:
"""Verify the provider signature before returning normalized events."""
|