chatengine-io / react-chat-engine

React component for a cheap and easy chat API
137 stars 35 forks source link

react-chat-engine

Chat Engine

Chat Engine is a free serverless chat API.

Try our free plan at chatengine.io

Installation

Quick Start

Add serverless chat to your React app in 3 minutes.

  1. Register then create a project and user at chatengine.io

  2. Collect the public key, username and user password

  3. Install yarn add react-chat-engine

  4. Import the ChatEngine component and pass in publicKey, userName, and userSecret props

  5. Voila! You're done

EXAMPLE: Your implementation should look like the following

import React from 'react'

import { ChatEngine } from 'react-chat-engine'

export function App() {
  return (
    <ChatEngine
      publicKey={'b75e5bd5-cd84-404c-b820-06feff8c98c0'}
      userName={'john_smith'}
      userSecret={'secret_1234'}
    />
  )
}

Features

Props

Functions

import { functionName } from 'react-chat-engine'

...

functionName(conn, args)

Objects

Chat Object

{
    "id": 1,
    "admin": "john_smith",
    "title": "Canada Day Party!",
    "created": "2020-09-05T20:28:22.352373Z",
    "people": [
        {
            "person": "john_smith"
        }
    ]
}

Chat / Person Association

{ person: "john_smith" }

Message Object

{
    "id": 1,
    "sender": "john_smith",
    "text": "Hey let's party!",
    "created": "2020-09-07T13:20:26.936400Z"
}