DevelopersPair your own iPhone

Pair a bring-your-own iPhone line.

Connect an iPhone you already own through a Mac running the iSnap bridge app. Issue an activation code, watch the line connect, check its health, raise its limits.

Recipe 0510 min readDevelopers

A rented iSnap line runs on hardware iSnap operates. A bring-your-own iPhone (BYOP) line runs on yours: your iPhone and its number, paired with a Mac that runs the iSnap bridge app. You keep the device, its phone plan and the number; iSnap provides the software, the API and the dashboard. The API and the docs call it BYOD, for “bring your own device”, so that is the word in the endpoints below.

The flow is written for a platform that pairs lines for its own users, as the docs’ samples are, but it works the same when the iPhone on the desk is yours. On the cost side, BYOP is $15 a month per line, with no base fee, so 5 lines cost $75 a month. That is iSnap’s software: you also bring the iPhone, its phone plan, and a Mac (yours or a hosted macOS session). Pricing and the comparisons set it against renting.

What a line needs

  • An iPhone with its number and its phone plan. It is the line’s number.
  • A Mac on macOS 14 or later, paired with that iPhone and left on. The bridge app runs there and sends and receives for the line.
  • Two permissions on the Mac: Full Disk Access, so the bridge can read messages, and Automation, so it can control Messages. Without Full Disk Access the line can neither send nor report what it receives.
  • Text Message Forwarding from the iPhone to the Mac, if the line should reach contacts who aren’t on iMessage. Without it there is no SMS route (recipe 04).
  • A BYOD slot for each line. Direct accounts buy slots by card in the dashboard; wholesale partners need none, because BYOD lines are billed on their monthly invoice.

No Mac to spare? A hosted macOS session is a macOS user account on a Mac iSnap hosts, where the bridge app runs your line under your own Apple ID. It is not a line: it is the Mac half of one. Direct accounts buy sessions in the dashboard, and they are prepared after the payment, not at once.

1. Check the installer, then issue a code

GET /v1/apps needs no credential: it returns the bridge app’s installer link, its version and whether an installer is available. Your user installs the app from that link on the Mac. When they have opened it, your backend calls POST /v1/byod/pair.

pair-device.ts
import { APIError, ISnapClient } from '@isnap/sdk'

const client = new ISnapClient({ apiKey: process.env.ISNAP_API_KEY ?? '', maxRetries: 2 })

const apps = await client.apps.manifest()
if (!apps.macos.available) {
  throw new Error('No installer of the bridge app is offered for macOS.')
}

// Issue the code when the user has installed and opened the bridge app: it is valid for 5 minutes.
try {
  // The operation does not honor Idempotency-Key: a retry issues another code.
  // Give the user the code of the response you received.
  const pairing = await client.byod.pair({ metadata: { crm_account_id: 'acct_1042' } })
  // Show pairing.activation_code to the user who pairs the device. Do not log it.
  console.log(pairing.download_urls.macos, pairing.expires_at)
} catch (err) {
  if (err instanceof APIError && err.code === 'payment_required') {
    console.error('This account has no BYOD slot.')
  } else if (err instanceof APIError && err.code === 'no_slot_available') {
    console.error('Every BYOD slot is used: terminate a BYOD line to free one.')
  } else {
    throw err
  }
}
From docs.isnap.ai/guides/byod#issue-an-activation-code

The response holds a single-use activation_code (it starts with act_), valid for 5 minutes, with expires_at, the installer link and the bridge version. The sample’s comments carry three rules:

  • Issue the code late. Call it when the user has installed and opened the bridge app. Five minutes is short.
  • Don’t retry blindly. The call doesn’t honor Idempotency-Key, and a retry issues another code. Show the user the code from the response you actually received.
  • Don’t log it. Show the code to the person pairing the device, and nowhere else.

The two errors in the sample are the slot rules. Without any BYOD slot the call answers 402 payment_required; with every slot in use it answers 404 no_slot_available, and terminating a BYOD line frees one. Pass metadata, as the sample does with crm_account_id, to tie the pairing to your own record.

2. The user pairs

  1. Open the bridge app on the Mac and grant the permissions it asks for.
  2. Paste the activation code and pair.
  3. iSnap creates a new line, active at once, and sends line.connected.

One wrinkle: the new line’s phone_number is an empty string until the device reports it, and no event announces its arrival. Poll GET /v1/lines/{id} until it is filled before you show the number to anyone or put it on a website.

3. Watch its health

A BYOP line depends on a Mac and an iPhone you can’t reach through the API, so health is part of the integration, not an extra. GET /v1/lines/{id}/health returns the line’s state, last_heartbeat_at, device_state, runtime_capabilities, bridge_version, storage_free_bytes, apple_id_flagged and daily_quota_remaining. It answers only for BYOD lines. Subscribe to the line events as well:

EventWhen it fires
line.connectedThe device paired and connected.
line.offlineNo report from the device for 5 minutes.
line.degradedIt still sends, but no longer receives.
line.capability_changedA feature, such as tapbacks or the SMS route, came or went.
line.apple_id_flaggedApple disabled or restricted the line’s Apple ID.

When it runs, the bridge checks for new messages every 2 seconds and reports its health every 30. While the Mac sleeps or the app is stopped, the line reports nothing and catches up when it comes back. Messages dated more than 10 minutes before a re-pairing are lost, so keep the Mac awake and the bridge running.

Features such as tapbacks, typing, read receipts, effects and threaded replies depend on that Mac and iPhone, not on iSnap. Read runtime_capabilities before your code relies on one, and fall back to a plain message when it is missing.

4. Raise its limits

This is BYOP’s advantage in the API. Every line starts on the same defaults: 50 new contacts, 200 known contacts and 600 messages per 24 hours, 60 an hour, 5 a minute. On a rented line you can only lower them; the API refuses an increase with 403 cannot_increase_limit. On a BYOP line you can raise them, within the bounds GET /v1/lines/{id}/config returns as knobs:

SettingRange on a BYOP line
daily_new_contact_limit5 to 200 per 24 hours
daily_known_contact_limit10 to 1,000 per 24 hours
daily_total_message_limit10 to 1,000 per 24 hours
hourly_message_limit5 to 200
minute_message_limit1 to 60

Set them with PATCH /v1/lines/{id}/config. A limit you can raise is still worth respecting: the defaults exist to protect the line and the people it texts. Move in steps, and watch your reply rates and line.apple_id_flagged as you go. You remain responsible for having permission to text the people you message and for honoring opt-outs, on your own iPhone as on a rented one.

Replacing a phone or a Mac

One pairing is one line. To move to a new Mac or iPhone, pair again, which creates a new line, then end the old one with POST /v1/lines/{id}/terminate. Pairing imports no message history, and iSnap keeps messages for at least 72 hours, not forever, so your own store is the history either way.

Own it, or rent it

With BYOP the phone and the number are yours. If you ever leave, your lines leave with you, and you add devices at your own pace. If you would rather run no hardware at all, rent a dedicated number on a real iPhone from the Line Marketplace instead. Both paths use the same API, so every recipe here works on either. The bring-your-own iPhone page has the full picture.

Next recipe: Send your first iMessage. Or go back to all recipes and the API at a glance.

Put a real iPhone
to work.

Start free with no credit card. Rent a line, or bring your own iPhone.