whatsapp integration

This commit is contained in:
debu-2 2026-10-02 12:51:46 +05:30
parent d077292bbc
commit 141ca9fda3
15 changed files with 578 additions and 1 deletions

View file

@ -491,3 +491,20 @@ class OtpMessageLog(Base):
error_message: Mapped[str | None] = mapped_column(String(500), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)
user: Mapped[UserAccount] = relationship(back_populates="otp_message_logs")
class WhatsAppWebhookEvent(Base):
"""Inbound webhook payloads from Meta WhatsApp Business Platform."""
__tablename__ = "whatsapp_webhook_events"
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
waba_id: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
phone_number_id: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
field: Mapped[str] = mapped_column(String(80), index=True)
event_type: Mapped[str] = mapped_column(String(80), index=True)
from_wa_id: Mapped[str | None] = mapped_column(String(32), nullable=True, index=True)
message_id: Mapped[str | None] = mapped_column(String(128), nullable=True, index=True)
status: Mapped[str | None] = mapped_column(String(32), nullable=True)
payload: Mapped[dict] = mapped_column(JSON)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True)