Listening to Last Message
Getting Started
In this section, we will show you how to listening to all last chat messages.
Prerequisites
- Busy Hour Account (Sign Up if you don't have one yet)
- Create a Busy Hour Project from the Dashboard/Projects
- Create a Busy Hour App from from the Dashboard/Apps
- Download Busy Hour App config file from from the Dashboard/Apps
Listen to Last Message
To start listening to last chat messages, you can use the useLastMessages
hooks from @busy-hour/react
package. The hook itself take the following properties:
Property | Type | Description |
---|---|---|
isShouldInit | boolean | Determine if you want to start listening or not |
version | number | The version of the last message to listen to |
type | private | group (optional) | The type of the last message to listen to |
Quick Example
src/main.tsx
import React from 'react';
import { useLastMessages } from '@busy-hour/react';
export default function Main() {
const chats = useLastMessages({
// Start the listening process
isShouldInit: true,
// Only listen to version 1 messages
version: 1,
});
// ...rest of your code
}