Skip to content

WhatsApp voice notes fail without explicit "audio/ogg; codecs=opus" mimetype #7

@adam91holt

Description

@adam91holt

Problem

When sending voice notes via WhatsApp Web, using mimetype: "audio/ogg" doesn't work properly. WhatsApp requires the full codec specification "audio/ogg; codecs=opus" for voice notes to be recognized as playable PTT (push-to-talk) messages.

Affected files

  • src/web/auto-reply.ts - when delivering auto-reply audio
  • src/web/outbound.ts - when sending outbound audio via sendMessageWeb()

Proposed fix

When media.contentType === "audio/ogg", explicitly set the mimetype to "audio/ogg; codecs=opus":

const audioMimetype =
  media.contentType === "audio/ogg"
    ? "audio/ogg; codecs=opus"
    : media.contentType;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions