Giter VIP home page Giter VIP logo

Comments (8)

Rhymen avatar Rhymen commented on June 2, 2024 3

I added the status field to the message info struct and a couple of constants for the different status so you can play around with it.

from go-whatsapp.

Rhymen avatar Rhymen commented on June 2, 2024

This is currently not possible, because we didn't map all required fields to our custom structs. From what I can see the message proto contains a status field, which can be one of

var WebMessageInfo_STATUS_name = map[int32]string{
	0: "ERROR",
	1: "PENDING",
	2: "SERVER_ACK",
	3: "DELIVERY_ACK",
	4: "READ",
	5: "PLAYED",
}

We have to either map a few more fields from the proto to our custom message structs or just return the proto without mapping it.

from go-whatsapp.

Mikolasek93 avatar Mikolasek93 commented on June 2, 2024

Thanks a lot!
Could you point me to code, that forces web whatsapp to notify your app handlers about incoming messages? Because something like this could be done in "read" acks for my sent messages.
Or how to implement custom handler for detecting "read acks"?
Thanks!

from go-whatsapp.

SchulteMK avatar SchulteMK commented on June 2, 2024

The actual calling of the handlers happen here. You probably have to imlement an small AckMessage type and provide an handler interface for it (message types and handler interfaces). Here are the JSON messages getting "created". The ack messages are in the json format, so you have to check for acks and dispatch them seperatly with something like wac.handle(AckMessage{...}). It is probaly easier to just implement the JsonMessageHandler in your code and check for acks there

from go-whatsapp.

Mikolasek93 avatar Mikolasek93 commented on June 2, 2024

Oh i see! Perfect!

Simplified solution:
func (*WaHandler) HandleJsonMessage(message string) { fmt.Printf("STATUS RECEIVED :%v\n", message) }
Now i can extract info about message status and so on depends on ack 1-sent 2-delivered 3-read

["Msg",{"cmd":"ack","id":"xxxmessageidxxxx","ack":2,"from":"[email protected]","to":"[email protected]","t":1534427787}]
Thanks a lot!

from go-whatsapp.

tgssb avatar tgssb commented on June 2, 2024

How do I mark the message as read?

from go-whatsapp.

 avatar commented on June 2, 2024

Oh i see! Perfect!

Simplified solution:
func (*WaHandler) HandleJsonMessage(message string) { fmt.Printf("STATUS RECEIVED :%v\n", message) }
Now i can extract info about message status and so on depends on ack 1-sent 2-delivered 3-read

["Msg",{"cmd":"ack","id":"xxxmessageidxxxx","ack":2,"from":"[email protected]","to":"[email protected]","t":1534427787}]
Thanks a lot!

how do extract json in go ?
please help me

from go-whatsapp.

sunnybear avatar sunnybear commented on June 2, 2024

Can anybody tell me how to check if message has been sent (w/o returned ID). Sometimes messages are sent, but no ID returned.

from go-whatsapp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.