Log inStart Free Trial
easyCoexistence Official APIs

AI agent SaaS architecture: reaching your customers' customers on WhatsApp, Instagram and TikTok

An AI agent SaaS that reaches your customers' customers runs in five layers: connections, where each customer links WhatsApp, Instagram, TikTok and more channels through easyCoexistence's Partner API; ingestion, which verifies and queues webhooks; a conversation store you own; an agent worker running your model; and outbound, which replies, publishes and follows status events through each network's official API.

smb_message_echoes

The webhook that describes a message the business sent from the WhatsApp Business app on a Coexistence number.

7 days

How long Meta retries a WhatsApp webhook your endpoint did not accept, which can deliver the same message twice.

1 attempt

Deliveries of each forwarded Instagram, Facebook or TikTok event, with no retry and no copy kept.

24 hours

WhatsApp's customer service window after a person's message; outside it, a business sends approved templates only.

20 mps

Fixed throughput of a number used with both the WhatsApp Business app and the Cloud API.

What are the layers of an AI agent SaaS?

Five, each with one job, so a slow model never loses a message and a dropped account never takes the product down. easyCoexistence sits in the first and the last: it connects the accounts and keeps them working, while the conversation logic and the model stay in your backend.

1ConnectionsHosted links, channel_id and connection_id per customer
2IngestionVerify, queue, then answer 2xx
3ConversationsYour store, one thread per person
4AgentYour model, prompts and tools
5OutboundReplies, posts and status events

How do you model tenants, channels and conversations?

In three tables. A tenant is your customer, and its id goes out as external_ref on every connect session, so each connection and status event comes back tagged with it. A channel row holds the connection_id of a WhatsApp number or the channel_id of a social account, with the network and its status. A conversation is keyed on the channel and the person's ID on that network: the WhatsApp number in from, the Instagram-scoped ID on a DM, or the comment's thread on TikTok.

Where should incoming events land first?

In a durable queue, before any model runs. The ingestion endpoint checks the secret in the URL path on WhatsApp deliveries and X-EC-Signature on forwarded social events, writes the event to the queue and answers 2xx. The two sources behave differently: Meta retries a WhatsApp webhook for up to 7 days, so the same message can arrive twice, while a forwarded Instagram, Facebook or TikTok event is sent once and never kept, so an event dropped by your endpoint is gone. Deduplicate on the network's own message or comment ID.

How do you keep replies in order and on time?

One worker per conversation, and a check before each send. Lock the conversation while the agent works, so two messages from one person are answered in turn and never twice. Before a WhatsApp reply leaves, compare the person's last message with the 24-hour window, and switch to an approved template once it has closed. Queue each number's sends at 20 messages per second at most, the fixed rate of a Coexistence number, and remember that a TikTok reply is a public comment.

How does a person take over from the agent?

Through the channel itself. With Coexistence, your customer's staff keep using the WhatsApp Business app on the same number, and each message they send arrives at your webhook as smb_message_echoes. Treat an echo as a handoff: pause the agent on that conversation, give the staff reply to the model as context, and resume after a quiet period or when staff hand it back in your product. Instagram returns the account's own DMs as echoes too, so the same rule keeps the agent from answering itself.

Should the agent publish as well as reply?

It can, through the same key. The agent drafts posts, and your backend queues them with POST /channels/:id/posts on Instagram, Facebook, TikTok and LinkedIn, from 1 minute to 90 days ahead, with post.published and post.failed reporting back to the conversation store. LinkedIn posts go out only after a person approves each one in your product, since LinkedIn's API Terms restrict automated posting.

How does the product react when a connection drops?

Through a state on the channel row. A status event moves it to disconnected, removed or suspended, the agent stops sending on that channel, and your interface asks the tenant to reconnect through a new connect session. A connection.token_missing event leaves a number receiving but unable to send, so the agent drafts replies for staff instead. connection.connected or channel.connected sets the row back to active, and the worker fetches fresh credentials before its next reply.

Which data do you store, and which does easyCoexistence keep?

Your product stores the conversations. A WhatsApp number's messages go from Meta straight to your webhook, and forwarded social events pass through easyCoexistence without a copy. easyCoexistence keeps what it needs to serve the connection: the account record, its tokens, its health history, and the posts it publishes. If your account also turns on easyCoexistence's own automations, their message text is kept for 7 days and their run logs for 30.

Common mistakes

  • Keying conversations on the person's phone number alone. The same person can write to two of your tenants, so key each thread on the channel and the person's ID together.
  • Letting two workers answer one conversation. Parallel workers can send replies out of order or twice, so lock each thread while the agent works on it.
  • Keeping the agent on after staff reply from the WhatsApp Business app. The echo shows a person has taken the thread, so pause the agent there until your handoff rule returns it.
  • Publishing the agent's LinkedIn drafts on a timer. A person approves each LinkedIn post, so route those drafts to a review step before they reach the queue.
Doing this with EasyCoexistence

easyCoexistence is the connection layer for your agent product: your customers' WhatsApp numbers and their Instagram, Facebook, TikTok, YouTube and LinkedIn accounts, and more channels, connected by hosted links, with fresh credentials, webhooks, a publishing queue and signed status events, every connection monitored 24/7. 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 my customers' customers need to install anything?

No. They write to the business as they already do, on WhatsApp, in Instagram DMs or Messenger, or in the comments, and your agent replies on the same channel.

Can my customers' staff keep replying by hand?

Yes. With Coexistence, the WhatsApp Business app keeps working on the same number, and each message staff send reaches your webhook as an echo, so the agent can step aside.

Does easyCoexistence run the model?

No. The model, its prompts and its memory run in your backend. easyCoexistence connects the accounts, delivers their events and keeps their access working.

What does easyCoexistence charge per customer of an agent SaaS?

Each connected number or account costs US$ 9 to US$ 0.75 per month, falling as your total grows, so a customer on WhatsApp and Instagram counts twice. 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