almogbaku
9 months ago
No known key found for this signature in database
GPG Key ID: 66C92B1C5B475512
1 changed files with
11 additions and
0 deletions
-
src/pkg/whatsapp/webhook.go
|
|
|
@ -2,9 +2,12 @@ package whatsapp |
|
|
|
|
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"go.mau.fi/whatsmeow/types" |
|
|
|
"net/http" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/aldinokemal/go-whatsapp-web-multidevice/config" |
|
|
|
@ -40,6 +43,14 @@ func createPayload(evt *events.Message) (map[string]interface{}, error) { |
|
|
|
|
|
|
|
if from := evt.Info.SourceString(); from != "" { |
|
|
|
body["from"] = from |
|
|
|
if strings.HasSuffix(body["from"].(string), "@lid") { |
|
|
|
body["from_lid"] = body["from"] |
|
|
|
jid, _ := types.ParseJID(body["from"].(string)) |
|
|
|
pn, _ := cli.Store.LIDs.GetPNForLID(context.Background(), jid) |
|
|
|
if !pn.IsEmpty() { |
|
|
|
body["from"] = pn.String() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if message.ID != "" { |
|
|
|
body["message"] = message |
|
|
|
|