# Quick Start

> JS SDK for relation IM: A simple API for building IM services.

### `Quick start`

Download using NPM

```javascript
npm install --save @relationlabs/im
npm install --save @relationlabs/auth
```

then

use `authByMetamask` to activate `Metamask` signing and acquire an `addressAuthToken`

```javascript
import { authByMetamask } from "@relationlabs/auth";

const { error, token: addressAuthToken } = await authByMetamask()
```

then

use `getRelationToken` to acquire `unifiedAuthToken`. The `APIKEY` should be acquired from the Admin.

```javascript
import RelationIM from "@relationlabs/im";
import { authByMetamask } from "@relationlabs/auth";

const { error, token: addressAuthToken } = await authByMetamask()

const APIKEY = '581c6c4fa0b54912b00088aa563342a4'

if (!error && addressAuthToken) {
    const { error, token: unifiedAuthToken } = await RelationIM.getRelationToken(addressAuthToken, APIKEY)
    if (!error && unifiedAuthToken) {

    }
}
```

then

instantiate an `im` instance

```javascript
const myIm = RelationIM.init({token: unifiedAuthToken, apiKey: APIKEY, connect: true})
```
