Skip to content

Webhooks

A Cruisello account can send its notifications to up to five HTTPS URLs, next to email and Discord. Add one in Account settings under More ways to get alerts, or let a connected agent add one with add_webhook.

Every request follows Standard Webhooks, so any Standard Webhooks library can verify it.

The request

POST to your URL with content-type: application/json, user-agent: Cruisello-Webhooks/1 and three headers:

HeaderValue
webhook-idA unique message id: msg_ and 32 hex characters
webhook-timestampWhen the message was signed, in Unix seconds
webhook-signaturev1, and the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}

The body:

{ "type": "price-alert", "timestamp": "2026-11-29T08:00:00.000Z", "data": {} }

type is one of the event types below. timestamp is ISO 8601 UTC. Prices are integers in minor units (cents) next to their currency.

The secret

The signing secret is whsec_ followed by the base64 of 32 random bytes. It is shown once, when the webhook is added. The HMAC key is the base64-decoded part after whsec_, not the string itself.

Verifying

  1. Read the raw body before parsing it. Re-serialized JSON will not match.
  2. Reject a webhook-timestamp more than 5 minutes from your clock.
  3. Compute v1, and the base64 HMAC-SHA256 of {id}.{timestamp}.{body}, and compare it in constant time with each space-separated entry of webhook-signature.
  4. Keep the webhook-ids you handled in the last 5 minutes and drop repeats.

TypeScript (Node, Bun, Deno or Workers):

async function verifyCruiselloWebhook(
  secret: string,
  headers: Headers,
  body: string,
): Promise<boolean> {
  const id = headers.get("webhook-id") ?? "";
  const timestamp = headers.get("webhook-timestamp") ?? "";
  const signatures = (headers.get("webhook-signature") ?? "").split(" ");
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const keyBytes = Uint8Array.from(atob(secret.replace(/^whsec_/, "")), (c) =>
    c.charCodeAt(0),
  );
  const key = await crypto.subtle.importKey(
    "raw",
    keyBytes,
    { name: "HMAC", hash: "SHA-256" },
    false,
    ["verify"],
  );
  const signed = new TextEncoder().encode(`${id}.${timestamp}.${body}`);
  for (const entry of signatures) {
    const [version, value] = entry.split(",");
    if (version !== "v1" || !value) continue;
    const mac = Uint8Array.from(atob(value), (c) => c.charCodeAt(0));
    if (await crypto.subtle.verify("HMAC", key, mac, signed)) return true;
  }
  return false;
}

Python:

import base64, hashlib, hmac, time

def verify_cruisello_webhook(secret: str, headers: dict, body: bytes) -> bool:
    msg_id = headers["webhook-id"]
    timestamp = headers["webhook-timestamp"]
    if abs(time.time() - int(timestamp)) > 300:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f"{msg_id}.{timestamp}.".encode() + body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    for entry in headers["webhook-signature"].split(" "):
        version, _, value = entry.partition(",")
        if version == "v1" and hmac.compare_digest(value, expected):
            return True
    return False

Event types

The user's notification switches apply: a kind switched off is not sent to webhooks either.

price-alert

A watched cruise got cheaper. price-alert-daily carries the same data once a day for alerts set to a daily summary.

{
  "alertId": "8c1d4e8a-6c1f-4f0b-9a63-2f6f6f1c2b11",
  "sailing": {
    "id": "5f0c1a2b-3d4e-4f5a-8b6c-7d8e9f0a1b2c",
    "orcaKey": "RCL-WN-20270307",
    "url": "https://cruisello.com/cruises/RCL-WN-20270307",
    "name": "7-night Western Caribbean from Miami",
    "shipName": "Wonder of the Seas",
    "departureDate": "2027-03-07",
    "nights": 7
  },
  "price": { "currency": "USD", "perPersonMinor": 89900, "previousPerPersonMinor": 104900 },
  "convertedPrice": { "currency": "EUR", "perPersonMinor": 83100 },
  "cabinType": "balcony",
  "guestCount": 2,
  "priceBook": "USD",
  "watching": { "guestCounts": [2], "currencies": ["USD"] },
  "quotes": [
    { "guestCount": 2, "priceBook": "USD", "currency": "USD", "perPersonMinor": 89900, "cabinType": "balcony", "isLowest": true }
  ]
}

convertedPrice is null when the fare is already in the account's currency. previousPerPersonMinor, cabinType, guestCount, priceBook and watching can be null, and quotes can be empty. priceBook is the fare market the quote came from.

port-wish

Cruises calling at ports the user wants to visit got cheaper. One message per run, grouped by port.

{
  "ports": [
    {
      "wishId": "1b2c3d4e-5f60-4718-8293-a4b5c6d7e8f9",
      "portId": "c3d4e5f6-0718-4293-a4b5-c6d7e8f90a1b",
      "portName": "Bergen",
      "countryName": "Norway",
      "currency": "EUR",
      "maxPerPersonMinor": 150000,
      "cruisesUrl": "https://cruisello.com/cruises?stopoverPorts=bergen",
      "sailings": [
        {
          "sailingId": "d4e5f607-1829-43a4-b5c6-d7e8f90a1b2c",
          "orcaKey": "MSC-EU-20270601",
          "url": "https://cruisello.com/cruises/MSC-EU-20270601",
          "shipName": "MSC Euribia",
          "departureDate": "2027-06-01",
          "nights": 7,
          "perPersonMinor": 99900,
          "perNightMinor": 14271
        }
      ]
    }
  ]
}

maxPerPersonMinor is null when the wish has no price limit.

cruise-review

A cruise the user logged has ended, so its ports can be confirmed.

{
  "pastCruiseId": "e5f60718-293a-44b5-c6d7-e8f90a1b2c3d",
  "shipName": "Wonder of the Seas",
  "departureDate": "2026-11-15",
  "returnDate": "2026-11-22",
  "reviewUrl": "https://cruisello.com/account/cruises"
}

test

Sent by Send test in the account settings or the test_webhook agent action. data is { "webhookId": "<the webhook's id>" }.

Delivery

  • Answer with a 2xx status within 10 seconds. Any other status, a timeout or a redirect counts as a failure. Redirects are not followed and the reply body is not read.
  • Each message is sent once. There are no retries.
  • After 20 failures in a row the webhook is paused. Switch it back on in the account settings once the endpoint works again.
  • The URL must be https on the default port, without credentials, and must resolve to a public address.

Rotating and deleting

There is no rotation in place. Add a new webhook, which gets a new secret, then delete the old one in the account settings or with the delete_webhook agent action. When a user disconnects an agent that added webhooks, they choose whether those webhooks go too.