Back to SendHarbor

Integrations and recipes

Send SMS from the tools you already use. Each recipe calls the SendHarbor HTTP API and receives signed status webhooks.

SendHarbor is a hosted service: every SMS goes through SendHarbor to an Android phone that you connect. A recipe is a guide with example code for your tool, not an app to install.

Before you start

  1. Create an account and try the sandbox. Sandbox messages are simulated: no real SMS are sent.
  2. In the workspace, open API keys and create a key with the rights messages:send, messages:read and devices:read. Keep it on your server or in the secret settings of your tool.
  3. For real SMS, connect an Android phone with an active SIM. The request below lists your phones; the id of each one is its phone ID.
  4. For status updates, open API and webhooks, enter the address that receives events and save. Copy the secret: it is shown once.
List your phones
curl https://sendharbor.app/api/devices \
  -H "Authorization: Bearer $SENDHARBOR_API_KEY"
Quick start on your phone Create an account Read the API docs

Checking status webhooks

SendHarbor signs every webhook with HMAC-SHA256 and your webhook secret. The signature covers the timestamp, a dot and the exact request body. Reject a request with a wrong signature or a timestamp more than 300 seconds away from your clock.

Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';

// Headers: X-Sms-Timestamp and X-Sms-Signature.
// rawBody: the exact bytes of the request body, before JSON parsing.
export function verifySendHarbor(rawBody, timestamp, signature, secret) {
  if (!/^\d{10,11}$/.test(timestamp ?? '')) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = Buffer.from('sha256=' + createHmac('sha256', secret)
    .update(timestamp + '.').update(rawBody).digest('hex'));
  const supplied = Buffer.from(String(signature ?? ''));
  return supplied.length === expected.length && timingSafeEqual(supplied, expected);
}

An event can arrive more than once and out of order. Process each event id once and keep the highest status.sequence for each message.

Try each recipe in the sandbox or with your own phone number before you send to customers.

Missing your tool?

Any tool that can send an HTTPS request can use the API. Tell us which recipe you need:

[email protected]