Skip to main content
AgentOS supports 9 social media platforms for community engagement, content automation, and social listening. Each adapter handles platform-specific APIs, rate limits, and authentication flows.

Bluesky

Decentralized social network using the AT Protocol.

Setup

1

Create Account

Register at bsky.app
2

Generate App Password

Settings → App Passwords → Create New
3

Store Credentials

agentos vault set BLUESKY_HANDLE "your-handle.bsky.social"
agentos vault set BLUESKY_PASSWORD "your-app-password"
4

Enable Channel

agentos channel enable bluesky
agentos channel test bluesky

Features

  • AT Protocol native integration
  • Reply threading support
  • Session JWT caching
  • Message splitting (300 char limit)
  • DID-based agent routing

Implementation

Source: src/channels/bluesky.ts:1
registerFunction(
  { id: "channel::bluesky::webhook" },
  async (req) => {
    const { did, text, uri, cid } = req.body;
    
    // Skip self-mentions
    if (did === session?.did) return { ok: true };
    
    const agentId = await resolveAgent(trigger, "bluesky", did);
    const response = await trigger("agent::chat", {
      agentId,
      message: text,
      sessionId: `bluesky:${did}`
    });
    
    // Reply to original post
    await sendMessage(response.content, { uri, cid });
  }
);

API Endpoints

  • Authentication: com.atproto.server.createSession
  • Post creation: com.atproto.repo.createRecord
  • Collection: app.bsky.feed.post

Reddit

Community engagement and subreddit automation.

Setup

1

Create Reddit App

Go to reddit.com/prefs/apps
  • Create app (type: script)
  • Note client ID and secret
2

Get Refresh Token

Use OAuth2 flow to obtain refresh token
3

Store Credentials

agentos vault set REDDIT_CLIENT_ID "your-client-id"
agentos vault set REDDIT_SECRET "your-client-secret"
agentos vault set REDDIT_REFRESH_TOKEN "your-refresh-token"

Features

  • OAuth2 token refresh
  • Subreddit-based routing
  • Comment reply support
  • Automatic token caching
  • Deleted message filtering
Source: src/channels/reddit.ts:1

Token Refresh

async function refreshAccessToken() {
  const res = await fetch("https://www.reddit.com/api/v1/access_token", {
    method: "POST",
    headers: {
      Authorization: `Basic ${Buffer.from(
        `${clientId}:${clientSecret}`
      ).toString("base64")}`
    },
    body: `grant_type=refresh_token&refresh_token=${refreshToken}`
  });
  accessToken = (await res.json()).access_token;
}

Twitch

Live streaming chat integration.

Setup

1

Register Application

Go to dev.twitch.tv/console
  • Register new application
  • Set OAuth Redirect URL
2

Get Tokens

Use OAuth2 flow to obtain:
  • Access token
  • Client ID
3

Store Credentials

agentos vault set TWITCH_TOKEN "your-access-token"
agentos vault set TWITCH_CLIENT_ID "your-client-id"
4

Subscribe to EventSub

Subscribe to channel.chat.message events

Features

  • EventSub webhook integration
  • Challenge-response verification
  • Chat message API
  • Broadcaster-based routing
  • Message splitting (500 char limit)
Source: src/channels/twitch.ts:1

Webhook Verification

if (body.challenge) {
  // EventSub challenge response
  return { status_code: 200, body: body.challenge };
}

LinkedIn

Professional networking and messaging.

Setup

1

Create LinkedIn App

Go to linkedin.com/developers
  • Create new app
  • Request messaging permissions
2

OAuth2 Flow

Obtain access token with w_member_social scope
3

Store Credentials

agentos vault set LINKEDIN_TOKEN "your-access-token"

Features

  • LinkedIn Messaging API v2
  • Thread-based conversations
  • Voyager event handling
  • Message splitting (4,096 char limit)
Source: src/channels/linkedin.ts:1

Message Format

const msgEvent = element.event[
  "com.linkedin.voyager.messaging.event.MessageEvent"
];
const text = msgEvent.messageBody?.text || msgEvent.attributedBody?.text;

Mastodon

Federated social media network.

Setup

1

Choose Instance

Select a Mastodon instance (e.g., mastodon.social)
2

Create Application

In instance settings:
  • Development → New Application
  • Scopes: read, write
  • Copy access token
3

Store Credentials

agentos vault set MASTODON_INSTANCE "https://mastodon.social"
agentos vault set MASTODON_TOKEN "your-access-token"

Features

  • Mastodon API v1 integration
  • Reply threading
  • HTML content stripping
  • Message splitting (500 char limit)
  • Thread chain building
Source: src/channels/mastodon.ts:1

Thread Handling

let replyId = inReplyToId;
for (const chunk of chunks) {
  const res = await postStatus(chunk, replyId);
  replyId = res.id; // Chain subsequent messages
}

Additional Social Platforms

Nostr

Decentralized protocol for social mediaSetup:
agentos vault set NOSTR_PRIVATE_KEY "nsec..."
Source: src/channels/nostr.ts:1

Discourse

Forum and community discussionsSetup:
agentos vault set DISCOURSE_URL "https://forum.example.com"
agentos vault set DISCOURSE_API_KEY "..."
Source: src/channels/discourse.ts:1

Gitter

Developer community chatSetup:
agentos vault set GITTER_TOKEN "..."
Source: src/channels/gitter.ts:1

Keybase

Encrypted social platformSetup:
agentos vault set KEYBASE_USERNAME "..."
agentos vault set KEYBASE_PAPER_KEY "..."
Source: src/channels/keybase.ts:1

Social Media Bot Example

Create an agent that responds across multiple social platforms:
# agents/social-bot.yaml
id: social-bot
name: Social Media Assistant
description: Multi-platform social engagement bot
model: claude-sonnet-4
temperature: 0.7
instructions: |
  You are a friendly social media bot. Respond to:
  - Questions about our product
  - Community engagement
  - Support requests
  
  Keep responses:
  - Concise (under 280 chars when possible)
  - Friendly and professional
  - On-brand

Deploy Across Platforms

# Configure credentials
agentos vault set BLUESKY_HANDLE "bot.bsky.social"
agentos vault set BLUESKY_PASSWORD "..."
agentos vault set REDDIT_CLIENT_ID "..."
agentos vault set MASTODON_TOKEN "..."
agentos vault set LINKEDIN_TOKEN "..."

# Enable channels
agentos channel enable bluesky
agentos channel enable reddit
agentos channel enable mastodon
agentos channel enable linkedin

# Test each platform
agentos channel test bluesky
agentos channel test reddit
agentos channel test mastodon
agentos channel test linkedin

Rate Limits

Each platform has different rate limits:
PlatformRate LimitHandled By
Bluesky300 posts/5minAT Protocol server
Reddit60 requests/minOAuth token refresh
Twitch20 messages/30secTwitch API
LinkedIn100 requests/dayLinkedIn API
MastodonInstance-specificInstance configuration
AgentOS includes per-agent rate limiting:
# View rate limit status
agentos agent inspect social-bot | grep rate_limit

Message Formatting

Character Limits

// Platform-specific limits (from source code)
Bluesky:   splitMessage(text, 300)   // bluesky.ts:78
Mastodon:  splitMessage(text, 500)   // mastodon.ts:56
Twitch:    splitMessage(text, 500)   // twitch.ts:65
LinkedIn:  splitMessage(text, 4096)  // linkedin.ts:66
Reddit:    No splitting (10,000 char limit)

HTML Stripping

Mastodon returns HTML content that must be stripped:
const text = status.content.replace(/<[^>]+>/g, "");

Monitoring Social Channels

# View social media activity
agentos logs --follow | grep -E "bluesky|reddit|twitch|linkedin|mastodon"

# Audit trail for social engagement
agentos security audit --type channel_message | grep social

# Per-platform metrics
agentos dashboard  # View channel activity in TUI

Authentication Patterns

Session-Based (Bluesky)

let session: { accessJwt: string; did: string } | null = null;

async function authenticate() {
  const res = await fetch(`${API_URL}/com.atproto.server.createSession`, {
    method: "POST",
    body: JSON.stringify({ identifier: handle, password })
  });
  session = await res.json();
}

Token Refresh (Reddit)

let accessToken = "";

async function refreshAccessToken() {
  // OAuth2 token refresh flow
  const res = await fetch(tokenUrl, { /* ... */ });
  accessToken = (await res.json()).access_token;
}

if (!accessToken) await refreshAccessToken();

Static Token (Mastodon, LinkedIn)

const token = await getSecret("MASTODON_TOKEN");
await fetch(apiUrl, {
  headers: { Authorization: `Bearer ${token}` }
});

Security Considerations

Platform-Specific

  • Bluesky: DID-based identity, session JWT rotation
  • Reddit: OAuth2 with refresh tokens, Basic auth for token endpoint
  • Twitch: EventSub signature verification, challenge-response
  • LinkedIn: OAuth2 scopes, X-Restli-Protocol-Version header
  • Mastodon: Instance-specific moderation, federated identity

Audit Events

All social media interactions are logged:
triggerVoid("security::audit", {
  type: "channel_message",
  agentId,
  detail: { 
    channel: "bluesky", 
    did: "did:plc:...",
    timestamp: Date.now()
  }
});

Next Steps

Messaging Platforms

Set up Telegram, Discord, Slack, WhatsApp

Custom Adapters

Build your own social media adapter

Rate Limiting

Configure per-agent rate limits

Audit Logging

Monitor social media activity

Build docs developers (and LLMs) love