(tasks)
A task is a defined, actionable item with references to linked records and assigned workspace members.
- list - List tasks
- create - Create a task
- get - Get a task
- update - Update a task
- delete - Delete a task
List all tasks. Results are sorted by creation date, from oldest to newest.
Required scopes: task:read
, object_configuration:read
, record_permission:read
, user_management:read
.
import { Attio } from "attio-js";
const attio = new Attio({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const result = await attio.tasks.list({
limit: 10,
offset: 5,
sort: "created_at:desc",
linkedObject: "people",
linkedRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
assignee: "[email protected]",
isCompleted: true,
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AttioCore } from "attio-js/core.js";
import { tasksList } from "attio-js/funcs/tasksList.js";
// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const res = await tasksList(attio, {
limit: 10,
offset: 5,
sort: "created_at:desc",
linkedObject: "people",
linkedRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
assignee: "[email protected]",
isCompleted: true,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetV2TasksRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetV2TasksResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Creates a new task.
At present, tasks can only be created from plaintext without record reference formatting.
Required scopes: task:read-write
, object_configuration:read
, record_permission:read
, user_management:read
.
import { Attio } from "attio-js";
const attio = new Attio({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const result = await attio.tasks.create({
data: {
content: "Follow up on current software solutions",
format: "plaintext",
deadlineAt: "2023-01-01T15:00:00.000000000Z",
isCompleted: false,
linkedRecords: [
{
targetObject: "people",
slugOrIdOfMatchingAttribute: [
{
domain: "app.attio.com",
},
],
},
],
assignees: [],
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AttioCore } from "attio-js/core.js";
import { tasksCreate } from "attio-js/funcs/tasksCreate.js";
// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const res = await tasksCreate(attio, {
data: {
content: "Follow up on current software solutions",
format: "plaintext",
deadlineAt: "2023-01-01T15:00:00.000000000Z",
isCompleted: false,
linkedRecords: [
{
targetObject: "people",
slugOrIdOfMatchingAttribute: [
{
domain: "app.attio.com",
},
],
},
],
assignees: [],
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.PostV2TasksRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.PostV2TasksResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.PostV2TasksValidationTypeError | 400 | application/json |
errors.GetV2ObjectsObjectNotFoundError | 404 | application/json |
errors.APIError | 4XX, 5XX | */* |
Get a single task by ID.
Required scopes: task:read
, object_configuration:read
, record_permission:read
, user_management:read
.
import { Attio } from "attio-js";
const attio = new Attio({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const result = await attio.tasks.get({
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AttioCore } from "attio-js/core.js";
import { tasksGet } from "attio-js/funcs/tasksGet.js";
// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const res = await tasksGet(attio, {
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetV2TasksTaskIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetV2TasksTaskIdResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.GetV2TasksTaskIdNotFoundError | 404 | application/json |
errors.APIError | 4XX, 5XX | */* |
Updates an existing task by task_id
. At present, only the deadline_at
, is_completed
, linked_records
, and assignees
fields can be updated.
Required scopes: task:read-write
, object_configuration:read
, record_permission:read
, user_management:read
.
import { Attio } from "attio-js";
const attio = new Attio({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const result = await attio.tasks.update({
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
requestBody: {
data: {
deadlineAt: "2023-01-01T15:00:00.000000000Z",
isCompleted: false,
linkedRecords: [
{
targetObject: "people",
slugOrIdOfMatchingAttribute: [
{},
{
value: 17224912,
},
{},
],
},
{
targetObject: "people",
targetRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
},
{
targetObject: "people",
targetRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
},
],
assignees: [
{
workspaceMemberEmailAddress: "[email protected]",
},
{
referencedActorType: "workspace-member",
referencedActorId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b",
},
{
referencedActorType: "workspace-member",
referencedActorId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b",
},
],
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AttioCore } from "attio-js/core.js";
import { tasksUpdate } from "attio-js/funcs/tasksUpdate.js";
// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const res = await tasksUpdate(attio, {
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
requestBody: {
data: {
deadlineAt: "2023-01-01T15:00:00.000000000Z",
isCompleted: false,
linkedRecords: [
{
targetObject: "people",
slugOrIdOfMatchingAttribute: [
{},
{
value: 17224912,
},
{},
],
},
{
targetObject: "people",
targetRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
},
{
targetObject: "people",
targetRecordId: "891dcbfc-9141-415d-9b2a-2238a6cc012d",
},
],
assignees: [
{
workspaceMemberEmailAddress: "[email protected]",
},
{
referencedActorType: "workspace-member",
referencedActorId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b",
},
{
referencedActorType: "workspace-member",
referencedActorId: "50cf242c-7fa3-4cad-87d0-75b1af71c57b",
},
],
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.PatchV2TasksTaskIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.PatchV2TasksTaskIdResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.PostV2TasksValidationTypeError | 400 | application/json |
errors.PatchV2TasksTaskIdNotFoundError | 404 | application/json |
errors.APIError | 4XX, 5XX | */* |
Delete a task by ID.
Required scopes: task:read-write
.
import { Attio } from "attio-js";
const attio = new Attio({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const result = await attio.tasks.delete({
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AttioCore } from "attio-js/core.js";
import { tasksDelete } from "attio-js/funcs/tasksDelete.js";
// Use `AttioCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const attio = new AttioCore({
apiKey: process.env["ATTIO_API_KEY"] ?? "",
});
async function run() {
const res = await tasksDelete(attio, {
taskId: "649e34f4-c39a-4f4d-99ef-48a36bef8f04",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteV2TasksTaskIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.DeleteV2TasksTaskIdResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.GetV2TasksTaskIdNotFoundError | 404 | application/json |
errors.APIError | 4XX, 5XX | */* |