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
1 change: 1 addition & 0 deletions .claude/rules/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| **Omie** | API | ERP — clients, invoices (NF-e), financials |
| **Bling** | API (OAuth2 auto-refresh) | Brazilian ERP — products, orders, NF-e, contacts, stock. Run `make bling-auth` once to connect |
| **Asaas** | API | Brazilian payments — Pix, boleto, credit card, subscriptions, marketplace split |
| **MercadoPago** | MCP | Latin American payment gateway — 7 countries (Brazil, Argentina, Mexico, Chile, Colombia, Peru, Uruguay), payment links, QR codes, subscriptions, webhooks |
| **YouTube** | API (OAuth) | Channel analytics |
| **Instagram** | API (OAuth) | Profile analytics |
| **LinkedIn** | API (OAuth) | Profile/org analytics |
Expand Down
48 changes: 47 additions & 1 deletion .claude/skills/int-youtube/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,60 @@ YouTube integration to monitor Evolution channels and others. Supports multiple

## Setup

Accounts configured via `make social-auth` (OAuth login) or manually in `.env`:
### Conta Principal (autenticada via OAuth)

Configurada via `.env` (gitignored):

```env
YOUTUBE_OAUTH_CLIENT_ID=<seu_client_id>.apps.googleusercontent.com
YOUTUBE_OAUTH_CLIENT_SECRET=<seu_client_secret>
YOUTUBE_REFRESH_TOKEN=<seu_refresh_token>
```

Scopes: `youtube`, `youtube.readonly`, `yt-analytics.readonly`, `yt-analytics-monetary.readonly`

### Contas adicionais (SOCIAL_YOUTUBE_N_*)

Configuráveis via `make social-auth` (OAuth login) ou manualmente no `.env`:
```env
SOCIAL_YOUTUBE_1_LABEL=Evolution API
SOCIAL_YOUTUBE_1_ACCESS_TOKEN=ya29...
SOCIAL_YOUTUBE_1_CHANNEL_ID=UC9kZHm3TnEt41ztGOLyQO9g
SOCIAL_YOUTUBE_1_REFRESH_TOKEN=1//0h...
```

### Auth Helper

```python
import os, urllib.request, urllib.parse, json

def get_youtube_token() -> str:
data = urllib.parse.urlencode({
"client_id": os.environ["YOUTUBE_OAUTH_CLIENT_ID"],
"client_secret": os.environ["YOUTUBE_OAUTH_CLIENT_SECRET"],
"refresh_token": os.environ["YOUTUBE_REFRESH_TOKEN"],
"grant_type": "refresh_token",
}).encode()
req = urllib.request.Request(
"https://oauth2.googleapis.com/token", data=data,
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
return json.loads(urllib.request.urlopen(req).read())["access_token"]

def ytapi(path: str) -> dict:
at = get_youtube_token()
req = urllib.request.Request(
f"https://www.googleapis.com/youtube/v3{path}",
headers={"Authorization": f"Bearer {at}"}
)
return json.loads(urllib.request.urlopen(req).read())

# Canal próprio
# ytapi("/channels?part=snippet,statistics&mine=true")
# Últimos vídeos
# ytapi("/search?part=snippet&forMine=true&type=video&order=date&maxResults=10")
```

## API Client

```bash
Expand Down
7 changes: 7 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"intercom": {
"type": "http",
"url": "https://mcp.intercom.com/mcp"
},
"mercadopago": {
"type": "http",
"url": "https://mcp.mercadopago.com/mcp",
"headers": {
"Authorization": "Bearer ${MERCADOPAGO_TOKEN}"
}
}
}
}