Skip to content
Docs

Workflows

Send API

Call your own systems from a workflow – look something up, or send something to them.

Send API sends a request to a web address and saves the response – such as looking up an order in your shop, checking a booking or adding a lead to your CRM.

Settings

The Send API panel, with HTTP method, URL endpoint, Headers and Resulting variable

SettingWhat it does
HTTP methodGET, POST, PUT, DELETE or PATCH.
URL endpointThe address to call, starting with https:// or http://. It can include variables, such as https://api.example.com/orders/{order_number}.
HeadersOptional. Select Add Key and Value for each header, such as an Authorization key with the value Bearer abc123. Keys and values can include variables.
Payload (JSON)POST, PUT and PATCH only. The data to send – see Write the payload.
Resulting variableWhere to save the response, such as order.

Every request is sent with these headers, unless you set your own:

Accept: application/json
Content-Type: application/json
Cache-Control: no-cache
User-Agent: protocx/1.0

Write the payload

The payload is an expression, not a template – write it like JSON, with variable names on their own instead of in curly brackets:

{
  "email": email_address,
  "name": _customer.name,
  "subscribed": True,
  "notes": None
}

Important: write True, False and None with a capital letter. JSON’s true, false and null are read as variable names, and sent as empty.

To send a form instead of JSON, set a Content-Type header of application/x-www-form-urlencoded or multipart/form-data. The payload is still written as {"key": value}.

What happens

Proto sends the request and waits up to 30 seconds for a reply. It saves the response in your Resulting variable, then runs the branch that matches the reply.

Branches

BranchRuns when
SuccessYour system replies with a 2xx status, such as 200 OK.
ErrorYour system replies with an error status, such as 404 or 500. The error’s response is in your variable.
Timed outThere’s no reply within 30 seconds, or Proto can’t reach the address at all.

With an empty branch, the workflow carries on with the action after Send API.

Use the result

If the response is JSON, it’s saved in your Resulting variable. Reach inside it with a full stop or square brackets:

ResponseIn a messageIn an expression
{"status": "shipped"}{order.status}order.status == "shipped"
{"items": [{"name": "Lamp"}]}{order.items[0].name}_.len(order.items)

Proto also saves:

VariableWhat it holds
_json_api_responseThe response exactly as it came back, as text
_json_api_errorWhat went wrong, or None if nothing did

Good to know

  • The person doesn’t see the request. Use a Send message under Success to tell them what you found.
  • Proto only calls public addresses. A request to a private or internal address, such as localhost or 10.0.0.1, is skipped, and the workflow carries on.
  • Proto doesn’t retry a request that fails.
  • If the response isn’t JSON, your Resulting variable is empty. Use _json_api_response instead.
  • The status code isn’t saved. To tell errors apart, check the error response in your variable.
  • A mistake in the payload, such as a missing comma, stops the workflow. Test it in the AI Agent tester.

Stuck? Ask Advisor in the Proto dashboard, or contact us.

© Proto