Skip to content

AudioNotificationContent Not Received by WhatsApp Recipients #43865

@sammydeprez

Description

@sammydeprez

Package Information

  • Package Name: azure-communication-messages
  • Package Version: 1.2.0b1 | 1.1.0
  • Operating System: macOS (darwin-arm64)
  • Python Version: 3.11

Describe the bug

When sending audio notifications via AudioNotificationContent through Azure Communication Services to WhatsApp recipients, the messages are never received by the recipient. However, both ImageNotificationContent and TextNotificationContent work without any issues using the same channel registration and recipients.

The C# SDK successfully sends audio notifications with the same media URIs and configuration, suggesting this is a Python SDK-specific issue.

To Reproduce

Steps to reproduce the behavior:

  1. Initialize the NotificationMessagesClient with a valid connection string:
from azure.communication.messages.aio import NotificationMessagesClient
from azure.communication.messages.models import AudioNotificationContent

connection_string = ""
client = NotificationMessagesClient.from_connection_string(connection_string)
  1. Create an AudioNotificationContent object with a valid media URI:
channel_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
recipients = ["1234567890"]
media_url = "<url to public mp3 file>"

audio_notification = AudioNotificationContent(
    channel_registration_id=channel_id,
    to=recipients,
    media_uri=media_url
)
  1. Send the notification:
await client.send(audio_notification)

Returns a receipt with messageId

  1. Check WhatsApp on the recipient's device - no message is received

Expected behavior

The audio notification should be delivered to the WhatsApp recipient, similar to how ImageNotificationContent and TextNotificationContent are successfully delivered.

When using the same configuration with the C# SDK, audio notifications are delivered successfully, indicating the issue is specific to the Python SDK implementation.

Working alternatives (for comparison)

These notification types work correctly with the same configuration:

Text (Works):

text_notification = TextNotificationContent(
    channel_registration_id=channel_id,
    to=recipients,
    content="Hello from Azure Communication Services via WhatsApp!"
)
await client.send(text_notification)  # ✅ Received successfully

Image (Works):

image_notification = ImageNotificationContent(
    channel_registration_id=channel_id,
    to=recipients,
    media_uri="https://aka.ms/acsicon1",
    content="Check out this image!"
)
await client.send(image_notification)  # ✅ Received successfully

Audio (Does NOT work):

audio_notification = AudioNotificationContent(
    channel_registration_id=channel_id,
    to=recipients,
    media_uri=media_url
)
await client.send(audio_notification)  # ❌ Not received

Workaround attempted

Tried using the generic NotificationContent with explicit kind parameter:

general_notification = NotificationContent(
    {
        "channelRegistrationId": channel_id,
        "to": recipients,
        "kind": "audio",
        "mediaUri": media_url
    }
)
await client.send(general_notification)  # Result: Similar result

Additional context

  • Multiple media URIs have been tested (both Azure Blob Storage URLs with SAS tokens and public URLs)
  • All media URIs are accessible and return valid audio content when accessed directly
  • The same media URIs work when used with the C# SDK
  • No exceptions or errors are raised by the Python SDK - the send() method completes successfully
  • The issue persists across different audio formats (MP3, OGG)
  • Channel registration ID and recipient numbers are confirmed valid (they work for text and image)
  • Connection string and authentication are working (confirmed by successful text/image delivery)

Investigation needed

  1. Compare the HTTP request payloads between Python and C# SDKs when sending audio notifications
  2. Verify if there's a difference in how AudioNotificationContent serializes the request body
  3. Check if there are any missing or incorrectly set properties specific to audio content in the Python implementation
  4. Validate the kind field value being sent in the Python SDK request

Environment

  • Azure Communication Services: Advanced Messaging (WhatsApp)
  • Function App: Azure Functions (Flex Consumption, Python 3.11)
  • Storage: Azure Blob Storage with SAS token authentication
  • Audio files: MP3 format, stored in Azure Blob Storage with proper MIME types

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Communication - MessagesService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions