Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

twc/secutix

Call the Secutix API from a script with fetch from the twc/secutix module - relative URLs, default content type, retries and timeouts.

A tenant that uses the Secutix connector sometimes needs data that the connector does not map by default, such as an extra order detail. The twc/secutix module offers a fetch function for that: it works like the global fetch, but it is wired to the Secutix connection of the tenant. The path of the request is relative to the connection, and the authentication, the rate limiting and the retry rules of the Secutix connector are applied by the platform, so the script contains no credential.

The module is meant for Secutix calls only. Every other system is called with the global fetch.

Real-world examples
  • A contact mapper script reads an additional Secutix resource of the customer and copies one field to the account.

  • A movement mapper script checks the status of an order with a second Secutix call before choosing the pass type.

Import and signature

import { fetch } from "twc/secutix";

const res = await fetch("/path/of/the/service", { Method: "POST", Body: { id: movementId } });
Function
Parameters
Returns

fetch(url, options)

url: string; options: the same object as the global fetch

A promise of { StatusCode, ResponseText }, as for the global fetch.

The imported fetch replaces the global one inside the file that imports it. A file that also needs the global function for another system imports under another name:

import { fetch as secutixFetch } from "twc/secutix";

The old name neo/secutix still works; see Obsolete neostore names. The prefix neostore is the platform's former name and is kept in technical identifiers.

What differs from the global fetch

All options (Method, Headers, Body, ThrowOnError, Cache, Throttle) and the result shape are the ones documented on fetch, including the default of throwing on a non-2xx status. The differences are the following.

Aspect

Behavior of twc/secutix

URL

A relative URL, such as /services/example, is resolved against the Secutix connection configured for the tenant.

Authentication

Added by the platform to every request. The Authentication option is not needed.

Default Content-Type

application/json when the Headers do not contain a Content-Type. No charset is added.

Retries

The call is retried only when Secutix answers 429 or 509, at most two times, with a randomised delay of about ten seconds. Other errors are not retried.

Rate limiting

Calls are paced by the platform per Secutix host, with the limit set under API rate limiting in the Secutix connector settings (Enable rate limiting is on by default).

Timeout

An attempt is abandoned after 30 seconds.

Since 5xx answers and network errors are not retried, a script that must be resilient to a brief Secutix outage handles the error itself. Because 429 and 509 are retried, a POST to Secutix must still be safe to repeat.

Example

The pass data provider below enriches the account with the answer of one Secutix call, and leaves the account unchanged if Secutix does not answer properly, returning false so that the platform knows nothing was found. The path /services/customer-segment is a placeholder for a real Secutix service path.

The endpoint is described on Pass data provider. The scripts of the Secutix extension endpoints can use the same module; their keys are on Secutix scripts.

Checking the result

The mapped value is visible on the pass data after the flow that runs the script. A 404 usually means that the relative path is wrong or that the Secutix service is not enabled for the connection; a 401 or 403 is a credentials or rights matter of the Secutix connection, to be checked with the Secutix connector setup rather than in the script.

FAQ

Why does a failing call take longer than 30 seconds to fail?

A call answered with 429 or 509 is retried twice, each attempt having its own 30-second timeout and a delay of about ten seconds separating the attempts, so the total stays around two minutes in the worst case. Caching the answer and using ThrowOnError: false limits the impact on the request that runs the script.

Last updated