All Projects → Rhymen → Go Whatsapp

Rhymen / Go Whatsapp

Licence: mit
WhatsApp Web API

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Whatsapp

Whatsapp Web Reveng
Reverse engineering WhatsApp Web.
Stars: ✭ 5,320 (+303.34%)
Mutual labels:  whatsapp, reverse-engineering
Pirogue
PiRogue is a small device meant to ease network interception and analysis.
Stars: ✭ 90 (-93.18%)
Mutual labels:  reverse-engineering
Anubis
Free open-source training software / cheat for Counter-Strike: Global Offensive, written in C.
Stars: ✭ 81 (-93.86%)
Mutual labels:  reverse-engineering
Watomatic
Auto reply app helping you move away from less private messengers like WhatsApp and soon Facebook Messenger
Stars: ✭ 83 (-93.71%)
Mutual labels:  whatsapp
Az2tf
See the new version here:
Stars: ✭ 83 (-93.71%)
Mutual labels:  reverse-engineering
Barf Project
BARF : A multiplatform open source Binary Analysis and Reverse engineering Framework
Stars: ✭ 1,280 (-2.96%)
Mutual labels:  reverse-engineering
Lookinsidethebox
Breaks the encryption and obfuscation layers that Dropbox applies to their modified Python interpreter.
Stars: ✭ 80 (-93.93%)
Mutual labels:  reverse-engineering
Zxhookutil
【iOS逆向】高效Tweak工具函数集,基于theos、monkeyDev。(含方法追踪、无须关心层级获取任意view、拦截并修改全局请求、清除keyChain数据、打印block参数、打印类的属性和方法、数据转换、数据存储、添加轮询、网络请求、加密解密等各种协助逆向分析函数)
Stars: ✭ 93 (-92.95%)
Mutual labels:  reverse-engineering
Wasapbot
[abandoned ❗] Simple WhatsApp bot written in PHP, respond to private & group messages. Uses Chat-API
Stars: ✭ 89 (-93.25%)
Mutual labels:  whatsapp
R2m2
radare2 + miasm2 = ♥
Stars: ✭ 86 (-93.48%)
Mutual labels:  reverse-engineering
Pentesting toolkit
🏴‍☠️ Tools for pentesting, CTFs & wargames. 🏴‍☠️
Stars: ✭ 1,268 (-3.87%)
Mutual labels:  reverse-engineering
Iostrace
alternative strace for iOS device(64bit) on frida
Stars: ✭ 84 (-93.63%)
Mutual labels:  reverse-engineering
Whatsapp Node Api
A Simple NodeJS API Wrapper for WhatsApp
Stars: ✭ 81 (-93.86%)
Mutual labels:  whatsapp
Php Malware Analysis
Deobfuscation and analysis of PHP malware captured by a WordPress honey pot
Stars: ✭ 82 (-93.78%)
Mutual labels:  reverse-engineering
Cutter
Free and Open Source Reverse Engineering Platform powered by rizin
Stars: ✭ 10,073 (+663.68%)
Mutual labels:  reverse-engineering
Projectchampollion
Reverse engineering Rosetta 2 in M1 Mac
Stars: ✭ 80 (-93.93%)
Mutual labels:  reverse-engineering
Bomberthon
Best Bombing Tool with WhatsApp, Instagram, SMS bomber
Stars: ✭ 84 (-93.63%)
Mutual labels:  whatsapp
Go Whatsapp Rest
Go WhatsApp Implementation in REST API
Stars: ✭ 86 (-93.48%)
Mutual labels:  whatsapp
Fundamentos Engenharia Reversa
Livro: Fundamentos de Engenharia Reversa
Stars: ✭ 93 (-92.95%)
Mutual labels:  reverse-engineering
Ida For Delphi
IDA Python Script to Get All function names from Event Constructor (VCL)
Stars: ✭ 92 (-93.03%)
Mutual labels:  reverse-engineering

go-whatsapp

Package rhymen/go-whatsapp implements the WhatsApp Web API to provide a clean interface for developers. Big thanks to all contributors of the sigalor/whatsapp-web-reveng project. The official WhatsApp Business API was released in August 2018. You can check it out here.

Installation

go get github.com/Rhymen/go-whatsapp

Usage

Creating a connection

import (
    whatsapp "github.com/Rhymen/go-whatsapp"
)

wac, err := whatsapp.NewConn(20 * time.Second)

The duration passed to the NewConn function is used to timeout login requests. If you have a bad internet connection use a higher timeout value. This function only creates a websocket connection, it does not handle authentication.

Login

qrChan := make(chan string)
go func() {
    fmt.Printf("qr code: %v\n", <-qrChan)
    //show qr code or save it somewhere to scan
}()
sess, err := wac.Login(qrChan)

The authentication process requires you to scan the qr code, that is send through the channel, with the device you are using whatsapp on. The session struct that is returned can be saved and used to restore the login without scanning the qr code again. The qr code has a ttl of 20 seconds and the login function throws a timeout err if the time has passed or any other request fails.

Restore

newSess, err := wac.RestoreWithSession(sess)

The restore function needs a valid session and returns the new session that was created.

Add message handlers

type myHandler struct{}

func (myHandler) HandleError(err error) {
	fmt.Fprintf(os.Stderr, "%v", err)
}

func (myHandler) HandleTextMessage(message whatsapp.TextMessage) {
	fmt.Println(message)
}

func (myHandler) HandleImageMessage(message whatsapp.ImageMessage) {
	fmt.Println(message)
}

func (myHandler) HandleDocumentMessage(message whatsapp.DocumentMessage) {
	fmt.Println(message)
}

func (myHandler) HandleVideoMessage(message whatsapp.VideoMessage) {
	fmt.Println(message)
}

func (myHandler) HandleAudioMessage(message whatsapp.AudioMessage){	
	fmt.Println(message)
}

func (myHandler) HandleJsonMessage(message string) {
	fmt.Println(message)
}

func (myHandler) HandleContactMessage(message whatsapp.ContactMessage) {
	fmt.Println(message)
}

func (myHandler) HandleBatteryMessage(msg whatsapp.BatteryMessage) {
	fmt.Println(message)
}

func (myHandler) HandleNewContact(contact whatsapp.Contact) {
	fmt.Println(contact)
}

wac.AddHandler(myHandler{})

The message handlers are all optional, you don't need to implement anything but the error handler to implement the interface. The ImageMessage, VideoMessage, AudioMessage and DocumentMessage provide a Download function to get the media data.

Sending text messages

text := whatsapp.TextMessage{
    Info: whatsapp.MessageInfo{
        RemoteJid: "[email protected]",
    },
    Text: "Hello Whatsapp",
}

err := wac.Send(text)

Sending Contact Messages

contactMessage := whatsapp.ContactMessage{
			Info: whatsapp.MessageInfo{ 
                RemoteJid: "[email protected]", 
                },
			DisplayName: "Luke Skylwallker",
			Vcard: "BEGIN:VCARD\nVERSION:3.0\nN:Skyllwalker;Luke;;\nFN:Luke Skywallker\nitem1.TEL;waid=0123456789:+1 23 456789789\nitem1.X-ABLabel:Mobile\nEND:VCARD",
		}

id, error := client.WaConn.Send(contactMessage)

The message will be send over the websocket. The attributes seen above are the required ones. All other relevant attributes (id, timestamp, fromMe, status) are set if they are missing in the struct. For the time being we only support text messages, but other types are planned for the near future.

Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk.

License

The MIT License (MIT)

Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].