Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added AIgnitors.pdf
Binary file not shown.
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# iitm-submission-odyssey
Submissions for IITM Odyssey Hackathon
/devrev-social-agent/
├── social_agent.py # Main backend logic
├── config.json # API keys and configs
├── requirements.txt # Dependencies for Python
├── README.md # Hackathon-style documentation

https://youtu.be/iAsu9ylKHn0 This is My YouTube Video
Social Media AI Agent – Built at DevRev Hackathon 🚀
🌟
Project Overview :
-----------------

During the DevRev Hackathon, I built an AI-powered social media agent designed to help brands and startups manage their online presence more efficiently. The core idea behind the project was to reduce manual workload for PR and support teams by automating responses on various social media platforms like Twitter, Instagram, Discord, etc.

Today, companies spend around 30% of their PR budget just to handle customer messages, product inquiries, and feedback on social media. My AI agent steps in to solve this problem by automatically reading and responding to customer queries, tags, and posts in a polite and informative way.

💡Key Features :
-----------------

🔍 Smart Product Search: If someone wants to search for a product (like "Myntra jeans"), the agent fetches real-time results from Myntra (or other brand sites) and displays them.

💬 Auto-Response to Messages: When a social media post gets flooded with messages, the agent can auto-reply to everyone politely, saving time and effort.

🧠 Context-Aware Replies: The agent understands the nature of the query using NLP and responds accordingly.

🌐 Multi-Platform Support: Works with major platforms by using their APIs (Twitter API, Instagram Graph API, Discord Webhooks, etc.).

📊 Custom Dashboard Integration: Integrated with DevRev Agent Dashboard to monitor client interactions and messages.

🛠️ What I Built
Connected to social media APIs to read tags, mentions, messages, and user posts.

Built automated response generation using NLP techniques.

Integrated with DevRev’s Agent API for enhanced client interaction and management.

Manually set up Slack Workspaces and Discord Bots for different use cases.

Used tools like Postman for testing APIs and verifying real-time data flow.

Built a system that stays up-to-date and can be upgraded easily with minimal manual effort.

📈 Why This Matters
🧑‍💼 Companies won’t need large PR teams anymore – saving cost and time.

🤖 Startups can scale their brand presence faster without worrying about responding to every comment or tag.

⚙️ The agent acts as a virtual support and marketing assistant that works 24/7.

Technologies Used:
-------------------

Python (for backend logic and APIs)

DevRev Agent API

Twitter/Instagram/Discord APIs

Slack Bot Integration

Postman (for API Testing)

Webhooks & Custom Dashboards

🚀
Future Improvements :
--------------------
Add support for voice queries (using speech-to-text).

Build a GUI for easier configuration and control of the agent.

Integrate WhatsApp Business API and Telegram.

Add analytics panel to show engagement, response time, and sentiment analysis.

🙌Final Notes:
--------------
This project was an amazing learning experience during the DevRev Hackathon. It gave me exposure to real-world APIs, building AI agents, and solving an actual business problem. I believe this system can be a game-changer for marketing and support teams across industries.

If you have any questions or want to try the demo, feel free to reach out! 😊

9 changes: 9 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"twitter": {
"bearer_token": "YOUR_TWITTER_BEARER_TOKEN"
},
"devrev": {
"agent_token": "YOUR_DEVREV_AGENT_TOKEN"
}
}

1 change: 1 addition & 0 deletions requirement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.31.0
69 changes: 69 additions & 0 deletions social_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import requests
import json
import time

# Load API keys
with open('config.json') as f:
config = json.load(f)

TWITTER_BEARER = config['twitter']['bearer_token']
DEVREV_AGENT_TOKEN = config['devrev']['agent_token']

# Headers for Twitter API
TWITTER_HEADERS = {
"Authorization": f"Bearer {TWITTER_BEARER}",
"Content-Type": "application/json"
}

# Headers for DevRev Agent API
DEVREV_HEADERS = {
"Authorization": f"Bearer {DEVREV_AGENT_TOKEN}",
"Content-Type": "application/json"
}

# Sample tags to track
TRACK_TAGS = ["#myntra", "#support", "#query", "#delivery"]

def fetch_tweets(tag):
"""Fetch recent tweets containing a specific tag."""
url = f"https://api.twitter.com/2/tweets/search/recent?query={tag}&max_results=10&tweet.fields=text,author_id"
response = requests.get(url, headers=TWITTER_HEADERS)
if response.status_code == 200:
return response.json().get("data", [])
return []

def send_to_devrev_agent(message, user_id):
"""Send message to DevRev AI agent to generate response."""
payload = {
"user_id": user_id,
"query": message
}
devrev_endpoint = "https://api.devrev.ai/v1/agent/respond"
response = requests.post(devrev_endpoint, headers=DEVREV_HEADERS, json=payload)
if response.status_code == 200:
return response.json().get("reply", "")
return "We’ll get back to you shortly!"

def auto_reply():
"""Main loop to fetch queries and trigger DevRev agent."""
for tag in TRACK_TAGS:
posts = fetch_tweets(tag)
for post in posts:
tweet_id = post["id"]
author_id = post["author_id"]
text = post["text"]

# Generate AI response
reply = send_to_devrev_agent(text, author_id)

# Log to simulate a reply (real reply API can be added)
print(f"[{author_id}] - {text}")
print(f"Auto-Reply: {reply}")
print("-------------------------------------------------")

# Optional: Hook to Discord or Slack using Webhook (extend here)

if __name__ == "__main__":
while True:
auto_reply()
time.sleep(60) # Run every 1 minute