This extension allows for direct support of Telegram bots in Live Helper Chat. It supports sound messages, images, and files.
- Minimum version required: Live Helper Chat 4.27v.
- Webhooks has to be enabled - https://github.com/LiveHelperChat/livehelperchat/blob/master/lhc_web/settings/settings.ini.default.php#L86
- Run the command
php cron.php -s site_admin -e lhctelegram -c cron/update_structure
- Navigate to the Telegram options and activate the configuration.
- By default, HTML markdown is used for messages.
- You can enable debug mode by unchecking the
Skip
option for theTelegramIntegration
bot. - If you don't want HTML or Markdown support, you can edit the Rest API call by removing
"parse_mode":"HTML",
and change{{msg_html_nobr}}
to{{msg_url}}
. - In parse mode
"HTML"
not all tags are supported so don't use bbcode which translates to HTML which is not supported by telegram. You can always debug in Rest API enabling debug trigger. So you should have different bot or messages depending whom you are sending message. Telegram client or web widget.
- Clone the GitHub repository.
- Rename the cloned folder to "lhctelegram" and place it in the "extension/" directory.
- Activate the extension by adding
'lhctelegram'
to the'extensions'
array in thelhc_web/settings/settings.ini.php
file.
'extensions' =>
array (
'lhctelegram'
),
- Install the composer requirements by running:
cd extension/lhctelegram && composer.phar update
- Clean the cache in the Live Helper Chat back office.
- Execute the
doc/install.sql
on the database manager or run the command:php cron.php -s site_admin -e lhctelegram -c cron/update_structure
- Register your bot with BotFather: https://core.telegram.org/bots#6-botfather
- In the Telegram options, activate webhook configurations.
- Create a bot in the LHC back office under Modules => Telegram Settings.
- After creating the bot, click "Set webhook".
- That's it! The integration should be set up.
This feature allows you to use the Telegram bot as a gateway between chats on your website and your operators. Here's an example setup:
Example of final setup. Each customer get's it's own topic. and you can use telegram to chat with your customers directly. Files are also supported!
- After you have completed the above steps, you have to do the following changes: In LHC back office, go back to the bot editing page and choose the departments tab. Check the departments you want to receive new chats notifications for but don't save yet.
- Create a group chat in telegram and add your bot as an admin in the group chat.
- Modify group chat settings and enable topics. Each customer will get their own topic.
- Create a dummy topic, send a dummy message, and copy the URL.
- Your link will look like
https://t.me/c/1634340846/3/4
, and your group ID will be the middle number1634340846
with the appended-100
, so it will be like-1001634340846
as a concatenated string of-100
+1634340846
. - In the LHC back office, go to the main
Telegram page
, then toTelegram bots > Edit bot departments
. Copy-paste the Telegram group ID into theGroup Chat ID
field. In the same tab, check theThis bot acts as a client
box. Now save. - Go to the LHC back office main Telegram page and choose
Telegram operators
. Choose Operator and Bot, or create one. - Start a conversation in Telegram and register yourself within the bot by typing
/register <id>
. The<id>
should be the registered operator id from the very first column in the operators list in LHC Modules => Telegram Settings => Telegram operators. - If you get an error message saying it can't find an operator with that ID, and the operator was just created, clean the cache (https://onlinehelpguide.com/delete-telegram-cache-files/) and start a chat as that operator using just the website (not Telegram). Then try registering the again. It should work now.
- That's all. Just type /help to see what available commands are supported.
- If you are planning only to use Telegram to support your site visitors, it makes sense to set up department online hours so the widget will remain always online even if you are not using the default web back office.
- For a chat to be accepted by the first message from Telegram, you have to be in
Visible
status. - You can listen for a
/start
command by defining event listener with keyword/start
. The Same way you can listen to any other command. - Same visitor chats are written to the same topic as long Online Visitor record exists. You can extend it to be valid for one year in
Settings -> Chat configuration -> Online tracking -> How many days keep records of online users.
- Integration supports quick reply buttons. Using these, you can make a quick navigation.
- Telegram API has limit of 20MB per file size limit. Please make sure you set the appropriate limit in lhc files sections.
- You now can set bot option to delete topic on chat close/delete to keep it clean.
Since version 3.36v, you can set your online condition to Always online
, and you won't have to do anything else.
https://livehelperchat.com/how-to-use-telegram-if-you-are-automated-hosting-client-489a.html