Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists

This is a submission for the Twilio Challenge

What I Built

I built a WhatsApp chatbot using Twilio that generates a personalized playlist of 5 songs based on the user’s current mood. When a user sends a message to +1 (856) 975-0130 startin…


This content originally appeared on DEV Community and was authored by İren SALTALI

This is a submission for the Twilio Challenge

What I Built

I built a WhatsApp chatbot using Twilio that generates a personalized playlist of 5 songs based on the user's current mood. When a user sends a message to +1 (856) 975-0130 starting with "Hi", the bot prompts them to share how they are feeling. It then analyzes the sentiment of their response and curates a playlist to match their emotional state.

Demo

You can try out the chatbot by sending a WhatsApp message to +1 (856) 975-0130 (You can use QR code below). Start your message with "Hi" and then share your current mood when prompted. The bot will respond with a playlist of 5 songs tailored to your emotional state.

WhatsApp QR Code

Twilio and AI

This project leverages Twilio's WhatsApp API to enable interactive chat and Twilio Studio & Twilio Functions to handle the chatbot logic. When a message is received from the user, it is forwarded to Cloudflare Workers AI for sentiment analysis.

Cloudflare Workers AI is used to perform sentiment analysis on the user's mood description. The AI model detects the sentiment of the text as positive, negative or neutral. Based on the detected mood, an appropriate search query is generated and sent to the Spotify API to retrieve a playlist of songs matching that emotional state. The playlist is then returned to the Twilio Function, which sends it back to the user via WhatsApp messages.

Twilio enabled quick development of the chat interface, while Cloudflare Workers AI allowed seamless analysis of the user's mood without needing to manage infrastructure. By leveraging AI capabilities, relevant Spotify queries could be generated to curate personalized playlists. Integrating these technologies resulted in an engaging, mood-based music recommendation experience delivered through WhatsApp.

Twilio Studio Flow

Twilio Studio Flow

Twilio Functions Code

GitHub Repository

Additional Prize Categories

  • Entertaining Endeavors: This chatbot provides a fun and interactive way to discover music that resonates with your current mood.
  • Twilio Times Two: This app uses Twilio's WhatsApp API, Twilio Studio for workflow automation, Twilio Functions to create a conversational experience that generates personalized playlists based on the user's mood, and Twilio CLI for building and deploying the project.


This content originally appeared on DEV Community and was authored by İren SALTALI


Print Share Comment Cite Upload Translate Updates
APA

İren SALTALI | Sciencx (2024-06-23T20:00:00+00:00) Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists. Retrieved from https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/

MLA
" » Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists." İren SALTALI | Sciencx - Sunday June 23, 2024, https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/
HARVARD
İren SALTALI | Sciencx Sunday June 23, 2024 » Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists., viewed ,<https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/>
VANCOUVER
İren SALTALI | Sciencx - » Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/
CHICAGO
" » Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists." İren SALTALI | Sciencx - Accessed . https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/
IEEE
" » Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists." İren SALTALI | Sciencx [Online]. Available: https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/. [Accessed: ]
rf:citation
» Mood-Based Music: A WhatsApp Chatbot That Curates Personalized Playlists | İren SALTALI | Sciencx | https://www.scien.cx/2024/06/23/mood-based-music-a-whatsapp-chatbot-that-curates-personalized-playlists/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.