Savaraflow
Open console
← Framework guides

Node.js

Send a test request from Express.

Call SavaraFlow from a protected Express handler or a Node worker.

Express

Connect your application

  1. Set the server environment

    Set SAVARA_HOST and SAVARA_TEST_KEY on a supported Node runtime with built-in fetch.

  2. Connect your business event

    Import the helper into an authenticated Express handler or worker. Pass a stable, URL-safe order or event ID after validating the event.

  3. Handle the result

    Read the response code and persist the returned message ID. For an uncertain response, retry the same payload and idempotency key.

Read the Express documentation
JavaScript example
export async function simulatePickup(orderId) {
  const response = await fetch(
    process.env.SAVARA_HOST + "/api/v1/messages",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer " + process.env.SAVARA_TEST_KEY,
        "Content-Type": "application/json",
        "Idempotency-Key": "pickup-" + orderId,
      },
      body: JSON.stringify({
        channel: "SMS",
        to: "+256770123456",
        body: "Your order is ready to collect.",
        scenario: "delivered",
      }),
      signal: AbortSignal.timeout(10000),
    }
  );
  return { status: response.status, result: await response.json() };
}

Before sending live

Use your own SavaraFlow deployment origin without a trailing slash and a scoped key from that deployment. Switch to a live key only after enabling the route and funding the workspace. Remove the sandbox scenario, use a recipient who agreed to receive the message, and include consent: true in the request. Keep API keys in server-side configuration.

Read the complete sending workflow

Get a quote before your first live send.

Use the live quote endpoint to review the destination cost and available balance.

Read about quotes

Choose what SavaraFlow can save on this device. You can change your choice here at any time.