https://github.com/jonamat/react-telegram-chatbox
Chat widget connected to your Telegram account for instant messaging into your React website
https://github.com/jonamat/react-telegram-chatbox
reactjs telegram
Last synced: 5 months ago
JSON representation
Chat widget connected to your Telegram account for instant messaging into your React website
- Host: GitHub
- URL: https://github.com/jonamat/react-telegram-chatbox
- Owner: jonamat
- License: mit
- Created: 2021-01-10T12:05:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-10T22:31:52.000Z (over 5 years ago)
- Last Synced: 2025-10-30T18:46:34.895Z (8 months ago)
- Topics: reactjs, telegram
- Language: TypeScript
- Homepage:
- Size: 177 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-telegram-chatbox
Chat widget connected to your Telegram account for instant messaging into your React websites. It uses [react-chat-widget](https://github.com/Wolox/react-chat-widget) for the UI and [telegram-socket-bot](https://github.com/jonamat/telegram-socket-bot) for the connection to Telegram.
## Install
```cli
npm i react-telegram-chatbox
```
or
```cli
yarn add react-telegram-chatbox
```
## Usage
1. Follow [this link](http://t.me/TgSocketBot) and type `/start` to sign up to **TgSocketBot** from your Telegram account and get your access token.
2. Install & import the library. Remember to include the styles from `react-chat-widget/lib/styles.css`
3. Put your token into the `token` attribute of Chatbox component
```jsx
import { Chatbox } from "react-telegram-chatbox";
import "react-chat-widget/lib/styles.css";
const App = () => {
const token = 'YourAccessToken';
return ;
};
```
4. See and star [telegram-socket-bot](https://github.com/jonamat/telegram-socket-bot) to know how to reply to users, allow hostnames to use your token and for recommendations about security and usage.
## API
| Attribute | type | default | description |
| -------------------- | ------------- | ---------------------------- | ---------------------------------------------------------- |
| token | `string` | `undefined` | Token generated by TgSocketBot |
| welcomeMessage? | `string` | `undefined` | Send a first message on chatbox creation |
| welcomeMessageDelay? | `number` | `0` | Delay for the welcome message |
| errorMessage? | `string` | `'Cannot connect to server'` | Message to be sent if the connection cannot be established |
| widgetProps? | `WidgetProps` | `undefined` | Props for react-chat-widget |
## Compatibility
It support cjs and es modules. Typescript declarations available. Compatible with React ^16.0.0.
### Dependencies
- react-chat-widget: >=3.0.5
- socket.io-client: >=3.1.2
### Peer dependencies
- react: ^16.0.0
- react-dom: ^16.0.0
## License
MIT @ Jonathan Mataloni