feat(send): add POST /send/event endpoint#90
Open
NeritonDias wants to merge 2 commits into
Open
Conversation
Create and send WhatsApp Events (the group agenda feature), which could previously only be created manually from the app. - EventStruct/EventLocationStruct body with an EventTime type that accepts both ISO 8601 (RFC3339) and epoch seconds for startTime/endTime - SendEvent builds a waE2E.EventMessage and sets the required MessageContextInfo secret (same pattern as BuildPollCreation) so the event's going/not-going responses can be decrypted - handle "EventMessage" in all SendMessage context-info switches - route POST /send/event with the shared JID validation middleware - regenerate Swagger docs, add CHANGELOG entry and Postman request
There was a problem hiding this comment.
Sorry @NeritonDias, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Follow-up to the /send/event endpoint so real events render in the WhatsApp client and cover the full feature set: - always send isCanceled/isScheduleCall/extraGuestsAllowed explicitly; the WhatsApp client requires these booleans present, otherwise it ACKs but silently discards the event - add isScheduleCall to the request body - add an optional `text` field, delivered as a leading message right before the event card (the event has no caption field), honoring mentionAll/mentionedJid/delay - regenerate Swagger, update CHANGELOG and the Postman example Note: joinLink only accepts WhatsApp call links (call.whatsapp.com); external URLs (site/YouTube) belong in description. Requires the matching event-stanza support in the bundled whatsmeow (type=event + <meta event_type="creation">).
|
up |
Author
|
🟢 👍 Mira a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
POST /send/eventto create and send WhatsApp Events (group agenda) — previously only possible manually from the app.What's included
EventStructrequest body with anEventTimetype that accepts both ISO 8601 (RFC3339, with timezone) and epoch seconds forstartTime/endTime.SendEventbuilds awaE2E.EventMessageand sets the requiredMessageContextInfo.MessageSecret(32 bytes viacrypto/rand) so the event's going/not-going responses decrypt.isCanceled,isScheduleCall,extraGuestsAllowed) are always sent explicitly — the WhatsApp client requires them present, otherwise it ACKs but silently drops the event.textfield, delivered as a leading message right before the event card (caption-style, since the event has no caption field), honoringmentionAll/mentionedJid/delay."EventMessage"handled in everySendMessagecontext-info switch (quoted, no-quoted, mentionAll, mentionedJid).POST /send/eventwith the sharedValidateNumberFieldWithFormatJidmiddleware.docs/), CHANGELOG and Postman example updated.Body fields
Required:
number,name,startTime. Optional:description,endTime,location{name,latitude,longitude,address},hasReminder+reminderOffsetSec(900=15min,3600=1h,86400=1 day),isScheduleCall,extraGuestsAllowed,isCanceled,mentionAll/mentionedJid,text,delay,quoted.joinLinkonly accepts WhatsApp call links (call.whatsapp.com); external URLs (site/YouTube) belong indescription.Tested
Verified end-to-end against a real group: event creation, going/not-going responses, location, start/end time, reminder (15min/1h/1day),
mentionAll, and thetextcaption — all rendering correctly.go build ./...,go vet ./pkg/sendMessage/...andmake swaggerpass (CGO enabled).