Talking Ben API
Back to ChatA simple decision-making API that returns random responses like Talking Ben.
Audio Player
Play any audio file directly
Try It Out
Test the API endpoints
GET /api/yesno
Returns only yes or no as JSON (50/50 chance)
// Response
{
"decision": "yes" | "no",
"message": "Yes!" | "No!",
"timestamp": "2024-01-01T00:00:00.000Z"
}GET /api/yesno/audio
Returns only yes or no as MP3 audio (50/50 chance)
// Returns: audio/mpeg (MP3 file) // Headers: // X-Decision: "yes" | "no" // Query Parameters: ?decision=yes // Force yes response ?decision=no // Force no response
GET /api/decision
Returns a random decision from all 4 options as JSON
// Response
{
"decision": "yes" | "no" | "hahaha" | "urgh",
"message": "Yes! Go for it!",
"audioUrl": "/audio/yes.mp3",
"introAudioUrl": "/audio/ben.mp3",
"ringAudioUrl": "/audio/ring.mp3",
"timestamp": "2024-01-01T00:00:00.000Z"
}GET /api/decision/audio
Returns a random MP3 from all 4 options
// Returns: audio/mpeg (MP3 file) // Headers: // X-Decision: "yes" | "no" | "hahaha" | "urgh" // Query Parameters: ?intro=true // Returns "Ben" intro ?ring=true // Returns phone ring ?decision=yes // Force specific response
Direct Audio Files
Access audio files directly via URL
- /audio/ring.mp3Phone Ring
- /audio/ben.mp3Ben Intro
- /audio/yes.mp3Yes
- /audio/no.mp3No
- /audio/hahaha.mp3Hahaha
- /audio/urgh.mp3Urgh
Usage Examples
How to use the API in your code
// Yes/No only (JSON)
const res = await fetch('/api/yesno')
const data = await res.json()
console.log(data.decision) // "yes" or "no"
// Yes/No only (Audio)
const audio = await fetch('/api/yesno/audio')
const decision = audio.headers.get('X-Decision')
// All 4 responses (JSON)
const res = await fetch('/api/decision')
const data = await res.json()
console.log(data.decision) // "yes", "no", "hahaha", or "urgh"
// All 4 responses (Audio)
const audio = await fetch('/api/decision/audio')
const blob = await audio.blob()
const url = URL.createObjectURL(blob)
new Audio(url).play()