Skip to content
Shortcut: /, ⌘K or Ctrl+K

Import existing connections

Move a Baileys or whatsmeow session to Polymorfa without pairing the phone again.

View as Markdown

If a phone is already linked to Baileys or whatsmeow, you can move that linked device to Polymorfa instead of pairing again. The phone stays linked, and the Connection continues in your Polymorfa project.

Before you begin#

  • A project and a credential with connections:manage on your server.
  • A destination Connection reserved through QuickLink.
  • Access to the source's authentication state: the Baileys SignalStoreSnapshot, or the whatsmeow device store database.

In the Console, Connections → New connection → Import existing connections shows the same steps for each source.

Import a Baileys session#

  1. Stop the source

    Stop all writes to the Baileys authentication state, then take the SignalStoreSnapshot.

  2. Request the handoff key

    Call Get handoff keys for the destination Connection:

    Shell
    curl -X POST "https://api.polymorfa.com/platform/connections/$CONNECTION_ID/handoff-keys" \
      -H "Authorization: Bearer $POLYMORFA_KEY"

    The response contains runnerPublicKeyB64, the Curve25519 public key to seal the snapshot to (base64url, no padding), and handoffId, which you send back in the next step.

  3. Seal the snapshot

    Seal the snapshot JSON to runnerPublicKeyB64 as a sealed box: the 32-byte ephemeral public key followed by the ciphertext, base64-encoded. Calculate the SHA-256 hash of the unsealed snapshot JSON as hex.

  4. Submit the sealed snapshot

    Call Import handoff state:

    Shell
    curl -X POST "https://api.polymorfa.com/platform/connections/$CONNECTION_ID/handoff-import" \
      -H "Authorization: Bearer $POLYMORFA_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "handoffId": "'"$HANDOFF_ID"'",
        "sealedEnvelopeB64": "'"$SEALED_ENVELOPE"'",
        "snapshotHashHex": "'"$SNAPSHOT_SHA256"'"
      }'

    Polymorfa verifies the hash after decrypting the snapshot.

  5. Wait for the connection

    Keep Baileys offline until the Connection reports connection.connected or its status is CONNECTED. Then resume traffic through Polymorfa.

Import a whatsmeow session#

whatsmeow sessions move through assisted migration. The Console does not accept raw database uploads.

  1. Keep the whatsmeow device store offline and its database unchanged.
  2. Export the device record and Signal tables from one consistent database snapshot.
  3. Send the snapshot through the assisted migration path.
  4. Keep the original store unchanged until Polymorfa confirms the imported Connection is connected.

Verify the import#

Read the Connection with Get connection, or watch for connection.connected on a webhook. Send a test message before you retire the source.

See also#