Notix
Integrations

Send email from Deno with tight permissions.

Deno can import notix-js straight from npm, or skip the dependency and call the API with fetch. Either way, grant only what the send needs: network access to app.usenotix.dev and read access to the one environment variable.

The send

Send an email from Deno.

deno run --allow-net=app.usenotix.dev --allow-env=NOTIX_API_KEY send.ts
const response = await fetch("https://app.usenotix.dev/api/v1/emails", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${Deno.env.get("NOTIX_API_KEY")}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from: "Acme <receipts@acme.com>",
    to: "maria@example.com",
    subject: "Your receipt",
    html: "<p>Thanks for your order.</p>",
  }),
});
console.log(await response.json());

The from address must be on a domain you have verified in Notix. Step by step: the cURL quickstart and the longer guide to sending email from Deno.

Environment

One API key, kept on the server.

Create an API key on the API keys page of the Notix console and store it as NOTIX_API_KEY in the environment, read with Deno.env.get. Read it only in code that runs on the server, never in anything shipped to a browser.

A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.

.env
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
FAQ

Questions, answered.

Which permissions does a Deno send need?
Network access to app.usenotix.dev and environment access to NOTIX_API_KEY: --allow-net=app.usenotix.dev --allow-env=NOTIX_API_KEY. Nothing else.
What if the same request runs twice?
Send an Idempotency-Key header (idempotencyKey in notix-js) with a value that names the thing being sent, such as order-4471-receipt. A repeat with the same key and body returns the first result and sends nothing new; the same key with a different body is refused with 409.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.

The free plan does not ask for a card.

Send your first email in five minutes.

Verify a domain, copy an API key, make one call. The free plan does not ask for a card.