diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..09eca3a Binary files /dev/null and b/.DS_Store differ diff --git a/AIgnitors.pdf b/AIgnitors.pdf new file mode 100644 index 0000000..11a96f4 Binary files /dev/null and b/AIgnitors.pdf differ diff --git a/README.md b/README.md index e42dc6f..f5aab09 100644 --- a/README.md +++ b/README.md @@ -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! 😊 + diff --git a/config.json b/config.json new file mode 100644 index 0000000..c5c3c47 --- /dev/null +++ b/config.json @@ -0,0 +1,9 @@ +{ + "twitter": { + "bearer_token": "YOUR_TWITTER_BEARER_TOKEN" + }, + "devrev": { + "agent_token": "YOUR_DEVREV_AGENT_TOKEN" + } + } + \ No newline at end of file diff --git a/requirement.txt b/requirement.txt new file mode 100644 index 0000000..2c24336 --- /dev/null +++ b/requirement.txt @@ -0,0 +1 @@ +requests==2.31.0 diff --git a/social_agent.py b/social_agent.py new file mode 100644 index 0000000..fb76681 --- /dev/null +++ b/social_agent.py @@ -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