Skip to Content
go-whatsapp-call

Overview

Place a 1:1 WhatsApp voice call from a whatsmeow session, play an audio clip once the callee answers, and hang up.

Experimental

go-whatsapp-call is still early. Things may change between releases. It's unofficial and not a WhatsApp API, so it can break with any WhatsApp update, and the number that places calls risks a ban.

go-whatsapp-call is a pure Go library (no cgo) that places a 1:1 WhatsApp voice call from a whatsmeow session. Once the callee answers, it plays your audio clip, then hangs up on its own. A small CLI in cmd/whatsapp-call links an account and places test calls.

The smallest call

res, err := call.Play(ctx, client, types.NewJID("6281234567890", types.DefaultUserServer), pcm, call.Options{
	LeadIn:      3 * time.Second,
	LeadInSound: loading, // optional, loops during LeadIn
	OutroSound:  chime,   // optional, plays after the clip
})

pcm is 16 kHz mono float samples. The callee hears the clip. Their audio is received but not decoded. call.Play blocks until the call is over and returns whether it was answered, how much of the clip played, and who hung up.

The quick start links an account with the CLI and places a first call. The Go API page has every option.

How a call works

Your Go code calls call.Play with a whatsmeow client, a phone number and the clip. Inside go-whatsapp-call, the call package signals over whatsmeow (offer, accept, hang-up), the mlow, rtp and srtp packages turn the clip into encrypted 60 ms MLow frames, and the relay package reaches a WhatsApp call relay over a WebRTC DataChannel. Stanzas and encrypted media go through WhatsApp's servers and relays to the callee's phone, which rings, answers and hears the clip.

The library sends an offer with a fresh call key, connects to the call relays the server hands back, and starts sending silent frames while the phone rings. When the callee answers, it plays an optional lead-in sound, then the clip and an optional outro, and hangs up the way the phone app does. How a call works walks through each step, and the protocol reference has the bytes.

Packages

PackageWhat it does
callsignaling over whatsmeow, relay selection, pacing, hang-up
relaySTUN relay control and the WebRTC DataChannel transport (pion)
rtpRTP with the WARP extension, plus the RTCP cadence
srtpper-direction keys, AES-CM, WARP MI tag, SRTCP
ssrcSSRC derivation
mlowMLow encoder: a libopus fork compiled to wasm, run with wazero

Before you start

  • Calling isn't part of any official WhatsApp API. It can break with any WhatsApp update, and the account placing calls risks a ban. Use a number you can afford to lose.
  • mlow/libopus.wasm is a build of a libopus fork with Meta's MLow extension. Its source and license are unclear, so don't redistribute that file.
  • Calls are one way. The callee hears your clip, and their audio is received but not decoded, so the library can't hear or record them.
  • Tests that compare against a recorded call read testdata/private/, which is git-ignored because it holds call keys and phone IDs. Without it they skip.

Status

On 2026-12-03 the library placed its first full call from Go: the phone rang, the callee answered and heard the clip, and the library hung up by itself.

Open questions:

  • Downlink decryption. Not needed for one-way playback, but needed for two-way calls later.
  • Whether plain Opus frames play on the phone. If they do, stock libopus (BSD) compiled to WebAssembly could replace the MLow build.

On this page