Skip to content

Experimental

Place a WhatsApp voice call from Go and play a clip

A pure Go library that rings a number from your whatsmeow session and hangs up once the clip is done

Read the docs
whatsapp-call
$ ./whatsapp-call call 6281234567890 clip.mp3
calling 6281234567890 with 3.6s of audio
call 3EB0C0FFEE00000000000000000000AB: answered=true played=4.92s ended by us
  1. Offer sentthe call key goes to each device, Signal-encrypted
  2. Relay readySTUN allocate over a DataChannel
  3. Phone ringssilent frames every 60 ms
  4. Answereda short lead-in sound loops
  5. Clip playsMLow frames, then the outro
  6. Hung upterminate, then wait for the ack
The CLI rings, waits for the answer, plays the clip and hangs up on its own

One function call

It blocks until the call is over and tells you how it went. Go API →

res, err := call.Play(ctx, client, jid, pcm, call.Options{
	LeadIn:      3 * time.Second,
	LeadInSound: loading, // optional, loops during LeadIn
	OutroSound:  chime,   // optional, plays after the clip
})
In
A whatsmeow client
A phone number or LID
16 kHz mono samples
Out
Answered or not
How much played
Who hung up

Read this before you call

Use your own numbers, and a calling number you can afford to lose. Before you start →

  • UnofficialSpeaks the protocol the apps use with no official API behind it
  • Can breakAny WhatsApp update can change that protocol
  • Ban riskThe number that places calls can get banned
  • One wayThe callee hears you but their audio isn't decoded
  • Codec licenselibopus.wasm is a libopus fork with Meta's MLow extension and an unclear license

Ring, play, hang up

Link a device, then place your first call from the CLI