rhymen / go-whatsapp Goto Github PK
View Code? Open in Web Editor NEWWhatsApp Web API
License: MIT License
WhatsApp Web API
License: MIT License
Hello, i cannot send images as used in example. Worked before. Now image is sent, but it cannot be opened within WhatsApp in phone. It stucks app when i click on the photo, there is also no thumbnail.
Could you update examples for images/file sending?
Thanks a lot for your great work!
EDIT: Tried exactly your code from examples and it works, probably fault in my code, sorry for opening invalid ticket, please close it.
Is there a way I can retrieve the name of the RemoteJID?
I wanted to see the registered name or even just the username of the person who sent me a message.
The Python version of this i think have one and it also just listens to the web socket of whatsapp that's why I am wondering where I can get the name or even just the username?
Is it possible to open more than one session?
The idea is, each session has an id. When the app try to restore the session, I give this id and this specific session will be restored.
I'm not go developer,
can you please create example echo-ing message received.
Receive and send the same message to sender.
something like
func (*waHandler) HandleTextMessage(message whatsapp.TextMessage) {
if strings.Contains(strings.ToLower(message.Text), "hello") {
msg := whatsapp.TextMessage{
Info: whatsapp.MessageInfo{
RemoteJid: message.Info.RemoteJid,
},
Text: message.Text
}
wac.Send(msg)
}
fmt.Printf("%v %v\n\t%v\n", message.Info.Timestamp, message.Info.RemoteJid, message.Text)
}
Hey great work on this package! Thank you and please keep it up!
Can you tell how I can check if the message I sent was
(a) delivered(2 ticks) to the receiver
(b) read(blue ticks) by the receiver
Hi,
is it possible to check whether number has WhatsApp or not?
Because right now, I can send message to non existing numbers, which leads to fail of mobile application when you click on wrong number conversation on your phone.
Thanks a lot!
Hello, Can We check wether our message is already read by the recepients ?
Hello, is it possible to get the PushName of the contact?
Hey,
I would like to query the group information.
I use the GroupMetaData
function. But i only recive a hex code like 0xc04467b260
But should I not receive something like that? sigalor/whatsapp-web-reveng#73
Thats my code:
groupMeta, err := wa.GetGroupMetaData(message.Info.RemoteJid)
if (err != nil){
fmt.Println("ERROR! %v", err)
}
fmt.Println(groupMeta)
p.s. Good work!
Hi, thanks for the wonderful project!
Is it possible to retrieve group members?
How send message ["Presence",{"id":"[email protected]","type":"available"}]
in my code?? For the user to see that I read the message.
I've seen in another repo that figured out sending messages, presumably through this wrapper? And am wondering when that code will be available.
It doesn't need to be very polished I would just like to see how you implemented it.
To know to which message the confirmation (Ack) came I need to know the ID of the sent message. How to get the ID when sending a message?
I also used the function of Contacts(), and it looks like when you tries to populate the store with contacts, the code panics with the following stack:
I tried to understand the cause, and it looks like on the conn.go file line 242, you assume the the msg has at least length of 32 bytes, but I added few print outs, and the msg is empty in some cases (with len of 0)
Any idea how to fix this issue?
echo: http: panic serving [::1]:61067: runtime error: slice bounds out of range
goroutine 34 [running]:
net/http.(*conn).serve.func1(0xc0421920a0)
C:/Go/src/net/http/server.go:1726 +0xd7
panic(0x881be0, 0xb9f680)
C:/Go/src/runtime/panic.go:502 +0x237
github.com/Rhymen/go-whatsapp.(*Conn).decryptBinaryMessage(0xc04219a1c0, 0xbcba08, 0x0, 0x0, 0x0, 0x0, 0x800a)
C:/workspaces/src/github.com/Rhymen/go-whatsapp/conn.go:242 +0x3d2
github.com/Rhymen/go-whatsapp.(*Conn).query(0xc04219a1c0, 0x90e2a3, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
C:/workspaces/src/github.com/Rhymen/go-whatsapp/contact.go:155 +0x40c
github.com/Rhymen/go-whatsapp.(*Conn).Contacts(0xc04219a1c0, 0x0, 0x0, 0xbcba08)
C:/workspaces/src/github.com/Rhymen/go-whatsapp/contact.go:103 +0x7d
myproject/server/business/whats.(*waSession).GetContacts(0xc042055c18, 0x0, 0x0, 0x8e8bc0, 0x0, 0x0)
C:/workspaces/src/myproject/server/business/whats/session.go:79 +0x83
myproject/server/rest.whatsAppContacts(0x970640, 0xc04219a150, 0xc04219a000, 0xc0421621e0)
Hello dear developper !
When receiving images with text, how to get the text message?
If it is not already developped, how could I contribute?
Thanks you to share this with the world !
Jehon
Is it possible to send and receive Location share ?
Hello,
I put the application to run, but after a while it automatically exits.
Is it a bug?
how i can create new group and how i can set only admin send message .
Regards
After I removed the whatsapp web session on the phone, the go-whatsapp became unusable.
I'm not a go developer, so I can understand the source, but the architecture I have no idea. Where is the session saved?
I try this go-whatsapp, its always showing message timed out.
Althought sometimes the message delivered.
I've tried both on linux (centos 7) and windows, in average the connection timeout always occured.
When I'm increasing 5 to 50
wac, err := whatsapp.newConn(5 * time.Second)
The timeout error gone, but the sending process are too slow.
Good afternoon Guys, I'm getting this error when I just connected and are receiving the messages
error decoding binary: error decoding binary: invalid jid pair: rci -
Hello,
your api works like a charm, but we would love to remove old conversation after some time.
Is it possible from this api?
Thanks!
can you give the example to use this library?
i don't understand to use this.
Hello I have a problem.
go-whatsapp doesn't have a response/listen when the device used to scan the QR code have no internet access
I have discuss this to the other programmer that made our system before using yowsup (https://github.com/tgalal/yowsup) and that yowsup have their own registration and device for the authentication for whatsapp
Point: it is possible to connect to whatsapp web without scanning the QR code
Issue: I wanted to do that also. spawn an emulator then use that android emulator credentials to register to whatsapp then use that emulator to login to whatsapp wihout scanning the QR code
Requirements: This should all happen only in our linux server
groupMeta, err := wac.GetGroupMetaData(id)
if err != nil {
fmt.Println("ERROR! %v", err)
}
fmt.Println(<-groupMeta)
result
{"status":400}
how to get group name?
why can't receive reply chats?
I've been trying to investigate this issue for a while now, and I can't figure it out. Maybe you can find a solution for this issue...
I have 3 devices: A, B and C.
I have connected the go-whatsapp to device A, and in it i called SubscribePresence() for both B and C.
However, I only get presence updates for B, and no updates at all for C.
Moreover, if I turn the screen on the mobile A on and go into the chat with C (seeing the "Last seen" at the top) - from that point I start getting presence updates for C on go-whatsapp.
I suspect that SubscribePresence() is not enough for getting a device's presence updates and maybe another thing should be called to make it happen.. something that the actual WhatsApp application calls or that the actual WhatsApp Web calls and is missing here in go-whatsapp.
As a lead, I think that only when we get the "Last seen" working, it will finally be solved..
Another lead, C was never saved as a contact on device A (that means that I see its number in the chat list).
(B was once saved as a contact on device A but in order to check if having a device saved as a contact is necessary for the presence updates, I deleted B from device A.. and it still works)
I will appreciate your help.
Thanks.
Lines 19 to 59 in 1c2b085
All respect to your work, your projects work like a charm and sending messages is ultra fast, which is not I can tell about my "stupid selenium solution".
Are you willing to implement file sending feature?
Thanks for your work!
Is it available to determine, if message was read by end-user?
Could you please provide handler example? Thanks!
When I try sent message, It sent to my number.
How to set it to my other friend number?
How to send an audio? what is the mimetype? and else..
Hi Team,
I am contributing in Sigalor whatsapp-web-reveng and stuck in sent message function.
I have created payload and able to send message but it does not work sometimes. Can someone describes the payload structure and sample code for help.
Hey guys, I was testing the api, and it works like charm, but for some cases, the number is banned right after reading the qr code.
What i investigated is the following:
for newly created whatsapp accounts, the received protoversion in CONN is 17 and when you read the qr code you are banned maybe because we are talking in an old protobuff version.
I tried with a previous number that i had and the protoversion in this case is 15 and the api works like a charm.
do you guys have any ideia about this? have you ever faced something similar?
This snippet is sending the message correctly, but it does not return success.
msg := whatsapp.TextMessage{
Info: whatsapp.MessageInfo{
RemoteJid: "[email protected]",
},
Text: "testing...",
}
err = wac.Send(msg)
The error:
error sending message: sending message timed out
The script is examples/sendTextMessages/main.go
Is there a way I can get only the unread messages when restoring the session?
As it seems, the session info field named 'Is24h' may be empty, so a safer conversion should be used instead of the current info["is24h"].(bool)
(in session.go, line 78).
panic: interface conversion: interface {} is nil, not bool
goroutine 1 [running]:
github.com/Rhymen/go-whatsapp.newInfoFromReq(0xc0421140f0, 0xc042114180)
C:/Workspace/GoProjects/WhatsAppWeb/src/github.com/Rhymen/go-whatsapp/session.go:78 +0xa7c
github.com/Rhymen/go-whatsapp.(*Conn).RestoreSession(0xc0420da070, 0xc042102380, 0x18, 0xc04210e2a0, 0x2c, 0xc042014240, 0x52, 0xc0421023a0, 0x20, 0x20, ...)
C:/Workspace/GoProjects/WhatsAppWeb/src/github.com/Rhymen/go-whatsapp/session.go:319 +0x15d0
github.com/Rhymen/go-whatsapp/automation/infra.Login(0xc0420da070, 0xc04213a080, 0x40, 0x40, 0x0)
C:/Workspace/GoProjects/WhatsAppWeb/src/github.com/Rhymen/go-whatsapp/automation/infra/login.go:16 +0x37c
main.main()
C:/Workspace/GoProjects/WhatsAppWeb/src/github.com/rhymen/go-whatsapp/automation/automation.go:113 +0x422
error sending message: error decoding sending response: unexpected end of JSON input
Problem only occurs with Mac OS X, would you have an idea why this happens?
I'm not an expert on GO.
It started after the last commit.
I want to create a tool to export a chat. Getting the chat history with LoadMessages
works fine. The problem is, that it returns *proto.WebMessageInfo
(in Node.Content
) that has to be parsed with parseProtoMessage
which isn’t exported. It is possible to parse it manually, but it is too complex considering that such a function already exists.
Am I missing an easy way to get TextMessage
s, ImageMessage
s, etc… via LoadMessages
?
Do you think exporting parseProtoMessage
is an option? I implemented this as a workaround and it seems to work well.
You have a example for send and receive messages in the same main program
great work
I did not find any method for stopping connection and running gorutins like:
go wac.readPump ()
go wac.writePump ()
go wac.keepAlive (20000, 90000)
I just wrapped the bot in the web interface that the bot activates. And I want to turn it off without closing the whole application. I wanted to close using the context.WithCancel but this is not enough
And... Does whatsapp ban a bots?
@Rhymen I didn't find your e-mail, so trying to contact by here :)
Since you managed to create an implementation of whatsapp-web-reveng from scratch in Go, you have the knowledge to do the 2 adjustments that we need.
We need an easy way to send and receive messages in the JS code of the base project, basically what you did in your examples/sendTextMessages implementation, which works perfectly.
payload
contains the received message, the sender JID, the timestamp and the message JID/ID.
Example: sendMessage(payload).
Are you available for freelance work to do that? If so, please contact me at [email protected] (this is a work to be integrated in our platform https://fredbots.com).
How do I call the updateContacts
function in my code. I need get client's name when send message as soon as I start a conversation.
I tried use message.Info.PushName
and didn't work as well... It is bug?
Currently the Send
method is implemented sort of in a fire and forget way. I'm not sure how to get the message ID of a sent message. Messages sent are not echoed back either.
Hi, first of all, thank you for this great work
I wonder if is there any way to receive only the new messages when I restore the session
Hi, it is possible to send vcard
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.