This website and apps are for sale. Only serious offers will be considered. Contact [email protected]

Bot Libre Forum

Automating your Mobile Presence with a Telegram Bot

durch admin gepostet Apr 27 2016, 16:28

Telegram is an open platform for chat on mobile and other platforms. Telegram lets you chat on your mobile phone or online for free, with no ads, and no SMS charges, with anyone, on any platform. Telegram is one of the top 10 mobile chat platforms with over 100 million users.

Bots lets you automatically respond to messages, or post content. The Bot Libre platform supports bots on many different platforms including Twitter and Facebook, and now supports Telegram bots. Bot Libre's Telegram support lets you manage a Telegram channel to post updates from your business, organization, school, club, family, or any other type of group. Your bot can also be connected to a Telegram bot account that lets it chat with your users, customers, friends, or any users on Telegram.

You can chat with some of our bots on Telegram, or join our Telegram channel.

You can also watch this video on How to create a chatbot for Telegram.

Getting Started

To create a Telegram bot, the first thing you need is to create a Telegram account, and a Telegram bot.

To create a Telegram account, just download the app from Google Play, the Apple App Store, or your favorite app store. You can also sign up online at, https://telegram.org/. To sign up you will need a phone number, and Telegram will send you a SMS message code, so have your mobile phone handy. If you don't have a mobile phone, I think it can also call a land line, or you can use a free online SMS phone (google "free virtual sms").

Creating a Bot on Telegram

Once you have downloaded your client and signed up, you can now create a bot. Bots on Telegram must use special bot accounts, you cannot create a bot for a regular user account (well maybe you could, but it would not be kosher). To create a bot on Telegram you actually have to chat with a Telegram bot.

To create a bot chat with the @BotFather.

Send BotFather the command "/newbot" to create a bot. Give your bot a name, and user id. BotFather will create your bot, and give you an access token. Save this access token, as you will need it later.

Creating a Bot on Bot Libre

Next create a bot on Bot Libre. You can create a bot here, is it free.

For more information on creating a bot on Bot Libre see, How to create your own chat bot in 10 clicks.

Linking you Bot to Telegram

To connect your Bot Libre bot to your Telegram bot, go to your bot's Admin Console. Make sure you login and go to your bot's page first.

In your bot's Admin Console click on the Telegram link.

On your bot's Telegram page paste your Telegram bot's token. If you forgot to save the token, that is ok, just talk with @BotFather. Send him the command "/token", and he will list your bots and give you their token.

Next click "Connect" to connect your bot. If successful, it will auto fill your bot's name, and your webhook URL. (Ensure webhook box is checked)

Your bot can respond to chat messages, or post to a channel. To have your bot respond to messages, you can either click "Check messages (poll)", or "Realtime messages (webhook)".

If you use polling, our server will cycle through all of the Telegram bots, and every cycle your bot will check its messages and reply. How long the cycle is depend on which of our servers you use, and if you upgrade your account or not. See Upgrade.

The other option is realtime messaging using a webhook. Realtime messages will use your user application id. Your application id supports a limited number of API calls per day. You can upgrade your account to get more API calls. See Upgrade.

Note for realtime messaging you need to register your webhook. To do this just click on "Save", then click "Disconnect", then "Connect" again. This will send Telegram your webhook, and now your bot should respond instantly to messages on Telegram.

Channels

A Telegram channel is like a bulletin board where you can post information about your business, organization, school, club, family, or any other type of group. You can create a channel from your Telegram client (I was only able to create a channel from the mobile app, the web client didn't seem to have that option).

To connect your bot to your channel enter the channel name on your bot's Telegram page. Your bot can post to your channel from an RSS feed, or auto post.

An RSS feed is an XML content page of news or articles. Most blogs, forums, and news services support RSS feeds. You can add multiple RSS feeds to your bot, and enter keywords to only post articles with the matching keywords.

Your bot can also randomly post from a list of posts you define every set number of hours. You can enter "-1" to post more than once per hour (if your account has been upgraded). Your auto posts can contain script code in Self or AIML to do funky stuff.

What Next

Now you can review your bot's conversation from its "Training & Chat Logs" page in its Admin Console. You can also add new responses and correct your bots responses. Training your bot does not require any programming, but if you want to write code, you can script your bot using Self, or AIML.

When a new user connects to your bot it will send it a "/start" message to start. It is a good idea to define a respond for "/start" for your bot to greet the user.

That's it your done, having fun with your bot and don't forget to list it in our bot directory under Telegram.

If you encountered any issues, or would like help setting up your bot please email us at [email protected] or upgrade to our Platinum service and we can build your bot for you.


by Harmik posted Dec 19 2016, 4:56

Hi,

Is there some common solutions to issues with Telegram?
I've followed the instructions here and still my bot doesn't seem to properly work with it.

I also tried to message Bot Libres own Telegram connected bots bot those don't respond either, which gives the feeling this is not only related to my bot.

 

The log I have for Telegram shows one error that repeat every hour, apparently related to the polling of messages.
The webhook, while showing that it should be registered, doesn't seem to work at all as there is no log entries about new messages when trying to chat with the bot.

Log entries that repeat every hour:

WARNING -- Telegram:400 : {"ok":false,"error_code":400,"description":"Bad Request: chat not found"}
WARNING -- Telegram:java.lang.RuntimeException: 400 : {"ok":false,"error_code":400,"description":"Bad Request: chat not found"}

The log shows that webhook should be ok and connection should be working: Telegram:Connecting to Telegram
Telegram:Registering webhook - https://www.botlibre.com/rest/api/telegram/******** (removed for this post)
Telegram:Webhook registered - https://www.botlibre.com/rest/api/telegram/******** (removed for this post)
Telegram:Connected to Telegram
Any ideas what to do to get this solved?

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 4367, today: 0, week: 2, month: 2

by admin posted Dec 19 2016, 7:17
Very odd.

I tested your bot from Telegram and it worked fine, you can check your bot's conversation log to see.

I also tested all of our bots from several different accounts and they worked fine.

How did you start the conversation with the bot?
Did you connect to it and get the "Start" button and click it?
Or did you just send a message to the bot?

My guess is that Telegram might require you /start a conversation with a bot.

What Telegram client are you testing with?
Is your account a confirmed account with a cell number?
What location/country is your cell from?

Make sure you only enable one of polling and real-time messaging, not both. Normally real-time would be used.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3627, today: 0, week: 2, month: 2

by Harmik posted Dec 19 2016, 7:48

Hi,

 

Thanks for the quick help.
I just noticed the new log from your chat with the bot, if it's working for you through Telegram then it definitely should work for me as well. I suppose the issue is not with Telegram application itself as I'm using both Android (newest version) and Mac OS X ( Version 2.29.51395 ) but something might have gone wrong while starting this and now the bot doesn't seem to work for the chat I have with it.
My account is confirmed, based on phone number. Number is from Finland.

I connected to the bot both from the website link (shown on bot settings page after it's connected to Telegram) and through the BotFather bot by clicking the bot name.

In both cases I first had to click "start" and when coming back after disconnecting and stopping it's asking to click "Restart Bot". I can normally send messages, they go through (two checkmarks in Telegram chat) but no replies ever come. Same happens with the Bot Libre bot, all seems to go through but no answers come. I have tried to close and stop it, open it again and start again multiple times.

I tried also typing /start, start, accept, /accept, help etc.. commands to the chat directly.

Now the real-time messaging has been on, polling was on before (together with the real time messaging) but not since around 6 hours when I left only real-time messaging

 

Meanwhile, I did try the both with Slack and it worked right away without any issues and is pretty cool :)

 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3601, today: 0, week: 2, month: 3

by Harmik posted Dec 19 2016, 7:53

I just tried and opened https://telegram.me/brainchatbot

Also with it, same issue. Nothing seems to come back from the chat.

But other bots I try seem to work just nicely, for example https://telegram.me/charlotteaibot

 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3687, today: 1, week: 4, month: 5

by admin posted Dec 19 2016, 10:12
I checked our logs, and think I may have found the issue.

Does your Telegram account have a "last name" set?
Can you try setting your last name in your account.

We will update our server with a fix for this issue this week.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3525, today: 0, week: 4, month: 5

by Harmik posted Dec 19 2016, 13:51

Hey,

Thank you, that was causing the error. I added a last name and everything works now :)

Please give some notification after the server code is updated, I think this would affect many others as well.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3505, today: 0, week: 2, month: 3

by admin posted Jan 4 2017, 20:44
The Telegram last_name issue has been fixed.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3422, today: 0, week: 2, month: 3

by Harmik posted Jan 5 2017, 4:00

Thank you :)


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 3446, today: 0, week: 3, month: 3

by dragon82 posted Mar 31 2021, 13:01

hello who can help me to indicate how to create an amazon autopost bot on telegram?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 965, today: 1, week: 2, month: 4

by admin posted Apr 1 2021, 10:28
To create a Telegram bot see,
https://www.botlibre.com/forum-post?id=12635785

For having the post post to Amazon your would need an XML or JSON web API from Amazon that you can call from a Self script in your bot.

Here are some examples of Self scripts using a web API,
https://www.botlibre.com/script?tag-filter=web+service

If you would like us to develop a bot or script for you contact [email protected]

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 970, today: 3, week: 5, month: 7

Id: 12635785
Tags: how to, mobile, telegram, social media
Gepostet: Apr 27 2016, 16:28
Aktualisiert: Nov 11 2021, 15:17
Antworten: 10
Ansichten: 18235, heute: 2, Woche: 8, Monat: 9
1 0 5.0/5