Skip to content

Commit a3b06e6

Browse files
committed
feat(skills): add library and self-hosted references and state 200+ MCP tools
1 parent 42d14db commit a3b06e6

16 files changed

Lines changed: 755 additions & 10 deletions

‎skills/polymorfa-migrate/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Move an existing WhatsApp integration from another provider (such a
55

66
# Move a WhatsApp integration to Polymorfa
77

8-
Use this skill when a project already sends or receives WhatsApp messages through another provider and the user wants some or all of it on Polymorfa. Read the provider's reference in `references/` before planning. References, one per provider: `references/z-api.md` (Z-API), `references/1msg.md` (1MSG), `references/green-api.md` (Green API), `references/timelinesai.md` (TimelinesAI), `references/botconversa.md` (BotConversa), `references/whaticket.md` (Whaticket), `references/zapligue.md` (ZapLigue), `references/360dialog.md` (360dialog), `references/twilio.md` (Twilio), `references/vonage.md` (Vonage), `references/gupshup.md` (Gupshup), `references/infobip.md` (Infobip), `references/bird.md` (Bird), `references/meta-cloud-api.md` (Meta Cloud API used directly), `references/kapso.md` (Kapso), `references/rasayel.md` (Rasayel), `references/sent.md` (Sent), `references/wavoip.md` (Wavoip). If the provider has no reference, follow the matching migration guide under https://docs.polymorfa.com/migrate/, the [agent index](https://docs.polymorfa.com/llms.txt) and the provider's own documentation, and say that no reference exists.
8+
Use this skill when a project already sends or receives WhatsApp messages through another provider and the user wants some or all of it on Polymorfa. Read the provider's reference in `references/` before planning. References, one per provider: `references/z-api.md` (Z-API), `references/1msg.md` (1MSG), `references/green-api.md` (Green API), `references/timelinesai.md` (TimelinesAI), `references/botconversa.md` (BotConversa), `references/whaticket.md` (Whaticket), `references/zapligue.md` (ZapLigue), `references/360dialog.md` (360dialog), `references/twilio.md` (Twilio), `references/vonage.md` (Vonage), `references/gupshup.md` (Gupshup), `references/infobip.md` (Infobip), `references/bird.md` (Bird), `references/meta-cloud-api.md` (Meta Cloud API used directly), `references/kapso.md` (Kapso), `references/rasayel.md` (Rasayel), `references/sent.md` (Sent), `references/wavoip.md` (Wavoip), `references/baileys.md` (Baileys), `references/whatsmeow.md` (whatsmeow), `references/whatsapp-web-js.md` (whatsapp-web.js), `references/evolution-api.md` (Evolution API), `references/waha.md` (WAHA), `references/openwa.md` (OpenWA). If the provider has no reference, follow the matching migration guide under https://docs.polymorfa.com/migrate/, the [agent index](https://docs.polymorfa.com/llms.txt) and the provider's own documentation, and say that no reference exists.
99

1010
## 1. Inventory before you change anything
1111

‎skills/polymorfa-migrate/references/360dialog.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Ask who owns each WhatsApp Business Account before planning the move. A number r
4040
| Direct Send (`category: "utility"` on `/messages`) | Not verified on the Graph API | not verified | `api/graph/index` |
4141
| Payments APIs (Brazil, India, Singapore) | Not verified | not verified | none |
4242
| Local storage (data residency region per number) | Not verified | not verified | none |
43-
| MCP server for the 360dialog account | Hosted MCP server with 150+ tools, and a local MCP in the CLI | more | `development/mcp` |
43+
| MCP server for the 360dialog account | Hosted MCP server with 200+ tools, and a local MCP in the CLI | more | `development/mcp` |
4444
| Sandbox | Test connections on a simulated network, at 0 credits | more | `testing/index` |
4545

4646
## Calls
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Baileys reference for polymorfa-migrate
2+
3+
Maps Baileys (https://github.com/WhiskeySockets/Baileys, guide at https://baileys.wiki) to Polymorfa. Checked on 24 November 2026 against Baileys' published guide and Polymorfa's documentation. Confirm each Polymorfa operation in the current docs (https://docs.polymorfa.com/llms.txt) before you change code; docs pages are given as content paths, for example `messaging/send` is https://docs.polymorfa.com/messaging/send.
4+
5+
Status: `same` (direct equivalent), `more` (equivalent with more), `different` (covered another way; read the note), `gap` (not offered; agree a replacement with the user).
6+
7+
The human guide is https://docs.polymorfa.com/migrate/baileys.
8+
9+
Baileys is an open-source (MIT) TypeScript library, `@whiskeysockets/baileys`. It runs a WhatsApp Web linked device inside the user's process: no hosted API, no webhooks, no database. Polymorfa runs the same kind of linked device as a service. Ask which Baileys version the project uses (6.x, 7.0.0-rc, or a fork) and whether the auth state is `useMultiFileAuthState` or a custom `SignalKeyStore`.
10+
11+
## Requests and credentials
12+
13+
Baileys: no network credential. `makeWASocket({ auth: state })` holds the session in the process, and `creds.update` must be saved or messages fail to send or decrypt.
14+
15+
Polymorfa: `Authorization: Bearer <project token or team key>` with scopes such as `messages:write` and `connections:manage`. Browsers use a short-lived client token bound to one Connection. Native paths start with `https://api.polymorfa.com/messaging/{connection}` or `https://api.polymorfa.com/platform`. The Connection id is not a secret.
16+
17+
## Moving the session (import)
18+
19+
Connection import moves a Baileys linked device to Polymorfa without pairing the phone again. It is in preview. Page: `connections/import-connections`.
20+
21+
1. Reserve a destination Connection through QuickLink (`POST /messaging/quicklinks`; the id is `data.connection`).
22+
2. Stop the Baileys process and every write to its auth state. Take the `SignalStoreSnapshot`.
23+
3. `POST /platform/connections/{connectionId}/handoff-keys` returns `runnerPublicKeyB64` (Curve25519, base64url, no padding) and `handoffId`.
24+
4. Seal the snapshot JSON to that key as a sealed box (32-byte ephemeral public key followed by the ciphertext, base64). Compute the SHA-256 of the unsealed snapshot JSON as hex.
25+
5. `POST /platform/connections/{connectionId}/handoff-import` with `handoffId`, `sealedEnvelopeB64` and `snapshotHashHex`. Polymorfa verifies the hash after decrypting.
26+
6. Wait for status `CONNECTED` or the `connection.connected` event, send a test message, then move traffic.
27+
28+
Limits to agree with the user:
29+
30+
- Never run the Baileys process and the imported copy together. Two copies of one linked device compete and WhatsApp can invalidate the connection. Keep Baileys offline until the Connection is connected.
31+
- A Baileys session moves as a `SignalStoreSnapshot`. If the user's store cannot produce one, pair again through QuickLink.
32+
- Keep a backup of the Baileys auth state until the user is sure.
33+
- Import needs the `connections:manage` scope.
34+
35+
## Mapping
36+
37+
| Baileys capability | Polymorfa equivalent | Status | Docs page |
38+
| --- | --- | --- | --- |
39+
| QR code from `connection.update` | QuickLink, or `GET /messaging/{connection}/pair/qr` (direct pairing, needs team access) | same | `connections/quicklink`, `connections/direct-pairing` |
40+
| `sock.requestPairingCode(number)` | QuickLink pairing code, or `POST /messaging/{connection}/pair/code` with `{"phone":"+15550001111"}` | same | `connections/direct-pairing` |
41+
| `useMultiFileAuthState`, custom `SignalKeyStore`, `creds.update` | Stored by Polymorfa. Import an existing session; nothing to save | more | `connections/import-connections` |
42+
| Reconnect on `restartRequired`, `loggedOut` (401) | `POST /platform/connections/{connectionId}/restart` (`202` with an operation id), `POST .../logout`, `GET /platform/connections/{connectionId}`; events `connection.status`, `connection.connected`, `connection.logged_out` | more | `connections/manage` |
43+
| One socket per customer | Customers: customer records, pairing links and a monthly cap per customer | more | `customers` |
44+
| `sendMessage` with `text` | `POST /messaging/{connection}/messages/send` with `content.text` | same | `messaging/send` |
45+
| `image`, `video`, `audio`, `document`, sticker | `content.image`, `video`, `voice` (`ptt:true` for a voice note), `file`, `sticker`, by `url` or `base64` | same | `messaging/send`, `messaging/media` |
46+
| `location`, `contacts` (vCard) | `content.location`, `content.contact:{vcard}` | same | `messaging/send` |
47+
| `poll`, `react` | `content.poll` (2 to 12 options, `multiSelect`), `POST /messaging/{connection}/messages/react` | same | `messaging/send` |
48+
| `quoted` | `quotedMessage:{id}` (Polymorfa message id) | same | `messaging/send` |
49+
| `mentions` (JIDs) | `mentions:[<user id>]` (up to 256; user ids, not numbers) | different | `messaging/send` |
50+
| `forward` | `isForwarded:true` on a new send. No "forward this stored message" call | different | `messaging/send` |
51+
| `edit: key`, `delete: key` | `PUT` and `DELETE /messaging/{connection}/chats/{conversation}/messages/{messageId}` (linked device) | same | `messaging/send` |
52+
| `readMessages` | `POST /messaging/{connection}/messages/seen` | same | `messaging/send` |
53+
| `sendPresenceUpdate` (`composing`, `recording`, `paused`) | `POST /messaging/{connection}/messages/typing` with `state` `typing`, `recording` or `paused`; Safe Mode adds pacing and typing | more | `messaging/send`, `safety/safe-mode` |
54+
| Send with `gifPlayback`, `ptv`, `viewOnce`, `pin` | Not offered. Send an MP4 as `content.video` | gap | none |
55+
| Link preview from `link-preview-js` | No send-side preview field. Put the URL in `content.text` | different | `messaging/media` |
56+
| Buttons and lists | `content.buttons`, `content.list`, `content.carousel` (Cloud API needs templates) | more | `messaging/send` |
57+
| `groupCreate`, `groupLeave` | `POST /messaging/{connection}/groups` (`{name, participants:[user id]}`), `POST .../groups/{id}/leave` | same | `messaging/contacts-and-groups` |
58+
| `groupParticipantsUpdate` | `POST .../groups/{id}/participants/add`, `.../participants/remove`, `.../admin/promote`, `.../admin/demote` | same | `messaging/contacts-and-groups` |
59+
| `groupUpdateSubject`, `groupUpdateDescription` | `PUT .../groups/{id}/subject`, `PUT .../groups/{id}/description` | same | `messaging/contacts-and-groups` |
60+
| `groupSettingUpdate`, `groupMemberAddMode` | `PUT .../groups/{id}/settings/info-edit`, `settings/messages`, `settings/member-add`, `settings/join-approval` | same | `messaging/linked-device-controls` |
61+
| `groupInviteCode`, `groupRevokeInvite`, `groupAcceptInvite`, `groupGetInviteInfo` | `GET .../groups/{id}/invite-code`, `POST .../groups/{id}/invite-code/revoke`, `POST .../groups/join`, `GET .../groups/join-info?code=` | same | `messaging/contacts-and-groups` |
62+
| `groupMetadata`, `groupFetchAllParticipating` | `GET .../groups/{id}`, `GET .../groups` | same | `messaging/contacts-and-groups` |
63+
| `groupRequestParticipantsList`, `groupRequestParticipantsUpdate` (join requests) | Not offered | gap | none |
64+
| Status updates (`status@broadcast`) | Not offered | gap | none |
65+
| Broadcast lists | Campaigns: audiences, opt-outs, pacing and per-recipient status | more | `campaigns` |
66+
| `messaging-history.set`, `fetchMessageHistory` | `GET /messaging/{connection}/chats` and `.../chats/{conversation}/messages` for Connections with hosted message storage, in beta (team opt-in); only messages after storage was enabled | different | `messaging/history` |
67+
| `downloadMediaMessage`, `updateMediaMessage` | Download media from its message while WhatsApp serves it, or save it with `POST /messaging/media/{id}/download-and-save`. Polymorfa does not host media files | different | `messaging/media` |
68+
| `call` event, `sock.rejectCall(callId, from)` | `call.received` event; `POST /messaging/voip/calls/{id}/reject`. Polymorfa also places and answers calls | more | `calls/server`, `calls/how-calls-work` |
69+
| `sock.ev` callbacks in the process | One signed webhook endpoint with a delivery log | more | `development/webhooks` |
70+
| `getMessage` store for retries | Not needed: Polymorfa runs the socket | more | none |
71+
72+
## Webhooks
73+
74+
Baileys has no webhooks. Events are in-process callbacks, so a crash loses what arrives while the process is down. Polymorfa sends the events the user picks to one signed endpoint. `X-Webhook-Signature` is HMAC-SHA256 over the raw body in lowercase hex. A failed delivery is retried up to 8 times over 24 hours, and the delivery log supports replay. See `development/webhooks`.
75+
76+
| Baileys event | Polymorfa event |
77+
| --- | --- |
78+
| `messages.upsert` | `message.received`, plus `message.reaction`, `message.vote`, `message.edited`, `message.revoked` |
79+
| `messages.update` | `message.ack`, `message.failed` |
80+
| `connection.update` | `connection.connected`, `connection.status`, `connection.logged_out` |
81+
| `groups.update`, `group-participants.update` | `group.update`, `group.participant` |
82+
| `presence.update` | `presence.update` |
83+
| `call` | `call.received`, `call.accepted`, `call.rejected`, `call.missed`, `call.ended` |
84+
85+
## Differences to agree with the user
86+
87+
- Baileys JIDs (`@s.whatsapp.net`, `@lid`, `@g.us`, `@newsletter`) and message keys do not carry over. Polymorfa ids are opaque strings. After the Connection is up, list groups and contacts again and store the new ids. See `messaging/ids`.
88+
- Outside Campaigns, a Connection cannot start a chat with someone who never wrote to it. Find outbound-first sends and agree a replacement, or move them to a campaign.
89+
- Polymorfa does not queue sends while a Connection is disconnected: it refuses with `connection_not_ready`. Keep an outbox and retry with the same `Idempotency-Key`.
90+
- Add an `Idempotency-Key` header to every send.
91+
- Polymorfa enforces warm-up and throughput limits. Respect `Retry-After` on a `429`.
92+
- Status updates, group join requests, GIF, video note, view-once and pin sends are not offered yet. Find code that uses them.
93+
- Baileys 7.x is ESM-only and version 8 changes the auth state format. Do not convert the auth state by hand: import the session as it is.
94+
95+
## Move in this order
96+
97+
1. Add the Polymorfa credential and webhook secret to the secret store.
98+
2. Add the Polymorfa webhook route next to the Baileys handlers and verify signatures.
99+
3. Put sending behind one adapter, so each number switches by configuration.
100+
4. For each number, import the session (or pair through QuickLink), with Baileys offline.
101+
5. Switch that number's traffic, watch `message.ack` and `message.failed`, then move the next number.
102+
6. Remove the Baileys process, its auth store and its `getMessage` store only after the number runs on Polymorfa.

‎skills/polymorfa-migrate/references/bird.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Ask the user who owns each WhatsApp Business Account before planning the move. B
4444
| Preferences (all or non-transactional) and keyword rules | Not offered | gap | none |
4545
| Statistics by country, template, category, error code, tag, number | Not offered. Connection analytics cover engagement for linked-device Connections | gap | `connections/analytics` |
4646
| Send API rate limits by plan | `429` with `Retry-After`; respect it | same | `api/rate-limits` |
47-
| Hosted MCP server (curated tools) | Hosted MCP server with 150+ tools, and a local MCP in the CLI | more | `development/mcp` |
47+
| Hosted MCP server (curated tools) | Hosted MCP server with 200+ tools, and a local MCP in the CLI | more | `development/mcp` |
4848
| CLI with `bird webhooks` | Polymorfa CLI with a command for every resource and webhook events forwarded to localhost | more | `development/cli` |
4949

5050
## Calls

‎skills/polymorfa-migrate/references/botconversa.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ All sends are `POST /messaging/{connection}/messages/send` with `{conversation,
7070
| Incoming webhook (Automação, Webhooks): another tool calls BotConversa to create or update a contact | The customer's system calls the REST API directly. Team request quota returns `429` with `Retry-After` | different | `api/rate-limits` |
7171
| Integration block: an HTTP call from inside a flow to the customer's server. One call per block, no error path, 10-second wait for the response mapping | A signed webhook for the events picked, up to 8 attempts over 24 hours, delivery log and replay | more | `development/webhooks` |
7272
| Reading a message through the API | Not possible on BotConversa. On Polymorfa every inbound message is `message.received` | more | `messaging/receive` |
73-
| GPT assistant, AI skills and MCP tools inside the app | The customer's own agent over the hosted MCP server (150+ tools) | different | `development/mcp` |
73+
| GPT assistant, AI skills and MCP tools inside the app | The customer's own agent over the hosted MCP server (200+ tools) | different | `development/mcp` |
7474
| Kanban board, built-in CRM | Not offered | gap | none |
7575

7676
## 2. Auth and identifiers

0 commit comments

Comments
 (0)