# n8n

> OTP.ps nodes for n8n (an action node and an instant trigger), or the same with n8n's built-in HTTP Request and Webhook nodes.

> **Status: built and tested, not yet on npm.** Once OTP.ps publishes `n8n-nodes-otp-ps`, install it in **Settings → Community Nodes**. Until then, use the [built-in nodes](#with-n8ns-built-in-nodes).

## The OTP.ps nodes

- **OTP.ps**: verification links (create, get, get many, cancel), codes (send, check), account (balance, usage).
- **OTP.ps Trigger**: starts the workflow when a customer confirms a link (or it expires or is canceled). It registers its own [webhook](/docs/webhooks) with OTP.ps when the workflow is activated, removes it when deactivated, and **refuses any request whose signature doesn't match**.

Add an **OTP.ps API** credential with your key (start with a test key).

A cash-on-delivery workflow: **WooCommerce / Shopify Trigger** (order created) → **IF** cash on delivery → **OTP.ps: Create verification link** (reference = order number). A second workflow: **OTP.ps Trigger** (Link confirmed) → **Shopify / WooCommerce: Update order** using `reference`.

## With n8n's built-in nodes

- **HTTP Request**: `POST https://otp.ps/api/v1/verify/links`, authentication "Header Auth" (`Authorization` = `Bearer <key>`), JSON body as in [Verification links](/docs/verification-links).
- **Webhook** node (POST): copy its production URL into the OTP.ps dashboard (Webhooks). Before acting on an event, confirm it with an **HTTP Request** `GET https://otp.ps/api/v1/verify/links/{{$json.body.data.id}}` and check `status` is `approved`, or check the `OTP-Signature` header in a **Code** node as on the [Webhooks](/docs/webhooks) page.

## How it was tested

Both nodes run against the OTP.ps API with a stand-in for n8n's runtime:
- every operation of the action node;
- the trigger registering itself, accepting a genuine signed event, refusing a forged one, and removing itself.

The package also builds to the files n8n loads.
