Event

trigger.affinity_event
TriggerCRM & salesconnection requiredruns in-engine

Registers a webhook subscription in the tenant's Affinity instance on publish and starts one run per delivered event. Affinity does not sign deliveries, so the callback URL is the only secret.

Start a run when Affinity emits an event (list entry, person, organization, opportunity, note, field value…).

Connection

Required
Yes — the node will not save without one
Auth type
API key
Providers
Affinity
Secret shape
the Affinity API key
Resolved by
config.connection_id, else node.connection_id
Note
Webhooks are instance-wide: the subscription this creates is visible to the whole Affinity instance and counts against its limit of three. Only its creator (or an admin) can delete it, so keep the connection on the key that registered it. Publishing also needs MANTLE_APP_PUBLIC_BASE_URL set to a URL Affinity can reach.

Configuration

1 field, none required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
events
Affinity event names to subscribe to. Any well-formed name is accepted, not only the ones listed — Affinity adds new ones.
arrayNo["list_entry.created"]1–64 characters; array of string—

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "events": [
    "list_entry.created"
  ]
}

Output

One shape.

affinity event

The flattened Affinity delivery. `body`'s own keys vary by object_type, so the shape is open below the declared fields.

Extra keys beyond the ones listed can appear.

FieldTypeExample
type
Affinity's event name, e.g. list_entry.created. Branch on this when the trigger subscribes to more than one.
stringlist_entry.created
object_type
The half of `type` before the dot — list, list_entry, person, organization, opportunity, field, field_value, note, file or reminder.
stringlist_entry
action
The half of `type` after the dot: created, updated, deleted or merged.
stringcreated
id
Id of the object the event is about, lifted out of the body as a string so a large id survives. Empty when the body carries no id.
string388
sent_at
When Affinity sent the event, epoch seconds. Part of the idempotency key, so a redelivery cannot start a second run.
number1631120151
sent_at_iso
The same instant as an ISO-8601 UTC string, for nodes that want a date.
string2021-09-08T16:55:51Z
body
Affinity's own event body — the list entry, person, organization, field value… Its keys depend on object_type, which is why this shape is open.
object—
payload
The delivery exactly as Affinity sent it ({type, body, sent_at}), for anything the fields above do not lift out.
object—
{
  "action": "created",
  "body": {
    "created_at": "2021-09-08T09:55:50.321-07:00",
    "creator_id": 38603,
    "entity": {
      "first_name": "John",
      "id": 70796737,
      "last_name": "Doe",
      "primary_email": "john@affinity.co",
      "type": 0
    },
    "entity_id": 38706,
    "entity_type": 0,
    "id": 388,
    "list_id": 26
  },
  "id": "388",
  "object_type": "list_entry",
  "payload": {
    "sent_at": 1631120151,
    "type": "list_entry.created"
  },
  "sent_at": 1631120151,
  "sent_at_iso": "2021-09-08T16:55:51Z",
  "type": "list_entry.created"
}

Notes

  • Publishing creates the subscription in Affinity; unpublishing, disabling or archiving deletes it. A workflow that is off is off at Affinity too.
  • Affinity documents no signature on a delivery, so anyone who learns the callback URL can start a run — treat the event body as untrusted input.
  • Affinity allows three webhook subscriptions per instance, and this trigger uses one per published workflow.
  • A subscription whose deliveries keep failing is disabled by Affinity after about ten hours of retries; publishing again re-arms it.

See Event run in a workflow.

In a technical demo we add the Affinity connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.