Appnigma
SDKYour functions

Last updated on October 23, 2026

Your functions: catalog and run

List the functions written for your microserver, and run one for an end customer.

Your own functions

Beyond post and pull, your microserver can hold functions written for you. Each one is for one platform and has a name and a shape for its input and output. catalog lists them, and run calls one.

Each function has one live version. A change to a function replaces it when the change goes live, and run always calls the live version.

List your functions: catalog

catalog lists your functions, with the platform each one is for and the JSON Schema of its input and output.

const { functions } = await appnigma.catalog({ platform: "hubspot" });
for (const fn of functions) {
  console.log(fn.platform, fn.name, fn.description);
}
client.catalog(platform: "hubspot")[:functions].each do |function|
  puts "#{function[:platform]} #{function[:name]} #{function[:description]}"
end
for function in client.catalog(platform="hubspot")["functions"]:
    print(function["platform"], function["name"], function["description"])
platformstringoptional

Narrows the list to one platform. Leave it out for every platform.

Each entry in functions has these fields. Names are shown as in TypeScript; in Ruby and Python they are input_schema and output_schema.

platformstring

The platform the function runs on.

namestring

The function's name.

descriptionstring

What the function does.

inputSchemaobject

JSON Schema of what the function takes.

outputSchemaobject

JSON Schema of what the function answers.

ownerobject

{ type: "customer" } when every end customer can use it, or { type: "end_customer", endCustomerId } when it was written for one of them.

Until a function has gone live for you, the list is empty, not an error.

Run a function: run

run calls one of your functions, by platform and name, for one end customer. The input is checked against the function's shape before anything runs, so a wrong or missing field is an input error listing every problem. Formats and patterns, such as an email or a fixed layout for a code, are checked by the function itself, so those refusals arrive from it with the same code.

What runs is always the function's live version. The answer says whose function ran and which version, in ranAs.

const { output, ranAs } = await appnigma.run({
  endCustomerId: "lawfirm-123",
  platform: "hubspot",
  functionName: "invoice-to-deal",
  input: { invoiceId: "inv_1042", amount: 1250 },
});
console.log("deal", output.dealId, "ran as", ranAs.owner, `v${ranAs.version}`);
result = client.run(
  end_customer_id: "lawfirm-123",
  platform: "hubspot",
  function_name: "invoice-to-deal",
  input: { "invoiceId" => "inv_1042", "amount" => 1250 }
)
puts "deal #{result[:output]["dealId"]}, ran as #{result[:ran_as][:owner]} v#{result[:ran_as][:version]}"
result = client.run(
    end_customer_id="lawfirm-123",
    platform="hubspot",
    function_name="invoice-to-deal",
    input={"invoiceId": "inv_1042", "amount": 1250},
)
print("deal", result["output"]["dealId"], "ran as", result["ran_as"]["owner"], result["ran_as"]["version"])

Names are shown as in TypeScript. Ruby and Python use the same names in snake case: end_customer_id, function_name, ran_as.

endCustomerIdstringrequired

Your own id for your customer.

platformstringrequired

The platform the function runs on. Required, because the same name can exist on two platforms and mean two different things.

functionNamestringrequired

The function's name, from catalog.

inputobjectrequired

What the function takes, in the shape it declared. Keys are sent as written, never renamed, so use the function's own names, as in the Ruby and Python examples.

outputany

What the function answered, in the shape it declared, with its keys as the function wrote them.

ranAsobject

Whose function ran, and which version. owner is customer when your own function ran, end_customer when the end customer has a function of their own by that name and it ran, or standard for logic every customer gets. version is the version that ran.

Note

Before TypeScript 0.3.0 and Ruby 0.2.0, run took a version and catalog listed one for each function. Both are gone. A version sent by an older package is ignored, and the live version runs.

In TypeScript, your editor can check the names and the input shapes. See Types for your functions.

When it fails

  • An input that does not match the function's shape: SdkInputError in TypeScript, Appnigma::InputError in Ruby, InputError in Python.
  • FUNCTION_NOT_FOUND: no function with that name on that platform. When the name exists only on another platform, the error's details.platforms says which.
  • FUNCTION_RETIRED: the function was live and was removed from your logic, so it will not answer again. The error's details name the function and when it was retired. This is a SdkRetiredError in TypeScript, an Appnigma::RetiredError in Ruby and a RetiredError in Python, and it is never tried again.
  • PLATFORM_NOT_ENABLED: that platform is not switched on for you.
Warning

run is made once and never tried again. It is your own function, and only you know whether running it twice is harmless. If it fails with a network or server error, decide in your code whether to call again.

Every code is on Errors.

On this page