Context
Slack mobile supports voice messages (audio clips). When sent to Shellack, the event arrives with empty text and the audio as a files attachment. The bot currently sends the empty text to the API, causing a 400 error: user messages must have non-empty content.
Error
anthropic.BadRequestError: Error code: 400 - messages.0: user messages must have non-empty content
Proposed fix
- Detect audio files in the Slack event (
event.get("files", []) where filetype is mp4/webm/ogg/m4a)
- Download the audio via Slack API (
files.info + authenticated URL)
- Transcribe using one of:
- OpenAI Whisper API — $0.006/min, best accuracy, requires OpenAI key
- Local Whisper —
whisper CLI or faster-whisper Python, free, needs model download (~1.5GB)
- Deepgram — real-time transcription API, pay-per-use
- Use transcript as prompt — feed to the agent as if the user typed it
- Post transcript as a thread reply so the user can verify what was understood
Immediate fix (before transcription)
At minimum, handle the empty-text case gracefully:
if not prompt.strip():
if event.get("files"):
app.client.chat_postMessage(
channel=channel_id, thread_ts=thread_ts,
text="Voice messages aren't supported yet — type your message or try again with text."
)
return
Priority
Medium — nice UX improvement for mobile users. The immediate graceful error should ship now.
Context
Slack mobile supports voice messages (audio clips). When sent to Shellack, the event arrives with empty
textand the audio as afilesattachment. The bot currently sends the empty text to the API, causing a 400 error:user messages must have non-empty content.Error
Proposed fix
event.get("files", [])wherefiletypeismp4/webm/ogg/m4a)files.info+ authenticated URL)whisperCLI orfaster-whisperPython, free, needs model download (~1.5GB)Immediate fix (before transcription)
At minimum, handle the empty-text case gracefully:
Priority
Medium — nice UX improvement for mobile users. The immediate graceful error should ship now.