wppconnect-team / wppconnect-server

Wppconnect Server is a ready-to-use API, just download, install, and start using, simple as that.
https://wppconnect.io/swagger/wppconnect-server/
Apache License 2.0
652 stars 384 forks source link

Set the same pattern for onmessage and onack. #1917

Closed tiagoandrepro closed 3 weeks ago

tiagoandrepro commented 3 months ago

When receiving a webhook for a new message received on WhatsApp, I get one structure, and when I send a message, I get another. Is it possible to standardize both events since they are related to messages?

{ "event": "onack", "session": "9c5532b8-a02a-48a1-a8c2-907fba1fb2df", "id": { "fromMe": true, "remote": "5511999999999@c.us", "id": "86A2B99CAF91EE93FF75FD8BD1F3138E", "_serialized": "true_5511999999999@c.us_86A2B99CAF91EE93FF75FD8BD1F3138E" }, "viewed": false, "body": "Tudo bom", "type": "chat", "t": 1718901986, "notifyName": "Bot Test", "from": "551198888888@c.us", "to": "5511999999999@c.us", "author": "551198888888@c.us", "ack": 2, "invis": false, "isNewMsg": true, "star": false, "kicNotified": false, "recvFresh": true, "isFromTemplate": false, "pollInvalidated": false, "isSentCagPollCreation": false, "latestEditMsgKey": null, "latestEditSenderTimestampMs": null, "mentionedJidList": [], "groupMentions": [], "isEventCanceled": false, "eventInvalidated": false, "isVcardOverMmsDocument": false, "isForwarded": false, "labels": [], "hasReaction": false, "productHeaderImageRejected": false, "lastPlaybackProgress": 0, "isDynamicReplyButtonsMsg": false, "isCarouselCard": false, "parentMsgId": null, "isMdHistoryMsg": false, "stickerSentTs": 0, "isAvatar": false, "lastUpdateFromServerTs": 0, "invokedBotWid": null, "bizBotType": null, "botResponseTargetId": null, "botPluginType": null, "botPluginReferenceIndex": null, "botPluginSearchProvider": null, "botPluginSearchUrl": null, "botPluginSearchQuery": null, "botPluginMaybeParent": false, "botReelPluginThumbnailCdnUrl": null, "botMsgBodyType": null, "requiresDirectConnection": false, "bizContentPlaceholderType": null, "hostedBizEncStateMismatch": false, "senderOrRecipientAccountTypeHosted": false, "placeholderCreatedWhenAccountIsHosted": false }

{ "event": "onmessage", "session": "9c5532b8-a02a-48a1-a8c2-907fba1fb2df", "id": "false_5511999999999@c.us_3AC7DCC8ECE26D7CC41F", "viewed": false, "body": "Ol\u00e1", "type": "chat", "t": 1718903953, "notifyName": "Tiago Andr\u00e9", "from": "5511999999999@c.us", "to": "551198888888@c.us", "ack": 1, "invis": false, "isNewMsg": true, "star": false, "kicNotified": false, "recvFresh": true, "isFromTemplate": false, "pollInvalidated": false, "isSentCagPollCreation": false, "latestEditMsgKey": null, "latestEditSenderTimestampMs": null, "mentionedJidList": [], "groupMentions": [], "isEventCanceled": false, "eventInvalidated": false, "isVcardOverMmsDocument": false, "isForwarded": false, "labels": [], "hasReaction": false, "productHeaderImageRejected": false, "lastPlaybackProgress": 0, "isDynamicReplyButtonsMsg": false, "isCarouselCard": false, "parentMsgId": null, "isMdHistoryMsg": false, "stickerSentTs": 0, "isAvatar": false, "lastUpdateFromServerTs": 0, "invokedBotWid": null, "bizBotType": null, "botResponseTargetId": null, "botPluginType": null, "botPluginReferenceIndex": null, "botPluginSearchProvider": null, "botPluginSearchUrl": null, "botPluginSearchQuery": null, "botPluginMaybeParent": false, "botReelPluginThumbnailCdnUrl": null, "botMsgBodyType": null, "requiresDirectConnection": null, "bizContentPlaceholderType": null, "hostedBizEncStateMismatch": false, "senderOrRecipientAccountTypeHosted": false, "placeholderCreatedWhenAccountIsHosted": false, "chatId": "5511999999999@c.us", "fromMe": false, "sender": { "id": "5511999999999@c.us", "name": "Tiago Andr\u00e9", "shortName": "Tiago", "pushname": "Tiago Andr\u00e9", "type": "in", "isBusiness": false, "isEnterprise": false, "isSmb": false, "labels": [], "isContactSyncCompleted": 0, "textStatusLastUpdateTime": -1, "syncToAddressbook": true, "formattedName": "Tiago Andr\u00e9", "isMe": false, "isMyContact": true, "isPSA": false, "isUser": true, "isWAContact": true, "profilePicThumbObj": { "id": "5511999999999@c.us", "tag": null }, "msgs": null }, "timestamp": 1718903953, "content": "Ol\u00e1", "isGroupMsg": false, "mediaData": [] }

renat473 commented 3 weeks ago

Hello, this format is due to WhatsApp and not due to the wppconnect server webhook