Log inStart Free Trial
easyCoexistence Official APIs

How AI agents connect to Instagram, TikTok and other social networks: OAuth, MCP and official APIs explained

An AI agent connects to a social network through that network's official API: the account owner approves an app on the network's own OAuth consent screen, the app gets an access token limited to the approved permissions, and the agent calls the API with it, renewing the token before it expires. Agents reach those APIs through their own app, a unified API or an MCP server.

easyCoexistence connects your accounts through each network's official API and sign-in, keeps their tokens renewed, and gives Claude, ChatGPT or your own platform one MCP connector and a Partner API for WhatsApp, Instagram, Facebook, TikTok, YouTube, LinkedIn and more channels, with every connection monitored 24/7.

  • Each network's own OAuth consent, with no password shared
  • Token lifetimes from 1 hour to 60 days, network by network
  • Your own app, a unified API or an MCP server, compared
Start Free Trial

Nothing charged for 3 days. Cancel anytime.

Official APIs onlyMCP for Claude and ChatGPTEvery connection monitored 24/73 days free
1 hour

How long a Google user access token, the kind the YouTube APIs take, lasts before it expires.

24 hours

Lifetime of a TikTok API for Business access token; the refresh token that renews it is valid for one year.

60 days

Validity of a long-lived Instagram user token, refreshable for another 60 days once it is at least 24 hours old.

Separate token

What an MCP server must use for an upstream API: one that API issued, never the token the assistant sent.

3 events

What YouTube push notifications report for a channel: a new upload, a new title or a new description.

What does an AI agent need to work on a social account?

Five things, and the network controls each of them. The first is an account the network opens to apps, such as an Instagram professional account, a Facebook Page the person manages or a LinkedIn Page where they hold an admin role, reached through an app the network has approved for the permissions it asks for: Meta grants them one by one through App Review, TikTok reviews each developer app and its scopes, and LinkedIn vets apps before its Standard tier. The second is the owner's consent, given on the network's own sign-in page. The third is an access token, which expires and has to be renewed. The fourth is a permission, or scope, for each job the agent will do. The fifth is webhooks, so the agent hears about a new comment or message as it happens.

None of it involves a password. The agent holds, or borrows from a service, a token that the network can limit, renew or revoke.

1Approved appRegistered with the network and cleared for its permissions
2ConsentThe owner signs in on the network's own page
3TokenLimited to the approved scopes, renewed before it expires
4API callsPublish, reply, message, read insights
5WebhooksNew comments and messages pushed as they happen

How do OAuth sign-in and tokens work on each network?

The same way in outline, with different lifetimes. The app sends the owner to the network's authorization page, the owner logs in there and approves the listed permissions, and the network redirects back with a short-lived code: Instagram's lasts an hour and TikTok's 10 minutes, each usable once, and LinkedIn's 30 minutes. The app's server trades the code for an access token and, on some networks, a refresh token, which mints new access tokens without asking the owner again.

When a refresh fails, or the owner removes the app, calls start failing with an authorization error until the owner signs in again. LinkedIn issues no long-lived tokens and offers programmatic refresh only to a limited set of partners, so without it an app sends the member through authorization again within 60 days.

Sign-inAccess token
WhatsAppMeta's Embedded SignupA business token scoped to the onboarded business
InstagramInstagram Login60 days, refreshable for 60 more once a day old
FacebookFacebook Login for BusinessLong-lived Page tokens have no expiration date
TikTokTikTok's authorization page24 hours, renewed by a refresh token valid for a year
YouTubeGoogle's consent screen1 hour, renewed by a refresh token
LinkedInLinkedIn's consent screen60 days; refresh tokens for a limited set of partners

Which permissions does each job need?

One permission for each kind of job, named on the consent screen, and a call goes through only if the token holds the permission behind it. An agent that only reads insights needs far less than one that publishes and replies to comments and DMs, and LinkedIn asks apps to request the fewest scopes they can. Owners choose differently too: Google lets people approve some requested permissions and not others, so an app has to check which ones it received, while LinkedIn presents its scopes as one set that the member accepts or refuses whole. These are the permissions behind the usual jobs:

WhatsAppwhatsapp_business_messaging to send and receive messages; whatsapp_business_management for numbers, templates and account webhooks
Instagraminstagram_business_basic, with instagram_business_content_publish, instagram_business_manage_comments, instagram_business_manage_messages or instagram_business_manage_insights
Facebookpages_manage_posts to publish, pages_manage_engagement for comments, pages_messaging for Messenger, read_insights for insights
TikTokTikTok Accounts permissions such as Video Publish, and comment.list to read comments
YouTubeyoutube.upload to upload, youtube.force-ssl to moderate comments, yt-analytics.readonly and youtube.readonly for Analytics reports
LinkedInw_organization_social to post and comment as a Page, r_organization_social to read, w_member_social for a member

How does an agent hear about new comments and messages?

Through webhooks, where the network sends them: it posts each event to the app's HTTPS endpoint as it happens, and the endpoint answers 200 at once. Meta sends Instagram comments and DMs, a Facebook Page's feed, messages and mentions, and WhatsApp messages with their delivery statuses, retrying a failed WhatsApp delivery for up to 7 days. TikTok fires comment.update within five minutes of a comment changing and retries for up to 72 hours. YouTube's push notifications report uploads and title or description changes, not comments, and LinkedIn sends a Page's likes, comments and shares only to apps on its Standard tier.

Where no event arrives, the agent reads comments on a schedule instead, and each read counts against the network's rate limits.

What are the three ways to connect an agent: its own app, a unified API or an MCP server?

They differ in who holds the app and the tokens. Building on each network's API with your own app gives full control and the most work: a developer app and its review on each network, an OAuth redirect, token storage and refresh, and webhook endpoints. A unified API is a provider that has done that work once and puts one interface and one key in front of several networks; your code calls it, and it calls the networks. An MCP server packages the same calls as tools that Claude, ChatGPT and other assistants can use, behind an OAuth sign-in of its own.

The MCP specification keeps the two halves apart. The assistant's token is good for the MCP server only, and the server calls each network with a separate token that the network issued, never passing the assistant's token on.

What you buildWho holds the network tokens
Your own appAn app and its review per network, OAuth, token refresh, webhooksYou
A unified APICalls to one API with one key; accounts connect through its hosted sign-inThe provider, which may hand them to your code
An MCP serverA connector URL added to the assistant, with OAuth sign-inThe server; the assistant holds only a token for the server

Where does easyCoexistence fit?

It is both a unified API and an MCP server for AI agents. Accounts connect through easyCoexistence's own app on each network, with the owner signing in on the network's page, so there is no developer app to register and no token to store on your side. Claude, ChatGPT and other MCP clients add one connector, https://easycoexistence.com/api/mcp, with OAuth sign-in and more than 35 tools in all; your own platform uses the Partner API, connects its customers' accounts through hosted links and can take each account's credentials to call the network directly.

easyCoexistence renews tokens before they expire, checks each social connection every 6 hours and forwards Instagram, Facebook and TikTok events to your endpoint, signed per account. What an agent can do still follows each network: it replies to DMs on WhatsApp, Instagram and Messenger, and works in the comments on TikTok, YouTube and LinkedIn. More networks are coming, each joining the same connector and API at the same price per connection.

WhatsAppReplies within 24 hours, approved templates after them, number health
InstagramPosts, Reels and Stories, comment replies, DM replies within 24 hours, insights
FacebookPage posts, comment replies, Messenger replies within 24 hours, insights
TikTokVideos and photo posts, public comment replies, insights
YouTubeUploads with YouTube's scheduling, comment replies and moderation, Analytics
LinkedInPage and profile posts, comments, statistics

Common mistakes

  • Handing an agent your password. Facebook's terms tell people not to share it, Instagram's forbid collecting other users' login credentials, and a session logged in as you can do anything you can, where a token carries only the permissions you approved.
  • Saving a token once and reusing it for months. TikTok's access token lasts 24 hours and an Instagram token lapses after 60 days without a refresh, so renew on schedule or fetch fresh credentials before each job.
  • Polling for new comments around the clock. Webhooks push them on the networks that send them, and each poll spends calls from the account's limits, such as TikTok's 40 a minute on each endpoint.
  • Asking for scopes the agent will not use. Meta reviews each permission an app requests, and LinkedIn members accept or refuse the whole set at once, so request only what the agent's jobs need.
Doing this with EasyCoexistence

US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Do I need a developer account on each network to connect an AI agent?

Only when you build with your own app. Through a unified API or an MCP server such as easyCoexistence, accounts connect through the provider's app on each network, and the owner only signs in and approves the permissions.

Can Claude and ChatGPT use the same connection to my accounts?

Yes, through one MCP server. Each assistant signs in to it with a token of its own and reaches the same connected accounts, while the network tokens stay with the server.

What happens when a token expires?

Calls fail with an authorization error until the token is renewed. If the refresh token has lapsed too, such as a TikTok one after a year or a Google one left unused for six months, the owner signs in again.

How much does easyCoexistence cost to connect an AI agent to social media?

US$ 9 to US$ 0.75 per connection per month, falling as you add connections, the same on every network. The MCP connector and the Partner API are included, with no seats, and the first 3 days are free.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on