Overview
Connect your YouTube channel to Ana to analyze video performance, track engagement metrics, and gain insights into your content strategy. Ana can fetch video statistics, subscriber counts, and engagement data directly from the YouTube Data API v3. Quick Summary: Set up OAuth 2.0 credentials in Google Cloud Platform, authorize Ana to access your YouTube channel, and store the credentials in TextQL’s Secrets Manager.Prerequisites
GitHub Context Management Recommended: This integration works best with GitHub-based context management. While other context managers (like Notion) may work, the documentation and setup instructions assume GitHub is configured. See the Persistent Memory guide for setup instructions.
- A Google account with access to your YouTube channel
- Admin access to Google Cloud Platform (or ability to create a GCP project)
- Access to TextQL’s Secrets Manager (organization admin)
How It Works
Once configured, Ana can:- Fetch video statistics (views, likes, comments, engagement)
- Analyze channel growth and subscriber trends
- Track video performance over time
- Search and filter videos by topic or date
- Generate reports on content performance
Setup Instructions
1. Create Google Cloud Project
- Go to Google Cloud Console
- Click “Select a project” at the top
- Click “New Project”
- Enter a project name (e.g., “youtube-analytics”)
- Click “Create”
2. Enable YouTube Data API v3
- In your new project, go to “APIs & Services” → “Library”
- Search for “YouTube Data API v3”
- Click on it and click “Enable”
- Wait a few seconds for the API to be enabled
3. Configure OAuth Consent Screen
- Go to “APIs & Services” → “OAuth consent screen”
- Choose “External” user type (unless you have Google Workspace)
- Click “Create”
- Fill in required fields:
- App name: Your app name (e.g., “YouTube Analytics”)
- User support email: Your email
- Developer contact email: Your email
- Click “Save and Continue”
- Skip “Scopes” (click “Save and Continue”)
- Add Test Users:
- Click “Add Users”
- Enter your Google/YouTube account email
- Click “Add”
- Click “Save and Continue”
- Review and click “Back to Dashboard”
4. Create OAuth 2.0 Client ID
- Go to “APIs & Services” → “Credentials”
- Click “Create Credentials” → “OAuth 2.0 Client ID”
- Choose application type: “Desktop app”
- Give it a name (e.g., “YouTube Data Access”)
- Click “Create”
- Download the JSON file:
- Click the download button (down arrow icon)
- Save the file (it will be named something like
client_secret_xxx.json)
5. Generate Authorization URL
Ask Ana to generate an authorization URL using your client credentials:6. Authorize Your YouTube Account
- Copy and paste the authorization URL into your browser
- Log in with your Google account (the one with your YouTube channel)
- Select your YouTube channel if prompted
- Grant permissions when asked (read-only access to YouTube data)
- You’ll be redirected to a URL that starts with
http://localhost/?code=...- The page won’t load (that’s normal - localhost isn’t running)
- Copy the ENTIRE URL from your browser’s address bar
7. Exchange Code for Tokens
Give the redirect URL to Ana:- Extract the authorization code
- Exchange it for an
access_tokenandrefresh_token - Fetch your channel information to verify the connection
- Generate a complete credentials JSON object
8. Store Credentials in Secrets Manager
Ana will provide you with a complete JSON object like this:- Go to Settings → Secrets in TextQL
- Click “Add Secret”
- Name:
YOUTUBE_TOKEN(or your preferred name) - Value: Paste the entire JSON object
- Click “Save”
9. Update Context Documentation
Ana uses context to understand how to interact with your APIs and data sources. This step documents the YouTube integration in your context repository so Ana knows how to use it in future sessions.GitHub Context Management: These instructions are written for GitHub-based context management. If you’re using a different context manager (Notion, native context library, etc.), the process for documenting integrations should be intuitive for active users. For questions, contact [email protected].For GitHub setup instructions, see the Persistent Memory guide.
- Create API documentation in your context repository
- Update the context overview with YouTube routing information
- Submit a pull request for your review
Usage Examples
Once configured, you can ask Ana:- “Show me my YouTube video performance from the last month”
- “What are my top 10 most viewed videos?”
- “Analyze subscriber growth over time”
- “Which videos have the best engagement rate?”
- “Create a report on my YouTube channel metrics”
- “How many views did my recent videos get?”
Troubleshooting
Error: “Access blocked: App not verified”
Solution: You forgot to add yourself as a test user in the OAuth consent screen.- Go to “APIs & Services” → “OAuth consent screen”
- Scroll to “Test users”
- Click “Add Users”
- Add your email address
- Try authorization again
Error: “Invalid grant” or “Token expired”
Solution: The authorization code expired (they only last 10 minutes).- Generate a new authorization URL from Ana
- Complete the authorization process again
- Give Ana the new redirect URL immediately
Error: “YouTube Data API v3 has not been used”
Solution: The API isn’t enabled in your GCP project.- Go to the link provided in the error message
- Click “Enable”
- Wait a few seconds and try again
Can’t see my videos
Solution: Make sure you’re authorizing with the correct Google account that owns the YouTube channel.Security Notes
- Access tokens expire after 1 hour (Ana handles refresh automatically using the refresh token)
- Refresh tokens don’t expire (Ana uses them to get new access tokens)
- Never share your tokens publicly - they provide access to your YouTube data
- You can revoke access anytime at Google Account Permissions
- The integration uses read-only access - Ana cannot modify your YouTube channel
API Quota
YouTube Data API v3 has a free quota of 10,000 units per day:- Reading video data: 1-3 units per request
- You can pull your video data thousands of times per day
- Quota resets at midnight Pacific Time
- No charges - completely free for typical usage
- Go to Google Cloud Console
- Select your project
- Navigate to “APIs & Services” → “Dashboard”
- Click “YouTube Data API v3”
- View your daily usage