Skip to main content

Listening to Chat Messages

Getting Started

In this section, we will show you how to listening to all last chat messages.

Prerequisites

  1. Busy Hour Account (Sign Up if you don't have one yet)
  2. Create a Busy Hour Project from the Dashboard/Projects
  3. Create a Busy Hour App from from the Dashboard/Apps
  4. Download Busy Hour App config file from from the Dashboard/Apps

Listen to Chat Messages

To start listening to chat messages, you can use the useMessages hooks from @busy-hour/react package. The hook itself take the following properties:

PropertyTypeDescription
isShouldInitbooleanDetermine if you want to start listening or not
chatIdstringThe chat id that you want to listen to
versionnumberThe version of the last message to listen to

Quick Example

src/main.tsx
import React from 'react';
import { useMessages } from '@busy-hour/react';

export default function Main() {
const messages = useMessages({
// Start the listening process
isShouldInit: true,
chatId: 'your-chat-id',
// Only listen to version 1 messages
version: 1,
});

// ...rest of your code
}