Social Integration
Publish content to social media platforms directly from the CRM.
Supported Platforms
| Platform | API | Features |
|---|---|---|
| Graph API | Pages, Posts, Events | |
| Graph API (via FB) | Business posts, Stories | |
| Twitter/X | API v2 | Tweets, Media |
| Marketing API | Company pages (future) |
Connecting Accounts
The connection flow uses OAuth to securely link social accounts:
- Club admin clicks "Connect Facebook/Instagram/Twitter"
- User is redirected to platform authorization page
- User grants permissions
- CRM receives and encrypts access tokens
- Connection is saved and ready to use
Token Security
- Access tokens encrypted at rest (AES-256)
- Refresh tokens stored separately
- Tokens auto-refreshed before expiry
- Never exposed in API responses
Publishing Posts
Post Model
interface SocialPost {
id: string;
connectionId: string; // Which social account
campaignId?: string; // Optional campaign link
content: string; // Post text
mediaUrls: string[]; // Images/videos
linkUrl?: string; // Link preview
status: SocialPostStatus; // DRAFT, SCHEDULED, PUBLISHED
scheduledAt?: Date;
publishedAt?: Date;
// Engagement metrics
likes: number;
comments: number;
shares: number;
reach: number;
}
Post Status Flow
DRAFT ──▶ SCHEDULED ──▶ PUBLISHING ──▶ PUBLISHED
│ │ │ │
▼ ▼ ▼ ▼
Edit Cancel (auto) Sync metrics
FAILED ◀── On error
Engagement Tracking
Platform metrics are synced automatically:
| Timing | Frequency |
|---|---|
| First 24 hours | Every hour |
| Days 2-7 | Every 6 hours |
| After 7 days | Daily |
Rate Limits
| Platform | Limit | Period |
|---|---|---|
| 200 posts | 24 hours (per page) | |
| 25 posts | 24 hours | |
| 200 tweets | 15 minutes |
Event Promotion
Auto-promote tournaments and events when published in TeeTime:
- Event is published in TeeTime
- CRM receives event notification
- If auto-promote is enabled:
- Create campaign targeting relevant segment
- Generate content from event details
- Schedule posts across all channels
- Send reminder emails/SMS as event approaches