Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Affinity

Affinity

Relationship CRM (API v2): lists, list entries, persons and companies with search.

6 actions API key 6 read0 write Calls api.affinity.co

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "affinity" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

List companiesreadaffinity.list_companiesList companies in the Affinity directory (needs the Export All Organizations directory permission).
InputTypeDescription
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.list_companies",
  input: {},
});
List list entriesreadaffinity.list_list_entriesList the entries (people, companies or opportunities) on one list; add field ids to include their field values.
InputTypeDescription
list_idintegerRequiredList id
field_idstringOptionalOne field id whose values to include, e.g. field-1234
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.list_list_entries",
  input: {
    "list_id": 1
  },
});
List listsreadaffinity.list_listsList the Affinity lists (person, company and opportunity lists) with their ids and types.
InputTypeDescription
termstringOptionalCase-insensitive substring of the list name
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.list_lists",
  input: {},
});
List personsreadaffinity.list_personsList people in the Affinity directory (needs the Export All People directory permission).
InputTypeDescription
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.list_persons",
  input: {},
});
Search companiesreadaffinity.search_companiesSearch companies by name or primary domain (term of at least 3 characters). Beta endpoint.
InputTypeDescription
termstringRequiredSearch term, minimum 3 characters
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.search_companies",
  input: {
    "term": "<term>"
  },
});
Search personsreadaffinity.search_personsSearch people by name or primary email (term of at least 3 characters). Beta endpoint.
InputTypeDescription
termstringRequiredSearch term, minimum 3 characters
cursorstringOptionalCursor from pagination.nextUrl for the next page
limitintegerOptionalItems per page, 1 to 100 (default 100)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "affinity.search_persons",
  input: {
    "term": "<term>"
  },
});