Wrike Integration
Cync integrates with Wrike for project management and task tracking.
Overview
Wrike integration enables:
- Task search and viewing
- Task creation and updates
- Comment management
- Activity tracking for summaries
Setup
1. Get Access Token
- Log into Wrike
- Go to: https://www.wrike.com/frontend/apps/index.html#/api
- Create a permanent token
- Copy the token
2. Configure Environment
# .env.local
WRIKE_ACCESS_TOKEN=your-permanent-token
WRIKE_API_BASE_URL=https://www.wrike.com/api/v4
API Usage
Base URL
https://www.wrike.com/api/v4
Authentication
All requests include the token:
const headers = {
'Authorization': `Bearer ${WRIKE_ACCESS_TOKEN}`,
'Content-Type': 'application/json'
};
Common Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /tasks | List tasks |
| GET | /tasks/{id} | Get task details |
| POST | /folders/{folderId}/tasks | Create task |
| PUT | /tasks/{id} | Update task |
| POST | /tasks/{id}/comments | Add comment |
Wrike Client
// lib/wrike/client.ts
export class WrikeClient {
private baseUrl: string;
private token: string;
constructor(config: { accessToken: string }) {
this.baseUrl = process.env.WRIKE_API_BASE_URL;
this.token = config.accessToken;
}
async searchTasks(query: string) {
const response = await fetch(
`${this.baseUrl}/tasks?title=${encodeURIComponent(query)}`,
{ headers: this.getHeaders() }
);
return response.json();
}
async createTask(folderId: string, data: TaskInput) {
const response = await fetch(
`${this.baseUrl}/folders/${folderId}/tasks`,
{
method: 'POST',
headers: this.getHeaders(),
body: JSON.stringify(data)
}
);
return response.json();
}
async addComment(taskId: string, text: string) {
const response = await fetch(
`${this.baseUrl}/tasks/${taskId}/comments`,
{
method: 'POST',
headers: this.getHeaders(),
body: JSON.stringify({ text })
}
);
return response.json();
}
private getHeaders() {
return {
'Authorization': `Bearer ${this.token}`,
'Content-Type': 'application/json'
};
}
}
MCP Tools
Wrike operations are exposed as MCP tools:
| Tool | Description |
|---|---|
search_wrike_tasks | Search tasks by keyword |
create_wrike_task | Create new task in folder |
add_comment_to_wrike_task | Add comment to task |
edit_wrike_task | Update task details |
get_wrike_task_details | Get full task info |
Usage in Cync Summaries
The Collector agent fetches Wrike activity:
// Fetch daily activity
const activity = {
created: await wrike.getTasksCreatedOn(date),
updated: await wrike.getTasksModifiedOn(date),
completed: await wrike.getCompletedTasksOn(date),
timeLogged: await wrike.getTimeLogsFor(date)
};
Rate Limits
Wrike API rate limits:
- Free tier: 500 requests/hour per user
- Enterprise: Higher limits
Handle rate limits:
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
// Wait and retry
}
Task Object
| Field | Type | Description |
|---|---|---|
id | string | Task ID |
title | string | Task title |
status | string | Active/Completed/etc |
importance | string | High/Normal/Low |
dates | object | Start/due dates |
parentIds | string[] | Parent folder IDs |
responsibleIds | string[] | Assignee IDs |