Go-whatsapp: Messange SenderJId and PushName Always empty

Created on 3 Aug 2020  路  8Comments  路  Source: Rhymen/go-whatsapp

```go lang
func (wpp *waHandler) HandleTextMessage(message whatsapp.TextMessage) {

fmt.Printf("message %v \nchat %v %v %v sender: %v %v %v \n %v \n\n-------\n\n",
    message.Info.Id,
    wpp.c.Store.Chats[message.Info.RemoteJid].Name, wpp.c.Store.Chats[message.Info.RemoteJid].Jid, message.Info.RemoteJid,
    message.Info.PushName, message.Info.SenderJid, message.ContextInfo.Participant,
    message.Text)
// fmt.Printf("%v %v %v %v %v %v\n\t%v\n", message.Info.Timestamp, message.Info.Id, message.Info.RemoteJid, message.Info.SenderJid, message.ContextInfo.Participant, message.ContextInfo.QuotedMessageID, message.Text)

}
````

Output:

message 91DA7C773E616AF6AE204AD61B8E882C
chat Lecy [email protected] [email protected] sender:
 N茫o haver谩 mais reuni茫o  amanh茫

-------

message EDBCB2503E3ADD135BC26D2A41C4DDAA
chat Lecy [email protected] [email protected] sender:
 馃グ馃グ馃グ

-------

message 00CD056CCDBB2479CAF27D45782951DF
chat Lecy [email protected] [email protected] sender:
 Venha com Deus.

-------

Most helpful comment

If you just want the sender JID for knowing the message sender in a group, just use the following:

var jid string
if message.Info.Source.Participant == nil {
    jid = message.Info.RemoteJid
}else{
    jid = *message.Info.Source.Participant
}

All 8 comments

Yes, I have the same problem

I'm still with the problem. I really need some way to solve this or some idea to how to solve this.

If you just want the sender JID for knowing the message sender in a group, just use the following:

var jid string
if message.Info.Source.Participant == nil {
    jid = message.Info.RemoteJid
}else{
    jid = *message.Info.Source.Participant
}

Unfourtenately, I have the same problem and dont know how to solve it. Tried many ways, but without any result

Unfourtenately, I have the same problem and dont know how to solve it. Tried many ways, but without any result

Hi, the following suggestion (by @cianoscatolo ) worked to me.

If you just want the sender JID for knowing the message sender in a group, just use the following:

var jid string
if message.Info.Source.Participant == nil {
  jid = message.Info.RemoteJid
}else{
  jid = *message.Info.Source.Participant
}

maybe you can use contacts store ?

wac.Store.Contacts[senderJid]

485 should fix the issue with the empty SenderJid, but I do not have a solution for the PushName...

Does anyone know how to retrieve the PushName? Or in which conditions the field is not empty?
I imagined that the PushName is only transmitted if the number is not in your contact list, but a quick test showed that even then it is empty.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Valdenirmezadri picture Valdenirmezadri  路  7Comments

tkovs picture tkovs  路  3Comments

andig picture andig  路  6Comments

0xhex picture 0xhex  路  9Comments

lutpiero picture lutpiero  路  8Comments