Skip to content

Jishant9/ask-bot-vercel

Repository files navigation

# AI Task Manager for Excel in OneDrive with Teams Integration This tool helps teams manage daily tasks by collecting updates from team members via Microsoft Teams and storing them in an Excel file located in OneDrive/SharePoint. ## Recent Updates - Added direct SharePoint Excel update feature using Microsoft Graph API - No longer requires opening the browser to update the SharePoint file - Multiple authentication methods (client credentials, interactive login) - Automatic fallback to local mode if SharePoint access fails - Added Microsoft Teams integration with daily prompts to team members - Improved spelling and grammar checking with intent-based analysis - Configured to send reminders without automatically generating tasks - The script now supports direct access to OneDrive files using Microsoft Graph API with document ID-based access ### Features - Automatically sends daily task prompts to team members via Microsoft Teams at scheduled times - Team members respond directly in Teams with their task updates - Uses Gemini AI with intent-based analysis to parse natural language into structured data - Writes data to a shared Excel file in OneDrive - Automatic fallback to local file if online access fails - Multiple authentication methods for maximum reliability ## Setup ### 1. Environment Variables Create a `.env` file with the following variables: ``` GOOGLE_API_KEY=your_google_api_key_here CLIENT_ID=your_azure_app_client_id_here CLIENT_SECRET=your_azure_app_client_secret_here TENANT_ID=your_azure_tenant_id_here USER_EMAIL=email_of_onedrive_owner@example.com TEAMS_WEBHOOK_URL=https://example.webhook.office.com/webhookb2/your-webhook-id-here ``` ### 2. Microsoft Teams Integration To set up the Teams integration: 1. Open the Microsoft Teams channel where you want to receive notifications 2. Click on the "..." menu next to the channel name 3. Select "Connectors" 4. Find and select "Incoming Webhook" 5. Configure a name and image for your webhook 6. Copy the generated webhook URL 7. Add this URL as `TEAMS_WEBHOOK_URL` in your `.env` file ### 3. Excel Configuration You can automatically configure the script by updating these variables in `main.py` if needed: ```python EXCEL_FILE_NAME = "MoM AI Agent.xlsx" USER_EMAIL = "your.email@company.com" ``` ### 4. Install Dependencies ``` pip install -r requirements.txt ``` ## Usage ### Direct SharePoint Updates The script now updates the SharePoint Excel file directly without requiring browser interaction: 1. Select your name when prompted 2. Enter your task updates in natural language 3. The script will: - Parse your update into "yesterday" and "today" tasks - Update the local Excel file as a backup - Connect to SharePoint using Microsoft Graph API - Update the online Excel file directly - Show a success message when completed If SharePoint update fails, the script will: 1. Save changes to the local file 2. Offer to open the file in browser as a fallback (optional) ### Scheduled Mode (Default) By default, the script runs in scheduled mode, which: 1. Sends Microsoft Teams prompts to all team members at the configured time 2. Team members respond with their task updates via Teams 3. Responses can be collected manually or through a Teams integration (coming in future updates) To run in scheduled mode: ``` python main.py ``` You can modify the schedule times in main.py: ```python schedule.every().day.at("09:00").do(schedule_teams_prompts) ``` ### Manual Mode To run in manual mode, edit the main.py file to uncomment the manual mode section and comment out the scheduled mode section. In manual mode, you can: 1. Select a team member 2. Enter their tasks directly 3. The system will automatically parse and save the update to the Excel file ## Testing Teams Integration Two test scripts are included to verify Teams integration: 1. `test_teams.py` - A simple test that sends a test message to Teams 2. `test_teams_notification.py` - A comprehensive tester for Teams notifications Run these scripts to test Teams integration: ``` python test_teams.py python test_teams_notification.py ``` ## Troubleshooting ### Teams Integration Issues If you encounter issues with Microsoft Teams integration: 1. Verify your webhook URL is correct 2. Ensure you have proper permissions in the Teams channel 3. Check your network connectivity to the Teams service ### Authentication Issues If you encounter authentication issues: 1. Verify your Azure AD app has the correct permissions: - Microsoft Graph API: Files.ReadWrite.All, Sites.ReadWrite.All - SharePoint: Sites.ReadWrite.All 2. Check that the client secret is valid and not expired 3. Make sure the USER_EMAIL matches the owner of the OneDrive file ### File Access Issues If the script can authenticate but cannot find the file: 1. Confirm the EXCEL_FILE_NAME is correct 2. Check that your Azure AD app has been granted access to the file 3. Try using the local mode as a fallback ## Running in Local Mode If you need to run in local mode temporarily, the script will automatically create/use a local Excel file named "MoM_AI_Agent_local.xlsx" if it cannot access OneDrive. ## File Structure - `main.py` - The main application - `update_integration.py` - Helper script to update OneDrive file configuration - `test_onedrive_direct.py` - Test script for direct document access - `direct_access_integrator.py` - Helper functions for direct document operations - `requirements.txt` - Dependencies - `MoM_AI_Agent_local.xlsx` - Local backup file (created automatically) # ask-bot-vercel

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published