Expressive Voice Communication: Audio messages enable rich emotional expression and detailed communication through voice recordings. Support for MP3 and WAV formats with up to 1GB file size allows for everything from quick voice notes to detailed audio content.

Audio Messaging Overview

Audio messages provide intimate and expressive communication capabilities, allowing users to convey emotions, tone, and detailed information that text cannot capture. Perfect for voice notes, recordings, and rich audio content.

Voice Expression

Rich emotional communication
  • Convey tone and emotion naturally
  • Quick voice notes and responses
  • Detailed audio explanations
  • Personal touch in conversations

Format Support

Flexible audio handling
  • MP3 and WAV format support
  • Up to 1GB file size capacity
  • Cross-platform compatibility

Platform Implementation

Unified audio handling with automatic uploadMobile SDKs provide streamlined audio messaging with automatic upload processing, eliminating the need for separate upload steps.

Required Parameters

ParameterTypeDescription
subChannelIdStringTarget subchannel identifier for the audio message
attachmentAudio/URILocal audio file path or URI reference

Optional Parameters

ParameterTypeDescription
captionStringText description or transcript for the audio
fileNameStringCustom filename for the uploaded audio
tagsArray<String>Message categorization and filtering tags
parentIdStringParent message ID for threaded conversations
metadataObjectCustom properties for extended functionality

Implementation Examples

// Create audio message with local file
let audioUrl = URL(fileURLWithPath: "/path/to/local/audio.mp3")
let options = AmityAudioMessageCreateOptions(
    subChannelId: "subChannel-123",
    attachment: .localURL(url: audioUrl),
    fileName: "voice_note.mp3",
    tags: ["voice-note", "quick-update"],
    parentId: nil
)

do {
    let message = try await messageRepository.createAudioMessage(options: options)
    print("Audio message sent: \(message.messageId)")
    
    // Access audio details
    if let audioData = message.data as? AmityMessageAudioData {
        print("Audio duration: \(audioData.duration) seconds")
        print("File size: \(audioData.fileSize) bytes")
    }
} catch {
    // Handle upload or creation error
    print("Failed to send audio: \(error)")
}
Automatic Processing: Mobile SDKs handle audio upload and format optimization automatically, providing seamless user experience with progress tracking.

Audio Message Features

Implementation Strategy: Start with basic audio messaging using platform-specific patterns (unified upload for mobile, two-step for web), then add recording capabilities, transcription features, and advanced metadata. Always validate audio formats and implement proper progress feedback for optimal user experience.