# Other systems steps

> Connect workflows to other systems. Call web APIs, exchange files over FTP and SFTP, send and read EDI messages, use AI, and geocode addresses.

These steps talk to something outside SAPUGO: a web API, a file server, a trading partner's EDI messages, or an AI model.

Calls to other systems take time and can fail. Keep them outside a [transaction](/docs/workflows/nodes/data#group-writes-in-a-transaction), and plan what happens when a call fails: wrap it in **Try / Catch / Finally** to record the error, retry, or carry on.

## Keep credentials safe

Store API keys and passwords as secrets under **Settings**, **Developer Tools**, **Secrets**, with **New secret**. On a step's text input, use the lock icon to pick a secret instead of typing the value. Once saved, a secret's value can't be read again. To change it, use **Rotate**.

## Web APIs

**HTTP Request** makes one call.

- The method: GET, POST, PUT, PATCH, or DELETE.
- The address, headers, and body.
- The authentication: none, basic (username and password), or bearer token.
- A timeout, and how to read the response, for example as JSON.

When a workflow makes several calls to the same system, create a **New HTTP Client** once with the base address, authentication, and defaults. Then use **HTTP GET**, **HTTP POST**, **HTTP PUT**, **HTTP PATCH**, and **HTTP DELETE** with it.

Use **JSON Parse** and **Break Struct** to pick values out of a response, and **Make Struct** or **JSON Stringify** to build a request body.

> **Note:** An HTTP step is for when your workflow calls another system. A [webhook](/docs/webhooks) works the other way around: SAPUGO tells another system about every change to a table, without a workflow.

## File servers

**New FTP / SFTP Client** connects to a file server over FTP, FTPS, or SFTP, with a host, port, and credentials. Then use:

| Step | What it does |
| --- | --- |
| **List FTP Directory** | Lists the files and folders at a path. |
| **Download FTP File** | Downloads a file so other steps can read it. |
| **Upload FTP File** | Uploads a file, such as a generated CSV. |
| **Delete FTP File** | Deletes a file. |
| **Rename / Move FTP Entry** | Renames or moves a file or folder. |
| **Create FTP Directory**, **Remove FTP Directory** | Create or remove a folder. |
| **Stat FTP Entry** | Checks whether a path exists and reads its details. |

A common pattern: on a schedule, list a supplier's folder, download each new file, read it with the [CSV steps](/docs/workflows/nodes/files-and-documents#csv-files), write the records, then move the file into a "done" folder.

## EDI messages

SAPUGO reads and writes three EDIFACT message types used between trading partners:

| Message | Meaning | Steps |
| --- | --- | --- |
| ORDERS | Purchase order | **Parse EDIFACT ORDERS**, **Generate EDIFACT ORDERS** |
| DESADV | Despatch advice | **Parse EDIFACT DESADV**, **Generate EDIFACT DESADV** |
| PRICAT | Price catalogue | **Parse EDIFACT PRICAT**, **Generate EDIFACT PRICAT** |

A parse step reads a message and returns its header and lines, on a **Valid** or **Invalid** path. A generate step builds a message file from a header and lines. Always decide what happens to a message that doesn't parse, for example notifying a group and keeping the file for review.

Use these only when your partner actually exchanges EDIFACT messages. If they send a CSV file on a server, use the file server and CSV steps instead.

## AI

| Steps | What they do |
| --- | --- |
| **New AI Client**, **AI Complete**, **AI Embed** | Use SAPUGO's built-in AI. **New AI Client** sets the model tier and instructions, **AI Complete** returns text for a prompt, and **AI Embed** returns a vector for search and matching. These use your organization's AI credits. |
| **Compatible AI Client**, **Compatible Complete**, **Compatible Embed** | The same, using an AI service you provide that offers an OpenAI-compatible API, with your own key. These don't use AI credits. |

Use AI for judgment or drafting that a rule can't express, such as classifying a free-text request or drafting a reply. Decide what happens with the result and when the call fails. Don't use AI for calculations, totals, or status changes. Use value steps and business rules for those.

## Addresses to locations

**Geocode Address** turns a street address into a point you can store in a [Location column](/docs/columns/geo-point) or use with the [location values](/docs/workflows/nodes/values#locations), such as distance and nearest.

## Plan your integrations

For each integration, name the other system, what is sent, what is kept from the response, and what happens when the call fails. Keep every key and password in **Secrets**, never in the workflow itself.

  - [Webhooks](/docs/webhooks): Send every change on a table to another system.
  - [File and document steps](/docs/workflows/nodes/files-and-documents): Read and build CSV, spreadsheet, and PDF files.

---

Source: https://community.sapugo.app/docs/workflows/nodes/other-systems
