An emotion-based anonymous matching system built on Series iMessage API. Connect users experiencing similar emotions for anonymous peer support.
Link is a Series-native messaging agent that uses emotion detection to anonymously match strangers who are feeling similar emotions. Once matched, users can have private, anonymous conversations where their messages are relayed through the system. Phone numbers stay completely private.
- Emotion Detection: Automatically detects emotions from natural text (stressed, sad, anxious, lonely, happy)
- Anonymous Matching: Pairs users experiencing similar emotions
- Message Relaying: Messages are relayed anonymously between matched users
- AI Support: Optional integration with Gemini or Claude API for empathetic responses
- Privacy-First: Each user communicates through their own private chat with the bot
pip install -r requirements.txtEdit the configs file (not config.py) and update the required fields:
SENDER_NUMBER- Your sender phone number from the Series dashboardAPI_KEY- Your Series API keyAPI_BASE_URL- The base URL for the Series API (default:https://api.series.im)- Kafka configuration (bootstrap servers, topic, consumer group, credentials)
- Optional:
GEMINI_API_KEYorCLAUDE_API_KEYfor AI responses
See config.py for the expected format (it's a reference file).
python3 link.pyThe system will connect to Kafka and start listening for messages.
-
User Texts Link - Users send messages expressing their emotions (e.g., "I feel stressed" or "I'm really sad today")
-
Emotion Detection - Link analyzes the message to detect the primary emotion:
- Stressed/overwhelmed
- Sad/down
- Anxious/worried
- Lonely
- Happy/excited
-
AI Response - Link sends an empathetic initial response (using AI if configured, or fallback messages)
-
Matching - Link searches for another user with the same emotion in the queue. If found, they're matched immediately; otherwise, the user joins the waiting queue.
-
Connection - When matched, both users receive a welcome message and are connected through separate private chats.
-
Anonymous Messaging - Messages are relayed anonymously between users. Each message appears as "Stranger: [message]" to maintain privacy.
-
Disconnect - Users can type
/stopat any time to end the conversation.
- Kafka Consumer: Listens for
message.receivedevents from Series - In-Memory State: Tracks user states, emotion queues, and matches
- Series API: Sends messages via
POST /api/chatsandPOST /api/chats/{chat_id}/chat_messages - Event-Driven: Reacts to incoming messages in real-time
- LLM Integration: Optional Gemini/Claude API for empathetic responses
Link uses keyword-based emotion detection to categorize messages. It recognizes natural language expressions like:
- "I'm stressed", "overwhelmed", "burned out"
- "I feel sad", "down", "depressed"
- "I'm anxious", "worried", "panicking"
- "I'm lonely", "alone", "isolated"
- "I'm happy", "excited", "thrilled"
/stop,stop,/end,/quit,/leave- Disconnect from current match
The system includes a demo mode (enabled by default) that automatically creates a second user after 10 seconds if only one person is in the queue. This makes it easy to test with a single phone.
- Phone numbers are never shared between matched users
- All communication is anonymous
- Each user has their own private chat thread with the bot
- Messages are prefixed with "Stranger:" when relayed
- Register phone numbers in the Series dashboard
- Update the
configsfile with your credentials - Run
python3 link.py - Text the sender number from registered phones
- Express an emotion naturally
- Wait to be matched (or use demo mode for instant matching)
- Start chatting anonymously!
-
Phone 1: "Hey, I'm feeling really stressed about work"
- Link: "I hear you - stress can be really overwhelming. I'm looking for someone who gets what you're going through. Hang tight."
-
Phone 2: "I'm so overwhelmed with everything"
- Link: "I hear you - stress can be really overwhelming. I'm looking for someone who gets what you're going through. Hang tight."
- Link: "You've been connected! You're both here because you're feeling stressed..."
-
Phone 1: "Hello?"
- Phone 2 sees: "Stranger: Hello?"
-
Phone 2: "Hi! Yeah work is crazy"
- Phone 1 sees: "Stranger: Hi! Yeah work is crazy"
-
Continue chatting anonymously, type
/stopto disconnect
- Python 3.7+
- Series API account and credentials
- Kafka access (provided by Series)
- Optional: Gemini or Claude API key for enhanced responses