> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/relation-one-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/relation-one-api/guide/quick-start.md).

# Quick Start

### Environment

To complete this tutorial successfully, you must have [Node.js](https://nodejs.org/en/) installed on your machine.

### ApiKey

The ApiKey is used to authenticate the application making the request. The following ApiKey sample is for testing purpose only(NOT for production environment): 581c6c4fa0b54912b00088aa563342a4 . If you need to use an ApiKey for production, please refer to this form: [Relation API Access Request](https://docs.google.com/forms/d/1B38ferfackqnLuPUlWr5Pc2bvrK8C1M3TI5wwiw4Kxo)。

The following demo will introduce how to integrate Relation One.

### Demo

Repository: <https://github.com/relationlabs/relation-im-demo>

Live Demo: <https://app.relationlabs.ai/demo/im/>

Guide:

{% embed url="<https://youtu.be/zKw6ii9PfAw>" %}

run locally：

```shell
git clone https://github.com/relationlabs/relation-im-demo.git
cd relation-im-demo
npm install
npm run dev
```

### Features

#### Acquire addressAuthToken

```js
import { authByMetamask } from '@relationlabs/auth';

const { authResult } = await authByMetamask();
```

#### Acquire unifiedAuthToken

```js
const { token, error } = await RelationIM.getRelationToken(
  authResult.token,
  APIKEY
)
```

#### UserInfo

```js
const userInfoRes = await im.getUserInfo()
```

#### Following

```js
const res = await im.getFollowing({
  address: relationId,
  limit,
  cursor
})
```

#### Follow/Unfollow

```js
const res = await im.follow(relationId)
const res = await im.unfollow(relationId)
```

#### Init IM Instance

```js
const im = RelationIM.init({ token, apiKey: APIKEY, connect: true })
```

#### Channel List

```js
const res = await im.userChannelsList({
  cursor,
  limit
})
```

#### Receive Message

```js
im.bind(Im.RECEIVE_MSG_OK,(event) => {...})
```

#### Messages

```js
const res = await im.messageList({
  channelUuid,
  maxCreateAt: new Date().getTime(),
  limit
})
```

#### Send Message

```js
const res = await im.sendMessage({
  channelUuid,
  content
})
```

#### Want to deep dive?

Dive a little deeper and start exploring our API reference to get an idea of everything that's possible with the API:

{% content-ref url="/pages/HrSpMSb0OTJlsIwLva0N" %}
[Introduction](/relation-one-api/api/introduction.md)
{% endcontent-ref %}
