# FLOWii: connecting

The assistant reads from FLOWii who is writing to it: the contact and the
partner, business cases, orders, and events and tasks. It never writes to
FLOWii. What exactly it may read, you decide for each mailbox separately. How
connections work in draften in general is described on the
[Integrations](/en/admin/integrations) page.

## What you need

- FLOWii with a **paid licence** — the FREE licence has no API.
- A **FLOWii administrator** — only they can set a user's access rights.
- In draften, an **owner or manager of the organisation**.

## In FLOWii

Over the API, FLOWii signs in with **a user's e-mail and password** plus an
API key. So draften needs the user's password — that is why you make a
**separate user with the narrowest rights** for the assistant, not a person's
account.

### A user with the narrowest rights

1. Open **Firma** (Company) → **Uživatelé** (Users) → **Nový uživatel** (New
   user). Fill in the first name, the surname and the login e-mail — note it
   down, draften will need it.
2. Open the new user → the **Přístupová práva** (Access rights) tab. For the
   modules the assistant should read, choose **Prohlížení** (Viewing); for all
   the others, **Zakázaný** (Forbidden):
   - **Partneři** (Partners) — the contact and the partner,
   - **Obchodní případy** (Business cases),
   - **Zakázky** (Orders),
   - **Události** (Events) and **Úlohy** (Tasks).
3. The user must be active and have a password set. The administrator
   activates them; the user sets the password at the first sign-in. Every
   user is a paid licence in FLOWii.

You can save the same rights as a profile and use it again: the cog in the top
menu → **Nastavení** (Settings) → **Přístupová práva** → **Profily**
(Profiles) → **Nový profil** (New profile); then choose it for the user in the
**Profil** (Profile) field.

### API key

The cog in the top menu → **Nastavení** → **Rozšíření** (Extensions) →
**API** → **FLOWii REST API**. The **API klíč** (API key) is shown — copy it.

### Company id

Only when the user's login reaches several companies. You do not need to look
the id up: the connection test in draften lists the companies with their ids.

## In draften

1. Open Organisation → **Integrations** and, in the **Integrations** card,
   fill in:
   - **System** — **FLOWii**,
   - **Name** — for example `FLOWii - sales`,
   - **The user's login e-mail** — the e-mail of the user from the previous
     step,
   - **Company id (optional)** — empty if the user reaches only one company,
   - **The user's password** and **API key**.

   Click **Add connection**. The password and the key are stored encrypted
   and never shown again.
2. In the connection's row, open the **⋯** menu → **Test the connection**. In
   a moment it shows "Connection fine (…), account …" with the company's
   name. When the user reaches several companies, the test says "The login
   reaches these companies - put the right one's id into "Company id""; fill
   in the id and run the test again. Modules the user may not read are listed
   under "Not available with this token:" (the module names are in Slovak, as
   FLOWii returns them).
3. In the **Which mailboxes may use the connection** part, click **Grant** by
   a mailbox, tick what the assistant may read and click **Save the grant**:
   - **Contact and partner**,
   - **Business cases** and, under it, **Anticipated income**,
   - **Orders**,
   - **Events and tasks** and, under it, **Notes of events**.
4. The assistant's editor then adds, in the assistant's Settings →
   **Knowledge**, a source of the **external system** kind and chooses what
   the assistant really reads — see
   [Connecting a CRM and other systems](/en/connecting-a-crm).

**When the user's password changes**, the connection stops working. Paste the
new password into the fields under **New access secret** by the connection
(the password and the API key) and click **Replace**; then **Test the
connection** again.

## Connection test errors

The test's message is in English, straight from FLOWii or from draften:

| In the message | What it means | What to do |
|---|---|---|
| `the login, the password or the API key was refused` | FLOWii did not accept the e-mail, the password or the API key | check all three; the user must be active and the licence paid |
| `the login reaches N companies - set the company's id on the connection` | the user reaches several companies | fill in the **Company id** from the test's list |
| `the login does not reach company …` | the user does not reach the company id entered | correct the id, or give the user access to the company |
| `the login reaches no company` | the user reaches no company | assign the user to a company |
| `the user of the login may not read this (403)` | the user may not read a module | set **Prohlížení** for the modules needed |
| `FLOWii rate limit reached (429)` | the daily API call limit is used up | try later |
