# Overview

Teams of all sizes trust the Robin API for building in-app messaging without the headache of implementing complex features at scale.

<figure><img src="/files/AiNHBvFlHyaHN1wnzJLv" alt=""><figcaption></figcaption></figure>

Welcome to The Robin Developer Documentation. You will learn how Robin is powering interactions across various use cases regardless of what you are building. This documentation would also give direction on how to build in-app live chat experiences easily using the Robin API and SDKs.

Explore our documentation to integrate Robin easily into your apps.

## Get Started

### Messaging

Send messages instantly in your application with the help of Robin’s API. Robin also provides SDKs and UI Kits that you can quickly plug into your Web and Mobile applications.

### Notifications

Use Robin to deliver your product's announcements, billing, workflow, and other notifications. 100% customizable to suit your tech infrastructure.

### Activity Feeds

Robin helps you rapidly build and deploy scalable Activity feeds using machine learning to optimize the customer experience in your feeds.

### Real-time Collaboration

Unlock a new way of getting things done. Build real-time collaboration into your product and tackle any possible use case with Robin APIs.

## Looking for API Reference?

If you want to take another approach to using Robin within your application without the help of the SDKs, you can integrate the Robin API directly into your application. Robin provides you with various APIs you can utilize. For more information about them, please visit the [API Reference](/api-reference)

## Robin Use Cases

### See What Users are Building with Robin

We put together a list of cool stuff built by the Robin community — they are using Robin to power interactions on their application. Check them out in [Samples and Resources](/samples-and-resources)

## Robin Language/Framework Support

Robin was built with developers in mind, allowing support on a variety of languages and frameworks which you can use. The Robin team understands builders gotta do what they gotta do, and that is to build! For that reason, we offer a variety of support using Robin with different tooling.

These are the libraries built and managed by the Robin team:

* Robin Javascript
* Robin Go
* Robin Python
* Robin Vue
* Robin React
* Robin Flutter

More coming soon. 🤫


# Fundamentals

The building blocks of your Robin Integration.

## Learn Robin Fundamentals

Robin provides developers with numerous APIs and SDKs across different programming languages and frameworks — each with a different setup, although many of these APIs have a few similar prerequisites before they can be fully set up and integrated.

We call these prerequisites the fundamental parts of Robin as they are the building blocks of any Robin Integration.

### Robin Account and Dashboard

There are no integrations without a Robin Account; an account allows access to the Dashboard. The Robin Dashboard is a control centre for all of Robin’s services; you can access your API keys and secret keys, among others. If you do not yet have an API key, you can start by [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account)

{% hint style="info" %}
An API key is a unique string used to recognize requests to your Robin App when you integrate the Robin API.
{% endhint %}

### Robin App

At the heart of every Robin API Integration is a Robin App; it is the smallest unit that contains all components to function independently and power interactions. Every user is prompted to create a Robin App upon creating a Robin account.

{% hint style="info" %}
For more on the Robin App, see [How does Robin Messaging work?](/messaging-with-robin/guides/how-does-robin-messaging-work)
{% endhint %}

### Robin User Token (RUT)

A critical component of every messaging infrastructure is a sender and a recipient. Whether it is a direct conversation (one-on-one) or a group conversation, users always need to send messages to one another; Robin uses the RUT to identify these users.

{% hint style="info" %}
See \[[What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)]\(<https://www.notion.so/What-is-the-Robin-User-Token-RUT-c832f212eb864f2da21a75c12e8df021>) to understand how the RUTs work.
{% endhint %}

### Robin Keys

Robin keys are different from API Keys. While **RUTs** help Robin to identify every user in a Robin App, Robin Keys are used to extract other fields that are mapped to users in your Robin App. Some of these fields are `userName` and `profileImage`.

{% hint style="info" %}
Still not getting it? Check out [The What and Why: Robin Keys](/messaging-with-robin/guides/the-what-and-why-robin-keys) to fully grasp the concept of Robin Keys.
{% endhint %}

### Channels <a href="#channels" id="channels"></a>

All messages and [Robin Messaging Events](/robin-messaging-events) sent via Robin are sent through channels. Channels can be considered as tunnels that relay and retrieve messages to all connected clients. For more on how Robin uses channels, see [How does Robin Messaging work?](/messaging-with-robin/guides/how-does-robin-messaging-work)

With knowledge of the fundamentals above, you are ready to integrate the Robin API and SDKs in any product of your choice with no hitches.


# Messaging with Robin

Robin lets developers and users quickly plug an instant messaging solution into their applications. You can connect team members on a single platform by leveraging Robin and building efficient collaborations. You can also keep users hooked on your application by allowing them to create realistic experiences through our engaging live chat features.

Robin offers features like message reactions, replies, groups, and much more. Allowing you to create engaging interactions for your users in your application, and with just a few lines of code, you can quickly plug in any of Robin’s SDKs and UI kits in your application.

{% hint style="info" %}
How does Robin Messaging work? [See how](/messaging-with-robin/guides/how-does-robin-messaging-work)
{% endhint %}

### UI kits

* React
* Vue
* Flutter
* React Native (Coming Soon!)

### Core SDKs

* Go
* Javascript
* Python

### Fundamental Attributes and Props for Robin Messaging On The Core SDKs

| Attribute       | Type      | Default | Description                                             |
| --------------- | --------- | ------- | ------------------------------------------------------- |
| conn            | WebSocket | null    | WebSocket object returned after calling robin.connect() |
| sender\_name    | String    | “”      | Name of the person sending the message                  |
| sender\_token   | String    | “”      | RUT of the person sending the message                   |
| receiver\_name  | String    | “”      | Name of the person receiving the message                |
| receiver\_token | String    | “”      | RUT of the person receiving the message                 |
| msg             | Object    | {}      | JSON serializable object containing the message         |


# Guides

Your guide to integrating any Conversations and Messaging use case with Robin.

{% content-ref url="/pages/L3JxCL4MUHkwn3Gt9oJm" %}
[How does Robin Messaging work?](/messaging-with-robin/guides/how-does-robin-messaging-work)
{% endcontent-ref %}

{% content-ref url="/pages/173PC5QokNNZVyVF9AZe" %}
[Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account)
{% endcontent-ref %}

{% content-ref url="/pages/6hB4snrvaOTxP62TZ0OQ" %}
[Integrating Robin in your Nuxt.js app](/messaging-with-robin/guides/integrating-robin-in-your-nuxt.js-app)
{% endcontent-ref %}

{% content-ref url="/pages/8NAFy5EfE0wAlfj3ngMD" %}
[Adding Users to your Robin App](/messaging-with-robin/guides/adding-users-to-your-robin-app)
{% endcontent-ref %}

{% content-ref url="/pages/Dgq9cnRq2QdU2jedfv5W" %}
[What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)
{% endcontent-ref %}

{% content-ref url="/pages/2GVUPx7953FPXxtMt5zc" %}
[The What and Why: Robin Keys](/messaging-with-robin/guides/the-what-and-why-robin-keys)
{% endcontent-ref %}

{% content-ref url="/pages/cBDoD9WDqQ4qSKnoJZ6u" %}
[Customizing Robin for your Brand](/messaging-with-robin/guides/customizing-robin-for-your-brand)
{% endcontent-ref %}


# How does Robin Messaging work?

### How Robin for Messaging Works

Robin for Messaging leverages the good old WebSocket Communication Protocol — Robin acts as an extra layer to ensure persistent and reliable connections across communication channels.

<figure><img src="/files/An4yQC3JJMop39OYtV7W" alt=""><figcaption><p>Diagram illustrating how Robin for Messaging works</p></figcaption></figure>

For every **Robin App** created, the API Key for that app grants you access to the Robin connection, the WebSocket connection. When this connection is opened, Robin sends messages and [events](/robin-messaging-events) that are triggered by the activity of other users of your Robin App (users that have integrated Robin with your API key). However, this depends on the channel the said users subscribe to.

[Channels](/fundamentals#channels) on Robin are characterized by each Robin App, and they are built to ensure that messages are locked in, not leaked, and not susceptible to message interception by other developers or users in the same Robin App.

{% hint style="info" %}
Channels can be considered as tunnels that relay and retrieve messages to all connected clients.
{% endhint %}

Robin also supports modern messaging features — like message reactions, voice recording, online presence, and group and direct conversations from an API level to SDK/UI Kits level.

### The Robin App <a href="#the-robin-app" id="the-robin-app"></a>

At the heart of every Robin API Integration is a Robin App; it is the smallest unit that contains all components to function independently and power interactions. Upon creating a Robin account, every user is prompted to create a Robin App. A Robin App is the parent channel of every interaction by all users subscribed to it using the API Key.

{% hint style="info" %}
Check out [Robin Fundamentals](/fundamentals), for a brief description of the necessary components that make up every Robin Integration.
{% endhint %}


# Setting up your Robin account

### Create a Robin Account

To create a Robin account, visit the [signup](https://dashboard.robinapp.co/signup) page.

### Create a Robin App

After filling out your information and creating your account, you’ll be prompted to create a Robin app. This prompt also requires you to select one of two authentication types — **Fully Authenticated** and **Moderated**.

A fully authenticated Robin App has end-to-end encryption. This means that neither Robin nor you — except it’s a conversation you’re involved in — will be able to see the conversations that take place on the app.

On the contrary, a moderated Robin account also encrypts conversations. However, as the owner of the Robin app, you’ll be able to see every conversation.

### API Keys

Each Robin app has a unique API key, which Robin uses to identify an app. You can find it on either the [get started](https://dashboard.robinapp.co/getstarted) or [api config page](https://dashboard.robinapp.co/apiconfig) on your Robin dashboard.


# Integrating Robin in your Nuxt.js app

Because Nuxt is built on Vue, the integration process is kind of similar to [the Vue integration](/messaging-with-robin/sdks-for-ui-kit/robin-with-vue). However, due to Nuxt’s Server-Side Rendering (SSR) feature, there are a few extra things we need to take note of.

### Prerequisites

To integrate Robin in your Nuxt app, there are a couple of requirements you need to get ready:

* API Key - The unique key for your Robin App. Visit [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account) to learn more.
* User token ([RUT](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)) and name - These are what Robin uses to identify you as a user of a Robin app.
* Users - The users you want available on your app (i.e all the users you might want to have conversations with).

When you have these ready, you can go ahead with the integration.

### Install Vue SDK

```bash
npm install robin-vue

## OR

yarn add robin-vue
```

### Setup the Robin Plugin

In your `plugins` directory, create a `robin.js` file with the plugin setup:

```jsx
import Vue from 'vue'
import RobinChat from 'robin-vue'
import 'robin-vue/dist/style.css'

Vue.use(RobinChat)
```

{% hint style="info" %}
You need to import the CSS because the `RobinChat` component does not include any CSS itself.
{% endhint %}

### Register the Robin Plugin

If you do not specify the Robin plugin as a plugin in your `nuxt.config.js` file, it won’t be available in your Nuxt app.

```jsx
export default {
  // ...
  plugins: [
    { src: '~/plugins/robin.js', mode: 'client' }
  ]
}
```

### Use the Plugin

This is where you use the Robin UI Kit in your Nuxt app. Here, you’ll make use of those prerequisites we discussed earlier.

```jsx
<template>
  <!-- ... -->
  <RobinChat
    :api-key="apiKey"
    :user-token="userToken"
    :user-name="userName"
    :keys="keys"
    :users="users"
  />
</template>

<script>
export default {
  data () {
    return {
      apiKey: 'YOUR_API_KEY',
      userToken: 'YOUR_RUT',
      userName: 'YOUR_NAME',
      keys: {
        userToken: 'user_token',
        profileImage: 'profile_image',
        userName: 'user_name'
      },
      users: [
	{
          user_token: '',
          profile_image: '',
          user_name: ''
        },
        {
          user_token: '',
          profile_image: '',
          user_name: ''
        }
      ]
    }
  }
}
</script>
```

### Robin Keys

One of the props passed to the `RobinChat` component above is the `keys` prop. This prop was not included as one of the prerequisites because it is optional. However, it is something you should take note of. See [The What and Why: Robin Keys](/messaging-with-robin/guides/the-what-and-why-robin-keys) to completely understand it.


# Adding Users to your Robin App

Adding users to Robin is quite simple. Create a [Robin User Token](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) (RUT) for each user you want to converse with on Robin. Robin identifies users on the platform by their [RUT](/messaging-with-robin/guides/what-is-the-robin-user-token-rut). Fetch those users, then insert them into your Robin app.

{% hint style="info" %}
[What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)
{% endhint %}

For example, your data for a particular user could look like the below.

```jsx
{
  _id: '18daa0fb59324098b4964996d7739e85',
  first_name: 'John',
  last_name: 'Doe',
  username: 'JohnDoe'
  user_token: 'BLAaUGurGvTewxIGKKrVANhn' // Robin User Token
}
```

### User Privacy and Data Security

You may be concerned about the Robin team or anyone else, for that matter having access to your messages. To negate that, Robin ensures all data sent are secured and fully encrypted. Thereby giving you complete data ownership over your conversations on Robin.

Depending on the security options selected while [creating your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account), your conversations within Robin can either be **Moderated** or **Fully Authenticated**.

A fully authenticated Robin App has end-to-end encryption. What this means is neither Robin nor you — except it’s a conversation you’re involved in — will be able to see the conversations that take place on the app.

On the contrary, a moderated Robin account also encrypts conversations. However, as the owner of the Robin app, you’ll be able to see every conversation.


# What is the Robin User Token (RUT)?

Just like in your company’s database, every employee has a unique identifier; in many cases, this identifier is referred to as an ID — the same logic is applied to Robin but with a different name. The **Robin User Token (RUT)** is used to identify every user that dispatches or receives messages and events in your [Robin App](/messaging-with-robin/guides/how-does-robin-messaging-work#the-robin-app).

### When to use a RUT

The Robin User Token must be used for any messaging operation on Robin, as it is a means of identification for any user. Sending messages with an invalid token or without a token would result in a “No Identity” record of your [Robin Dashboard](/fundamentals#robin-account-and-dashboard). The RUT also helps with the visibility of individual and group messaging activities.

{% hint style="warning" %}
The RUT is a necessary prerequisite to building any Robin use case; any application of Robin might not function to its full potential without a valid RUT.
{% endhint %}

### Creating a valid RUT

Recall that a RUT is synonymous with an ID field in a database; hence, the RUT is mapped to metadata for a unique user; this metadata is used to create the RUT. The metadata is a key-value pair (an object) that can contain as much information about a user.

Creating a valid RUT is easy; it can be done on the server (back-end) or on the client side (front-end).

{% hint style="info" %}
We advise that **RUTs** are created for each user on the server upon successful registration.
{% endhint %}

### Javascript

```jsx
const robin = new Robin('YOUR_API_KEY', true)

const response = await robin.**createUserToken**({
  meta_data: {
    username: 'USER_NAME',
  },
});
```

### Go

```go
robin := Robin{ Secret: "YOUR_API_KEY", Tls: true,}

token, err := robin.**CreateUserToken**(
	UserToken{
		MetaData: map[string]interface{}{
			"name": "USER_NAME",
		}
	}
)
```

### Dart

```dart
Map<String, dynamic> metadata = {
	"name": "USER_NAME"
};

final String robinToken = await RobinCore.**createUserToken**("YOUR_API_KEY", metaData);
```

### Python

```python
robin = Robin("YOUR_API_KEY", True)

response = robin.**create_user_token**(data={
    "meta_data":{
        "name": "USER_NAME",
    }
})
```

To install Robin packages and libraries referenced in the code snippets above, check out [Samples and Resources](/samples-and-resources)


# The What and Why: Robin Keys

The idea of Robin Keys is to provide flexibility and make for a better developer experience while naming fields for your User model.

Fundamentally, the `keys` object consists of the three unique fields we currently have for each user — `userToken`, `profileImage`, and `userName`. The values of those fields should be strings you would rather refer to them as.

**Here's an example:**

```jsx
keys: {
    userToken: 'user_token',
    profileImage: 'profile_image',
    userName: 'user_name'
},
```

This way, you can refer to a user’s user token as `user_token`, profile image as `profile_image`, and username as `user_name`.

Interesting, right? You’re welcome!


# Customizing Robin for your Brand

Robin allows you to customize the UI Kits provided to match your application’s theme and branding. You can incorporate numerous design choices to make Robin feel like yours.


# SDKs for UI Kit

Robin empowers you to disrupt your market even faster by providing a customizable User Interface with a full-on chat experience — with our Web and Mobile SDKs; you can target users from a desktop computer or users that prefer messaging on the go.

Under the hood, the UI Kits are integrated with the [Robin Core SDKs](/messaging-with-robin/add-messaging-with-core-sdks), which enables this pre-built UI to support all of Robin’s core features.

The SDKs for UI Kit are available in:

### Flutter SDK - Mobile

Add chat functionality to your flutter app, and customize Robin UI to match your app’s theme.

[**Start Building**](/messaging-with-robin/sdks-for-ui-kit/robin-with-flutter)

### Vue SDK - Web

Add chat functionality to your Vue app — whether you are building for mobile-first or desktop users, customize Robin UI to match your app’s theme.

[**Start Building**](/messaging-with-robin/sdks-for-ui-kit/robin-with-vue)

### React SDK - Web

Add chat functionality to your React app — whether you are building for mobile-first or desktop users, customize Robin UI to match your app’s theme.

[**Start Building**](/messaging-with-robin/sdks-for-ui-kit/robin-with-react)

### React Native SDK - Mobile (Coming Soon)

Add chat functionality to your React Native app, and customize Robin UI to match your app’s theme. Coming Soon.

<mark style="color:blue;">**Ping Me on Release**</mark>


# Robin with Vue

### Add Messaging to Your Vue App

Add chat functionality to your Vue app — whether you are building for mobile-first or desktop users, customize Robin UI to match your app’s theme. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin-vue>" %}

{% hint style="info" %}
Do you build frontend apps with React? Check out [Robin with React](/messaging-with-robin/sdks-for-ui-kit/robin-with-react) instead.
{% endhint %}

### Prerequisites

The following are required to get your chat app up and running:

1. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account#api-keys)
2. Current user’s [RUT](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) and Name - Robin User Token is a Unique Identifier of every user in your Robin App.
3. All users to be included in your chat app.

### Install the Vue SDK

{% tabs %}
{% tab title="NPM" %}

```bash
npm install robin-vue --save
```

{% endtab %}

{% tab title="Yarn" %}

```bash
yarn add robin-vue
```

{% endtab %}
{% endtabs %}

### Mount Robin and Start Messaging

You can set up Robin quickly by registering the plugin in your Javascript entry file and mounting the `RobinChat` component in your Vue template with its required props.

#### Register Plugin

```jsx
// main.js 

import Vue from 'vue'
import RobinChat from 'robin-vue'
import 'robin-vue/dist/style.css'

Vue.use(RobinChat)
```

#### Mount Component

```jsx
// App.vue

<template>
    <RobinChat 
        api-key="YOUR_API_KEY" 
        :users="[]" //YOUR_LIST_OF_USERS 
        user-token="YOUR_ROBIN_USER_TOKEN" 
        user-name="YOUR_USERNANE" />
</template>
```

{% hint style="info" %}
Want to customize Robin to match your app’s theme? Check out [Customizing Robin for your Brand](/messaging-with-robin/guides/customizing-robin-for-your-brand)
{% endhint %}

### Robin Messaging Preview

Here is a live demo of Robin Messaging with Vue.

{% embed url="<https://stackblitz.com/edit/nuxt-starter-wsbhha?file=pages/index.vue>" %}


# Robin with React

Robin React SDK is still in development.

### Add Messaging to Your React App

Add chat functionality to your React app — whether you are building for mobile-first or desktop users, customize Robin UI to match your app’s theme. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% hint style="info" %}
Do you build frontend apps with Vue? Check out [Robin with Vue](/messaging-with-robin/sdks-for-ui-kit/robin-with-vue) instead.
{% endhint %}

### Prerequisites

The following are required to get your chat app up and running:

1. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account#api-keys)
2. Current user’s [RUT](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) and Name - Robin User Token is a Unique Identifier of every user in your Robin App.
3. All users to be included in your chat app.

### Install the React SDK

{% tabs %}
{% tab title="NPM" %}

```bash
npm install robin-react --save
```

{% endtab %}

{% tab title="Yarn" %}

```bash
yarn add robin-react
```

{% endtab %}
{% endtabs %}

### Mount Robin and Start Messaging

You can set up Robin quickly by importing the `RobinChat` component in your Javascript entry file and mounting it with its required props.

```jsx
// App.js 

import { RobinChat } from 'robin-react'

export default function App() {
  return (
    <RobinChat 
      apiKey="YOUR_API_KEY"
      users="YOUR_LIST_OF_USERS"
      userToken="YOUR_ROBIN_USER_TOKEN"
			userName="YOUR_USERNANE" />
  );
}
```

{% hint style="info" %}
Want to customize Robin to match your app’s theme? Check out [Customizing Robin for your Brand](/messaging-with-robin/guides/customizing-robin-for-your-brand)
{% endhint %}


# Robin with Flutter

### Add Messaging to Your Flutter App

Add chat functionality to your Flutter app — customize Robin UI to match your app’s theme. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin_flutter>" %}

### Prerequisites

The following are required to get your chat app up and running:

1. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account#api-keys)
2. Current user’s [RUT](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) and Name - Robin User Token is a Unique Identifier of every user in your Robin App.
3. All users to be included in your chat app.

### Install the Flutter SDK

```bash
flutter pub add robin_flutter
```

### Creating the current user

You need to create a `RobinCurrentUser` instance of the currently logged-in user, mostly for identification. This is specific to the Flutter SDK.

```dart
RobinCurrentUser currentUser = RobinCurrentUser(
  robinToken: 'YOUR_ROBIN_USER_TOKEN',
  fullName: 'YOUR_USERNAME',
);
```

{% hint style="info" %}
For more information about connecting your app users to Robin, see [Adding Users to Your Robin App](/messaging-with-robin/guides/adding-users-to-your-robin-app)
{% endhint %}

### Mount Robin and Start Messaging

You can mount Robin easily in your app by creating an instance of `Robin`.

```dart
import 'package:robin_flutter/robin_flutter.dart';

Robin(
  apiKey: 'YOUR_API_KEY',
  getUsers: [],
  currentUser: currentUser,
  keys: keys,
);
```

{% hint style="info" %}
Want to customize Robin to match your app’s theme, check out [Customizing Robin for your Brand](/messaging-with-robin/guides/customizing-robin-for-your-brand)
{% endhint %}


# Add Messaging with Core SDKs

Robin provides SDKs that power messaging by interfacing with the Core Robin API. These SDKs are typically used in [Robin’s UI Kits](/messaging-with-robin/sdks-for-ui-kit), but you can leverage the SDK’s numerous capabilities by creating your User Interface.

The Core SDKs are available in:

### Javascript Core SDK

Add live messaging to your Javascript-powered applications.

[**Start Building**](/messaging-with-robin/add-messaging-with-core-sdks/javascript)

### Go Core SDK

Add live messaging to your Go-powered applications.

[**Start Building**](/messaging-with-robin/add-messaging-with-core-sdks/go)

### Python Core SDK

Add live messaging to your Python-powered applications.

[**Start Building**](/messaging-with-robin/add-messaging-with-core-sdks/python)


# Javascript

### Robin for Messaging with Javascript

Add live messaging to your Javascript applications with the Core Javascript SDK. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin.io-js>" %}

### Prerequisites

For this integration, you would need an API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account)

### Install the Javascript SDK

{% tabs %}
{% tab title="NPM" %}

```bash
npm install robin.io-js --save
```

{% endtab %}

{% tab title="Yarn" %}

```bash
yarn add robin.io-js
```

{% endtab %}
{% endtabs %}

## Sending your first message

Follow the step-by-step instructions below to send your first message using the Javascript SDK

### Step 1: Create a Robin Instance

To create a `Robin` instance, pass the `apiKey` as the first argument, and the optional `tls` argument as the second in the `Robin(apiKey, tls)` constructor.

```jsx
const robin = new Robin('YOUR_API_KEY', true);
```

{% hint style="warning" %}
Initializing the Chat SDK at the top of your Javascript file is recommended.
{% endhint %}

### Step 2: Connect to Robin Server

You can connect to the Robin server using the `connect(user_token)` method from the `Robin` instance. If you do not have a [Robin User Token](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) (user\_token), you would have to create one. [What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)(specific link to create user token) is a good place to start.

```jsx
robin.connect('YOUR_RUT');
```

{% hint style="info" %}
All messages sent on Robin go through channels, you can learn more about channels on [Robin Fundamentals](/fundamentals)
{% endhint %}

### Step 3: Create a Conversation

Before sending a message, you need to create a `Conversation`

```jsx
const response = await robin.createConversation({
  sender_name: string,
  sender_token: string,
  receiver_token: string,
  receiver_name: string
})
```

### Step 4: Send a message to Conversation

Now, you can send a message to a conversation with the `robin.sendMessageToConversation()` method.

```jsx
robin.sendMessageToConversation(msg: object, conn: WebSocket, channel:string,conversation_id: string, senderToken?: string);
```

### Browser Compatibility

This SDK is supported on the following browser versions.

| Browser           | Supported Versions     |
| ----------------- | ---------------------- |
| Internet Explorer | 10 or higher           |
| Edge              | 13 or higher           |
| Chrome            | 16 or higher           |
| Firefox           | 11 or higher           |
| Safari            | 7 or higher            |
| Opera             | 12.1 or higher         |
| iOS Safari        | 7 or higher            |
| Android Browser   | 4.4 (Kitkat) or higher |


# Go

### Robin for Messaging with Go

Add live messaging to your Go applications with the Core Go SDK. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin.io-go>" %}

### Prerequisites

The following are required to use the SDK:

1. Go 1.1.6 or greater is required
2. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account)

### Install the Go SDK

```bash
go get robin.io-go
```

## Sending your first message

Follow the step-by-step instructions below to send your first message using the Go SDK

### Step 1: Create a Robin Instance

To create a `Robin` instance, pass the `Secret` as the first argument, and the optional `Tls` argument as the second in the `Robin(Secret, Tls)` constructor.

```go
robin := Robin{
    Secret: "YOUR_API_KEY",
    Tls:    true,
}
```

{% hint style="warning" %}
Initializing the Chat SDK at the top of your Go file is recommended.
{% endhint %}

### Step 2: Connect to Robin Server

You can connect to the Robin server using the `Connect(user_token)` method from the `Robin` instance. If you do not have a [Robin User Token](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) (user\_token), you would have to create one. [What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)(specific link to create user token) is a good place to start.

```go
// call back for a successful connection
func connected(socket gowebsocket.Socket) {}

// call back for an unsuccessful connection
func disconnected(err error, socket gowebsocket.Socket) {}

// call back for when a message is recieved via the connection
func text_recieved(msg string, socket gowebsocket.Socket) {}

conn, err := robin.Connect(connected, nil, disconnected, text_recieved, nil, nil, nil)

if err != nil {
    println(err)
}
```

{% hint style="info" %}
All messages sent on Robin go through channels, you can learn more about channels on [Robin Fundamentals](/fundamentals)
{% endhint %}

### Step 3: Create a Conversation

Before sending a message, you need to create a `Conversation`

```go
conv, err := robin.CreateConversation("SENDER_NAME", "SENDER_TOKEN", "RECEIVER_TOKEN", "RECEIVER_NAME")

if err != nil {
    fmt.Println(err)
}
```

### Step 4: Send a message to Conversation

Now, you can send a message to a conversation with the `robin.SendMessage()` method.

```go
err := robin.SendMessage("CHANNEL_NAME", map[string]interface{} {
    "name":"SENDER_NAME",
    "user_token":"SENDER_TOKEN",
    "msg":"MSG CONTENT",
})
```


# Python

### Robin for Messaging with Python

Add live messaging to your Python applications with the Core Python SDK. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin.io-py>" %}

### Prerequisites

The following python packages are required to use the SDK:

1. [Requests](https://pypi.org/project/requests/)
2. [Websocket-client](https://pypi.org/project/websocket-client/)
3. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account)

### Install the Python SDK

```bash
## pip
pip3 install robin.io-py
```

## Sending your first message

Follow the step-by-step instructions below to send your first message using the Python SDK

### Step 1: Create a Robin Instance

To create a `Robin` instance, pass the `apiKey` as the first argument, and the optional `tls` argument as the second in the `Robin(apiKey, tls)` constructor.

```python
robin = Robin("YOUR_API_KEY", True)
```

{% hint style="warning" %}
Initializing the Chat SDK at the top of your Python file is recommended.
{% endhint %}

### Step 2: Connect to Robin Server

You can connect to the Robin server using the `connect(user_token)` method from the `Robin` instance. If you do not have a [Robin User Token](/messaging-with-robin/guides/what-is-the-robin-user-token-rut) (user\_token), you would have to create one. [What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut)(specific link to create user token) is a good place to start.

```python
robin.connect(user_token="YOUR_RUT")****
```

### Step 3: Create a Conversation

Before sending a message, you need to create a `Conversation`

```python
response = robin.create_conversation(sender_token="SENDER_RUT", sender_name="SENDER_NAME", receiver_token="RECEIVER_RUT", receiver_name="RECEIVER_NAME")
```

### Step 4: Send a message to Conversation

Now, you can send a message to a conversation with the `robin.send_conversation_message()` method.

```python
robin.send_conversation_message(msg={}, channel="CHANNEL_ID", conversation_id="CONVERSATION_ID", sender_token="SENDER_TOKEN")
```


# API Reference

This API reference documentation provides comprehensive information for each of the functions, classes and other programming constructs in the Robin SDK.

### Messaging with Robin

Robin's Messaging SDK allows you to leverage Robin on both the client and server-side within any application and make requests to the Robin APIs.

{% embed url="<https://robin-io-js-doc-csgdc.ondigitalocean.app/classes/Robin.html>" %}
Digital Ocean documentation for Robin JS SDK
{% endembed %}


# Robin Messaging Events

Robin Messaging sends events and messages through channels powered by the Robin API, this reference documents Robin Messaging Events that can be transmitted in a channel and what these events signify.

{% hint style="info" %}
See [How does Robin Messaging work?](/messaging-with-robin/guides/how-does-robin-messaging-work) for more information
{% endhint %}

### user.connect

This event is triggered when a new user connects to a similar Robin app as the currently logged-in user.

### user.disconnect

This event is triggered when a previously logged-in user disconnects from a similar app as the currently logged-in user.

### new\.conversation

This event is triggered when a new group or one-on-one conversation is created.

### read.reciept

This event is triggered when a participant in a conversation views a message.

### group.icon.update

This event is triggered when a group's 'icon is added, modified or removed.

### new\.group.moderator

This event is triggered when a new moderator or admin is assigned to a group conversation.

### new\.conversation.participant

This event is triggered when a moderator adds a new participant to a group conversation.

### remove.group.participant

This event is triggered when a moderator removes a participant from a group conversation.

### delete.message

This event is triggered when a message is deleted by any participant in a group or one-on-one conversation.

### message.forward

This event is triggered when a message is forwarded from one conversation to another.

### message.reaction

This event is triggered when a reaction is added to a message.

### message.remove.reaction

This event is triggered when a reaction is removed from a message.

### link.metadata

This event is triggered when a link attachment is sent in a conversation.


# Samples and Resources

You can check out resources and examples or gain inspiration that could help you integrate Robin in your application.

### Articles created by the Robin Community

{% embed url="<https://www.freecodecamp.org/news/create-a-real-time-chat-application-with-nuxt/>" %}

{% embed url="<https://dev.to/ecj222/how-to-build-a-live-chat-in-your-web-application-using-robin-part-1-2m4f>" %}

### Demo projects

{% embed url="<https://github.com/idorenyinudoh/nuxt-chat-app>" %}

{% embed url="<https://github.com/ECJ222/cryptodegen>" %}

{% embed url="<https://github.com/felixfavour/robin-vue-test>" %}


