技能 产品商业 Attio核心记录全生命周期操作

Attio核心记录全生命周期操作

v20260423
attio-core-workflow-a
该工具提供对Attio平台各类对象(如人、公司、交易等)的完整CRUD(创建、读取、更新、删除)操作。支持复杂的属性值写入、高级筛选、模糊搜索以及记录间的关联,适用于构建自动化、深入的CRM数据管理流程。
获取技能
431 次下载
概览

Attio Records CRUD (Core Workflow A)

Overview

Complete record lifecycle on the Attio REST API. Records are instances of objects (people, companies, deals, custom). Values are keyed by attribute slug and are always arrays (Attio supports multiselect natively).

Prerequisites

  • attio-install-auth completed
  • Scopes: object_configuration:read, record_permission:read, record_permission:read-write
  • Understanding of Attio attribute types (see reference table below)

Attio Attribute Type Reference

TypeSlug exampleValue format
textdescription"plain string"
numberrevenue123456
email-addressemail_addresses"ada@example.com" (string shortcut)
phone-numberphone_numbers{ original_phone_number: "+14155551234" }
domaindomains"acme.com" (string shortcut)
personal-namename{ first_name, last_name, full_name }
locationprimary_location"San Francisco, CA" (string shortcut)
record-referencecompany{ target_object: "companies", target_record_id: "..." }
select / statusstage{ option: "qualified" }
currencydeal_value{ currency_code: "USD", currency_value: 50000 }
checkboxis_activetrue / false
dateclose_date"2025-06-15"
timestamplast_contact"2025-06-15T14:30:00.000Z"
ratingpriority4 (integer 1-5)

Instructions

Step 1: Create Records

// Create a person
const person = await client.post<{ data: AttioRecord }>(
  "/objects/people/records",
  {
    data: {
      values: {
        email_addresses: ["ada@example.com"],
        name: [{ first_name: "Ada", last_name: "Lovelace", full_name: "Ada Lovelace" }],
        phone_numbers: [{ original_phone_number: "+14155551234" }],
        primary_location: ["London, UK"],
        description: ["Mathematician and first programmer"],
      },
    },
  }
);

// Create a company
const company = await client.post<{ data: AttioRecord }>(
  "/objects/companies/records",
  {
    data: {
      values: {
        name: ["Babbage Analytical Engines"],
        domains: ["babbage.io"],
        description: ["Mechanical computing pioneer"],
        primary_location: ["London, UK"],
      },
    },
  }
);

Step 2: Read a Single Record

// GET /v2/objects/{object_slug}/records/{record_id}
const record = await client.get<{ data: AttioRecord }>(
  `/objects/people/records/${person.data.id.record_id}`
);

// Access values (always arrays)
const fullName = record.data.values.name?.[0]?.full_name;
const email = record.data.values.email_addresses?.[0]?.email_address;

Step 3: Update Records (PATCH vs PUT)

// PATCH: Append to multiselect values
await client.patch<{ data: AttioRecord }>(
  `/objects/people/records/${recordId}`,
  {
    data: {
      values: {
        email_addresses: ["ada.new@example.com"], // Adds to existing emails
      },
    },
  }
);

// PUT: Overwrite (assert) -- replaces all values for specified attributes
await client.put<{ data: AttioRecord }>(
  `/objects/people/records/${recordId}`,
  {
    data: {
      values: {
        email_addresses: ["only-this@example.com"], // Replaces all emails
      },
    },
  }
);

Step 4: Query with Filters and Sorts

// POST /v2/objects/{object}/records/query
const results = await client.post<{ data: AttioRecord[] }>(
  "/objects/companies/records/query",
  {
    // Shorthand filter (equality check)
    filter: {
      domains: "acme.com",
    },
    limit: 25,
  }
);

// Verbose filter with operators
const filtered = await client.post<{ data: AttioRecord[] }>(
  "/objects/people/records/query",
  {
    filter: {
      $and: [
        { email_addresses: { email_address: { $contains: "example.com" } } },
        { name: { last_name: { $eq: "Lovelace" } } },
      ],
    },
    sorts: [
      { attribute: "created_at", field: "created_at", direction: "desc" },
    ],
    limit: 50,
    offset: 0,
  }
);

Available filter operators: $eq, $not_empty, $contains, $gt, $gte, $lt, $lte, $in, $and, $or.

Step 5: Fuzzy Search Across Objects

// POST /v2/records/search -- searches across all objects
const search = await client.post<{ data: AttioRecord[] }>(
  "/records/search",
  {
    query: "Ada Lovelace",
    limit: 10,
  }
);

Step 6: Delete a Record

// DELETE /v2/objects/{object}/records/{record_id}
await client.delete(`/objects/people/records/${recordId}`);

Step 7: Link Records via Record-Reference

// Link a person to a company
await client.patch<{ data: AttioRecord }>(
  `/objects/people/records/${personId}`,
  {
    data: {
      values: {
        company: [{
          target_object: "companies",
          target_record_id: companyId,
        }],
      },
    },
  }
);

Error Handling

ErrorStatusCauseSolution
not_found404Invalid object slug or record IDVerify with GET /v2/objects
validation_error422Wrong value format for attribute typeCheck attribute type table above
rate_limit_exceeded429Exceeded 10-second sliding windowHonor Retry-After header
conflict409Duplicate on unique attributeUse PUT (assert/upsert)
insufficient_scopes403Missing record_permission:read-writeUpdate token scopes

Resources

Next Steps

For list/entry operations (pipelines, boards), see attio-core-workflow-b.

信息
分类 产品商业
名称 attio-core-workflow-a
版本 v20260423
大小 6.47KB
更新时间 2026-04-28
语言