> 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://relationlabs.gitbook.io/relation-one-api/guide/quick-start.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
