DEV Community

sb
sb

Posted on

๐ŸŽง I Built an AI That Recommends Songs Based on Your Mood

Github Link - https://github.com/Sbtech24/music-recommender-AI-agent
Ai Agent api deployed on mastra cloud - https://early-quick-train.mastra.cloud/a2a/agent/musicRecommenderAgent
Have you ever wanted a bot that just gets how you feel and recommends the perfect music for your mood? Thatโ€™s exactly what I recently built โ€” a Music Recommender Bot powered by Mastra and Telex.

Itโ€™s a simple idea: you tell the bot how youโ€™re feeling, and it replies with songs that match your vibe โ€” happy, sad, chill, or energetic. But behind that simplicity is a really interesting use of AI agents, APIs, and automation.

๐Ÿ’ก The Idea

Music is emotional. Iโ€™ve always believed technology should be too. Instead of static playlists, what if an AI could understand your mood and personalize recommendations instantly?

That thought led me to experiment with Mastra, a framework for creating AI-powered agents, and Telex, a platform that makes it easy to integrate such agents into real-world workflows.

โš™๏ธ The Tools I Used

Mastra โ€” to build and deploy my AI agent.

Telex โ€” to connect the agent so anyone can talk to it.

Music API โ€” to fetch real song data based on mood keywords.

TypeScript โ€” to handle the logic cleanly and reliably.

๐Ÿง  How It Works

The bot starts by asking, โ€œHow are you feeling today?โ€

Once you reply (for example, โ€œI feel happyโ€), it fetches songs that match your mood and sends them back as recommendations โ€” complete with song titles and links.

The best part? You can talk to it naturally. You donโ€™t need to type โ€œsearch happy songs.โ€ Just express your emotions, and the AI figures out what to do next.

๐Ÿ”Œ Integrating with Telex

After building and deploying the bot on Mastra Cloud, I connected it to Telex using webhooks.

That connection allows the bot to handle real-time messages, process moods, and respond with curated song lists โ€” all through Telexโ€™s A2A (App-to-App) communication system.

Once integrated, the bot becomes part of a larger automation ecosystem where it can be triggered, combined, or extended easily.

๐Ÿช„ The Result

When I message the bot saying โ€œIโ€™m feeling down today,โ€ it responds with:

โ€œIโ€™ve got some songs that might lift your mood โ€” here are a few youโ€™ll enjoy ๐ŸŽถโ€

And then it lists cheerful tracks pulled from the music API.

Itโ€™s a small but powerful experience โ€” one that blends AI, empathy, and technology beautifully.

๐Ÿš€ What I Learned

This project taught me how flexible and powerful Mastra agents can be, especially when combined with Telex.

I also learned a lot about how structured communication (like JSON-RPC) powers integrations behind the scenes. Itโ€™s fascinating to see how a few lines of configuration can connect entire systems.

Top comments (0)