# Wrike

Wrike is a project management and work collaboration platform used by teams to plan, manage, and complete work. The Sling Wrike connector extracts data from the Wrike REST API v4, supporting tasks, folders, contacts, comments, workflows, custom fields, timelogs, attachments, groups, and spaces.

{% hint style="success" %}
**CLI Pro Required**: APIs require a [CLI Pro token](https://docs.slingdata.io/sling-cli/cli-pro) or [Platform Plan](https://docs.slingdata.io/sling-platform/platform).
{% endhint %}

## Setup

The following credentials and inputs are accepted:

**Secrets:**

* `access_token` **(required)** -> Your Wrike Permanent Access Token

**Inputs (optional):**

* `wrike_host` (optional) -> The Wrike host for your account (default: `www.wrike.com`). Use `app-eu.wrike.com` for EU accounts.
* `anchor_date` (optional) -> Starting date for first sync of incremental endpoints (ISO 8601 format). Defaults to 1 year ago.

### Getting Your Permanent Access Token

1. Log in to [Wrike](https://www.wrike.com)
2. Navigate to **Apps & Integrations** > **API** or go directly to the [API Console](https://www.wrike.com/frontend/apps/index.html#/api)
3. Click **Create new app**
4. Give the app a name (e.g., "Sling Integration")
5. Click **Save**
6. Under **Permanent access token**, click **Get token**
7. Enter your Wrike password to confirm
8. Copy the token immediately — it is only shown once

{% hint style="warning" %}
**Important:** The permanent access token inherits all permissions of the user who generates it. For production use, consider creating a dedicated service account with read-only access.
{% endhint %}

### Using `sling conns`

{% code overflow="wrap" %}

```bash
sling conns set WRIKE type=api spec=wrike secrets='{ access_token: eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMiJ9... }'
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/sling-cli/environment#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export WRIKE='{ type: api, spec: wrike, secrets: { access_token: "eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMiJ9..." } }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/sling-cli/environment#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  WRIKE:
    type: api
    spec: wrike
    secrets:
      access_token: "eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMiJ9..."
    inputs:
      wrike_host: "www.wrike.com"  # optional, defaults to www.wrike.com
```

## Replication

Here's an example replication configuration to sync Wrike data to a PostgreSQL database:

```yaml
source: WRIKE
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: wrike.{stream_name}

streams:
  # sync all endpoints
  '*':

  # incremental endpoints
  tasks:
    mode: incremental
  timelogs:
    mode: incremental
  attachments:
    mode: incremental
```

This replication syncs all Wrike endpoints to PostgreSQL. Tasks, timelogs, and attachments use incremental mode to efficiently sync only new or updated records.

## Endpoints

| Endpoint        | Description                           | Incremental          |
| --------------- | ------------------------------------- | -------------------- |
| `contacts`      | All contacts (users) in the account   | No                   |
| `workflows`     | All workflows and custom statuses     | No                   |
| `custom_fields` | All custom field definitions          | No                   |
| `spaces`        | All spaces in the account             | No                   |
| `groups`        | All user groups                       | No                   |
| `folders`       | All folders and projects              | No                   |
| `tasks`         | All tasks with full field details     | Yes (`updated_date`) |
| `comments`      | All comments across tasks and folders | No                   |
| `timelogs`      | All time log entries                  | Yes (`tracked_date`) |
| `attachments`   | All file attachments                  | Yes (`created_date`) |

## EU Data Residency

If your Wrike account is hosted in the EU data center, set the `wrike_host` input to `app-eu.wrike.com`:

```yaml
connections:
  WRIKE:
    type: api
    spec: wrike
    secrets:
      access_token: "your_token"
    inputs:
      wrike_host: "app-eu.wrike.com"
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).
