feat(whatsapp): 🎉 Add extended sending and template management
Some checks failed
CI / Test (1.23) (push) Failing after -24m15s
CI / Test (1.22) (push) Failing after -24m12s
CI / Build (push) Successful in -26m47s
CI / Lint (push) Successful in -26m36s

* Implemented new endpoints for sending various message types:
  - Audio
  - Sticker
  - Location
  - Contacts
  - Interactive messages
  - Template messages
  - Flow messages
  - Reactions
  - Marking messages as read

* Added template management endpoints:
  - List templates
  - Upload templates
  - Delete templates

* Introduced flow management endpoints:
  - List flows
  - Create flows
  - Get flow details
  - Upload flow assets
  - Publish flows
  - Delete flows

* Added phone number management endpoints:
  - List phone numbers
  - Request verification code
  - Verify code

* Enhanced media management with delete media endpoint.

* Updated dependencies.
This commit is contained in:
Hein
2026-02-03 18:07:42 +02:00
parent 98fc28fc5f
commit a7a5831911
16 changed files with 2024 additions and 48 deletions

View File

@@ -241,6 +241,38 @@ func (s *Server) setupRoutes() *http.ServeMux {
// Business API webhooks (no auth - Meta validates via verify_token)
mux.HandleFunc("/webhooks/whatsapp/", h.BusinessAPIWebhook)
// Extended sending (with auth)
mux.HandleFunc("/api/send/audio", h.Auth(h.SendAudio))
mux.HandleFunc("/api/send/sticker", h.Auth(h.SendSticker))
mux.HandleFunc("/api/send/location", h.Auth(h.SendLocation))
mux.HandleFunc("/api/send/contacts", h.Auth(h.SendContacts))
mux.HandleFunc("/api/send/interactive", h.Auth(h.SendInteractive))
mux.HandleFunc("/api/send/template", h.Auth(h.SendTemplate))
mux.HandleFunc("/api/send/flow", h.Auth(h.SendFlow))
mux.HandleFunc("/api/send/reaction", h.Auth(h.SendReaction))
mux.HandleFunc("/api/messages/read", h.Auth(h.MarkAsRead))
// Template management (with auth)
mux.HandleFunc("/api/templates", h.Auth(h.ListTemplates))
mux.HandleFunc("/api/templates/upload", h.Auth(h.UploadTemplate))
mux.HandleFunc("/api/templates/delete", h.Auth(h.DeleteTemplate))
// Flow management (with auth)
mux.HandleFunc("/api/flows", h.Auth(h.ListFlows))
mux.HandleFunc("/api/flows/create", h.Auth(h.CreateFlow))
mux.HandleFunc("/api/flows/get", h.Auth(h.GetFlow))
mux.HandleFunc("/api/flows/upload", h.Auth(h.UploadFlowAsset))
mux.HandleFunc("/api/flows/publish", h.Auth(h.PublishFlow))
mux.HandleFunc("/api/flows/delete", h.Auth(h.DeleteFlow))
// Phone number management (with auth)
mux.HandleFunc("/api/phone-numbers", h.Auth(h.ListPhoneNumbers))
mux.HandleFunc("/api/phone-numbers/request-code", h.Auth(h.RequestVerificationCode))
mux.HandleFunc("/api/phone-numbers/verify-code", h.Auth(h.VerifyCode))
// Media management (with auth)
mux.HandleFunc("/api/media-delete", h.Auth(h.DeleteMediaFile))
// Message cache management (with auth)
mux.HandleFunc("/api/cache", h.Auth(h.GetCachedEvents)) // GET - list cached events
mux.HandleFunc("/api/cache/stats", h.Auth(h.GetCacheStats)) // GET - cache statistics