An integration written as a manifest: a YAML file that describes a service's credential and its actions as HTTP requests, with no code.
Each action becomes a node in Heddle, with a success and an error output.
Example
id: acme
name: Acme
version: 1.0.0
description: Tickets in Acme.
icon: hero-ticket
base_url: https://api.acme.test/v1/
credential:
label: Acme
fields:
- name: api_key
label: API key
secret: true
auth:
type: header
name: X-Api-Key
value: "{{credential.api_key}}"
actions:
- name: Create Ticket
description: Opens a ticket.
fields:
- name: title
label: Title
request:
method: POST
path: tickets
body:
title: "{{fields.title}}"
output:
pick: [id, url]Templates
Strings in request, credential.auth and output.value may hold
{{fields.<name>}} and {{credential.<name>}}. A string that is a single
placeholder keeps the value's type. Values that end up empty are left out of the
query and the body, so optional fields need no extra syntax.
Credential auth types
bearer:tokenheader:nameandvaluequery:nameandvaluebasic:usernameandpasswordoauth2:authorize_url,token_urlandscopes. The host runs the authorization and passes the access token as{{credential.access_token}}.none
Responses
errors.ok_path: a field of the body that must betrue, for APIs that answer 200 when something failed.errors.message_pathholds why.output.path: the part of the body the node returns, likedata.items.output.pick: the keys to keep, from each item of a list.output.value: a value built from templates, in place of the body.
Pagination
pagination.type is cursor, offset or link (the Link header). The node
returns the items of every page, from pagination.items_path.
Triggers
triggers start a flow when something new shows up in the service. A trigger is
written like an action whose output is a list, plus poll:
triggers:
- name: New Ticket
request:
method: GET
path: tickets
output:
path: tickets
poll:
every: 5 # minutes, 5 when left out
id: id # the key that tells items apart, "id" when left outThe host calls the request every every minutes and starts the flow once for each
item whose id it hasn't seen. The first call only records what is already there.
See priv/integration.schema.json for the full format.
Summary
Types
Functions
The action called name, or nil.
Reads and checks the manifest at path.
Like load/1, raising with what is wrong.
Parses and checks a manifest written in YAML.
The trigger called name, or nil.
Checks a manifest already decoded into a map with string keys.