# Social Publishing Setup

This project can publish directly to TikTok and Facebook once the platform credentials are connected.

## Public video asset

The current SquareMCP TikTok master render is intended to be served from:

```text
https://squaremcp.com/squaremcp-tiktok-launch.mp4
```

TikTok and Facebook both use a pull-from-URL style publish flow in Hermes, so the video must be publicly reachable.

## TikTok credentials

Hermes accepts TikTok credentials in either of these forms:

1. Environment variable:

```text
TIKTOK_CLIENT_KEY=...
TIKTOK_CLIENT_SECRET=...
TIKTOK_REDIRECT_URI=https://tiktok.squaremcp.com/auth/tiktok/callback
TIKTOK_DEFAULT_ACCESS_TOKEN=...
```

Login Kit start URL:

```text
https://tiktok.squaremcp.com/auth/tiktok/start
```

Login Kit callback URL:

```text
https://tiktok.squaremcp.com/auth/tiktok/callback
```

2. Per-customer connection:

```bash
curl -X POST https://hermes.squaremcp.com/api/connect/tiktok \
  -H 'x-api-key: YOUR_MCP_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "accessToken": "YOUR_TIKTOK_ACCESS_TOKEN"
  }'
```

Publish a video:

```bash
curl -X POST https://hermes.squaremcp.com/api/tiktok/video \
  -H 'x-api-key: YOUR_MCP_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "video_url": "https://squaremcp.com/squaremcp-tiktok-launch.mp4",
    "title": "SquareMCP launch",
    "description": "One API key. One workflow layer. #SquareMCP #AITools #Automation"
  }'
```

Check publish status:

```bash
curl -X POST https://hermes.squaremcp.com/api/tiktok/video/status \
  -H 'x-api-key: YOUR_MCP_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "publish_id": "PUBLISH_ID_FROM_CREATE_VIDEO"
  }'
```

## Facebook credentials

Hermes accepts Facebook credentials in either of these forms:

1. Environment variables:

```text
FACEBOOK_DEFAULT_ACCESS_TOKEN=...
FACEBOOK_DEFAULT_PAGE_ID=...
```

2. Per-customer connection:

```bash
curl -X POST https://hermes.squaremcp.com/api/connect/facebook \
  -H 'x-api-key: YOUR_MCP_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "accessToken": "YOUR_FACEBOOK_PAGE_ACCESS_TOKEN",
    "pageId": "YOUR_FACEBOOK_PAGE_ID"
  }'
```

Publish the SquareMCP video to Facebook:

```bash
curl -X POST https://hermes.squaremcp.com/api/facebook/video \
  -H 'x-api-key: YOUR_MCP_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "video_url": "https://squaremcp.com/squaremcp-tiktok-launch.mp4",
    "description": "SquareMCP launch video. One API key. Real tool access."
  }'
```

## Required platform values

TikTok:
- access token with Content Posting API access

Facebook:
- Page access token with `pages_manage_posts`
- Page access token with `pages_read_engagement`
- Page ID
