Telegram – Xenioo Thu, 15 Apr 2021 17:00:21 +0000 en-US hourly 1 https://wordpress.org/?v=5.6.12 /wp-content/uploads/2022/02/cropped-badge_611x611-32x32.png Telegram – Xenioo 32 32 Learn How To Create A Telegram Group Chatbot /learn-how-create-telegram-group-chatbot/ /learn-how-create-telegram-group-chatbot/#respond Thu, 14 Feb 2019 14:13:26 +0000 https://wp.xenioo.com/?p=993 In a previous tutorial, we saw how to create and deploy a Telegram chatbot using Xenioo. While we did cover the basics of single and group conversations and the concept of bot privacy, we didn’t go into the depths on how to fully manage a Telegram group chatbot. This time we are going to see exactly this: we will create a very simple chatbot that will act as a group manager and moderator. Telegram Group Chatbot Privacy Mode When building you ...

Read MoreLearn How To Create A Telegram Group Chatbot

The post Learn How To Create A Telegram Group Chatbot appeared first on Xenioo.

]]>
In a previous tutorial, we saw how to create and deploy a Telegram chatbot using Xenioo.
While we did cover the basics of single and group conversations and the concept of bot privacy, we didn’t go into the depths on how to fully manage a Telegram group chatbot.

This time we are going to see exactly this: we will create a very simple chatbot that will act as a group manager and moderator.

Telegram Group Chatbot Privacy Mode

When building you chatbot using the BotFather, you will notice multiple configuration options where you can change the name, the avatar and some other settings.

One of these options is /setprivacy and can be used to turn on or off “Group Privacy”. What is it exactly?

  • With Bot Privacy OFF, your chatbot will receive every message that is sent to the chat by any user. If you have a hundred thousands users in your group, Xenioo will receive all of the messages and process them.
  • With Bot Privacy ON, none of the messages sent by any user will reach Xenioo. Only messages starting with the symbol ‘/’, or direct mentions of your chatbot, will be received.

By default, Bot Privacy is ON and for our example, we will leave it as it is.

As we said, we are going to create a Group Manager and we do not want, for now, to check all users messages.

Reacting to Chat Commands

As explained, with group privacy turned on, we will be receiving only chat messages starting with a ‘/’. A typical use of these commands are /help or /about but you can just handle whatever command you like.

Using Xenioo global bot operations you can handle these commands very easily and make sure that they are always triggered whatever the status of your chatbot.

set up the telegram group chatbot response at chat commands

In our chatbot sample, the /hep command will reply with a very simple bubble proposing two different commands.

Whatever text starts with a ‘/ ‘ symbol inside a Xenioo text will be transformed into a link command inside the Telegram Bubble.

The user can write the command or just click on the command link inside the bubble to invoke your chatbot again.

test how chatbot responses

see the telegram group chatbot answer in preview

Users coming and going. Manage them with your Telegram Group Chatbot

As soon as you add your Xenioo chatbot to a Telegram group you will start receiving events related to every user joining and leaving.

Each event will trigger chatbot populating specific variables you can use in your flow to react and eventually welcome.

Managing variables and messages have been covered in multiple articles so we will be focusing now only on which variables are available to you whenever your chatbot is invoked in a Telegram Group.

VariableValore contenuto
telegram_new_users_countContains the number of new users added. If the value is equal to zero, no user has been added.
telegram_new_user_<num>Contains the full username of one of the users that just entered the group where <num> represents the index number of the user.
telegram_new_user_<num>_typeContains the type of user that just joined the group where <num> represents the index number of the user. The value can be either USER for a normal user or BOT for a bot.
telegram_user_leavingContains the full username of the user that just left the group.
last_userContains the full username of the last user that sent a text or a command in the group chat .

Users can be added massively with a single invite so make sure to always check for the correct number indicated by the telegram_new_user_count variable.

On big groups, it is not uncommon to have tens of users joining altogether. Using Xenioo variable manipulation capabilities you can create a simple loop very easily.

xenioo visual builder

On the other hand, users leaving can be multiple but never massive as removal is immediate and never simultaneous. Variable telegram_user_leaving value is always related to a single user and your flow will be called for each user.

Overseeing users behavior

Another important aspect of managing groups is overseeing users behavior.

If your group runs with specific policy, for example, a chatbot can be a very effective way of enforcing it. Xenioo gives not only the tools to detect user text but also to kick them from the group.

The first thing to do is turn off group privacy on your bot: this will allow Xenioo to receive and process each and every message that goes in the group.

After this, you can easily create an NLP intent containing all of the expressions that you do not want your users to use.

The expressions can vary from simple, even single word entries to more complex sentences covering different topics. The Xenioo NLP engine will automatically train itself and detect also texts that are different but express the same intent.

Once you’re satisfied with your intent, we can link it to our global chatbot operations and attach it to an interaction.

set up npl of your telegram group chatbot

As you can see from the diagram our approach is to give the user up to 3 warnings before taking on final action.

User warning count has its own variable and chatbot will be able to take note of count even after months. You can go ahead and reset counter once in a while using just a broadcast.

Having a high number of users may require a more complex and database oriented approach but for our example, it is going to be just fine.

Your Personal Group Manager

We’ve just seen how building a Telegram Group Manager bot with Xenioo is incredibly easy and flexible.

Want to try it right away? There’s a free template built exactly like this example and ready to be used for your project in your account.

Do you have any special request or requirement for your Telegram group? Let us know in our community group or just drop a line to our team!

The post Learn How To Create A Telegram Group Chatbot appeared first on Xenioo.

]]>
/learn-how-create-telegram-group-chatbot/feed/ 0
Come creare un chatbot per moderare un gruppo Telegram /come-creare-un-chatbot-per-moderare-un-gruppo-telegram/ /come-creare-un-chatbot-per-moderare-un-gruppo-telegram/#respond Thu, 14 Feb 2019 14:13:26 +0000 https://wp.xenioo.com/?p=993 Scopri come utilizzare Xenioo per creare un semplice e versatile chatbot per la gestione e moderazione di un gruppo Telegram. All'interno disponibile anche il template gratuito da riutilizzare nel proprio account Xenioo.

The post Come creare un chatbot per moderare un gruppo Telegram appeared first on Xenioo.

]]>
In un nostro precedente articolo abbiamo visto come creare e pubblicare un chatbot per Telegram usando Xenioo.

Abbiamo spiegato le basi di come gestire una conversazione singola o di gruppo ed i concetti legati alla privacy del bot, ma non siamo entrati nel dettaglio di come poter gestire un gruppo su Telegram attraverso un chatbot.

L’obiettivo di questo articolo è proprio questo: vi mostreremo come creare un semplice chatbot che funzioni come gestore e moderatore di un gruppo Telegram.

Impostare la privacy di un gruppo Telegram

Nella creazione del chatbot attraverso il BotFather, avrai notato come è possibile configurare una serie di opzioni come il nome, l’avatar e molte altre ancora.

Una di queste opzioni è la /setprivacy e può essere impostata per abilitare o disattivare la “Group Privacy“.

Ma cos’e’ la Group Policy di Tegram?

  • con la Group Policy OFF (disabilitata), il chatbot riceverà ogni messaggio inviato dagli utenti. Se il tuo chatbot ha migliaia di utenti nel gruppo, Xenioo riceverà e processerà tutti i messaggi inviati da ciascuno di essi.
  • con la Group Policy ON (attivata), nessun messaggio scritto dagli utenti in chat raggiungerà Xenioo. Gli unici messaggi che verranno ricevuti e processati da Xenioo saranno quelli che iniziano con il carattere ‘/’ oppure menzioni dirette.

Per impostazione predefinita, la Group Policy è impostata ad ON ed è quindi attivata.

Per il momento lasceremo l’impostazione della privacy predefinita, in quanto non ci interessa ricevere tutti i messaggi degli utenti per gestire i comandi nel gruppo. Vedremo successivamente come disattivarla quando dovremo configurare il nostro chatbot per funzionare anche da moderatore del gruppo.

Rispondere ai comandi ricevuti in chat

Come descritto nel paragrafo precedente, con la Group Privacy attivata, il chatbot riceverà solo i messaggi che iniziano con il carattere ‘/’. Chiameremo questi messaggi “comandi”.

L’utilizzo tipico di questi comandi è per richiedere aiuto (/help) oppure informazioni aggiuntive (/about), ma è possibile creare e gestire qualsiasi tipo di comando.

In Xenioo è possibile creare i comandi nella sezione Global Bot Operations del chatbot. Infatti, ogni operazione inserita nella Global Bot Operations viene sempre processata indipendentemente dallo stato del chatbot ed in qualsiasi punto della conversazione utente.

Per impostare il comando è sufficiente inserire (/help) nel campo Control Expression di una operazione Text Parse. Questo tipo di operazione cattura l’input dell’utente e reagisce se il testo corrisponde ad una specifica espressione regolare.

Nel nostro caso ci si aspetta che l’utente scriva esattamente il testo /help ed il chatbot risponderà con un semplice messaggio proponendo quello che sono gli altri comandi disponibili.

Inoltre ogni testo che inizia con il carattere ‘/’ viene trasformato da Telegram in un comando cliccabile. L’utente può quindi attivare il comando sia scrivendolo nella chat, sia cliccando direttamente sul link del comando.

Gestire gli utenti in entrata ed uscita dal gruppo

Nel momento in cui si aggiunge un chatbot ad un gruppo Telegram, Xenioo comincerà a ricevere una serie di eventi relativi agli utenti che si iscrivono oppure lasciano il gruppo.

Ognuno di questi eventi viene intercettato dal chatbot e Xenioo valorizza delle specifiche variabili che possono essere poi utilizzate all’interno del flusso, per esempio per dare il benvenuto agli utenti oppure salutarli nel momeno in cui se ne vanno.

Abbiamo già discusso come utilizzare le variabili per gestire il flusso in articoli precedenti, quindi per ora ci limiteremo a vedere nel dettaglio le variabili che sono disponibili quando il chatbot è collegato ad un gruppo Telegram.

VariableValore contenuto
telegram_new_users_countNumero di nuovi utenti aggiunti al gruppo. Se è uguale a 0, nessun utente è stato aggiunto al gruppo.
telegram_new_user_<num>Nome utente completo dell’ utente aggiunto al gruppo, dove <num> rappresenta l’indice della lista di utenti aggiunti complessiva.
telegram_new_user_<num>_typeTipo di utente che si è appena aggiunto al gruppo, dove <num> rappresenta l’indice della lista di utenti aggiunti complessiva. Il valore può essere USER per un normale utente oppure BOT per un bot.
telegram_user_leavingNome utente completo dell’utente che ha appena lasciato il gruppo.
last_userNome utente completo dell’ultimo utente che ha inviato del testo o un comando nella chat del gruppo.

Qando si gestisce un gruppo Telegram bisogna tener presente che gli utenti possono essere aggiunti massivamente con un singolo invito. Dal momento che il bot viene chiamato quando uno o più utenti sono stati aggiunti al gruppo, diventa quindi necessario verificare correttamente il numero indicato dalla variabile telegram_new_user_count.

Sfruttando la capacità di Xenioo nel manipolare le variabili, è possibile creare facilmente dei blocchi per gestire questa casistica, come è possibile vedere nell’immagine sottostante.

Al contrario, la rimozione di un utente dal gruppo è immediata e quindi mai si verificheranno rimozioni massive di utenti contemporaneamente. La variabile telegram_user_leaving è sempre relativa ad un singolo utente e il bot verrà chiamato una volta per ogni utente che lascia il gruppo.

Moderare il gruppo

Un aspetto importante nella gestione di un gruppo è la supervisione del comportamento degli utenti. Se per esempio il gruppo adotta delle regole specifiche riguardanti il linguaggio non permesso, il chatbot si presta come una soluzione ideale per verificare che queste vengano fatte rispettare.

Xenioo permette non solo di rilevare e processare ogni testo scritto dagli utenti nel gruppo, ma consente al chatbot di rimuovere automaticamente dal gruppo gli utenti che non rispettino per esempio quelle determinate regole.

La prima cosa da fare per sì che il chatbot funzioni da moderatore del gruppo è quella di disabilitare la Group Policy, disattivandola come abbiamo visto nel paragrafo iniziale. Questo permetterà a Xenioo di ricevere tutti i messaggi inviati dagli utenti nel gruppo.

Il passo successivo è quello di creare una serie di intenti NLP contenenti tutte le espressioni che non si vuole vengano utilizzate all’interno del gruppo (parole volgari, argomenti politici, etc…)

Le espressioni possono variare da una semplice sentenza, anche a singola parola, fino ad arrivare a sentenze complesse che coprono diversi argomenti. Il motore NLP di Xenioo sarà in grado di imparare automaticamente da queste espressioni e quindi capace di individuare anche testi che sono differenti ma esprimono lo stesso intento.

Una volta creati gli intenti, possono essere utilizzati all’interno delle Global Bot Operations collegandoli ad una interazione che si occuperà di gestire la risposta del chatbot.

Come è possibile vedere dall’immagine, l’approccio che abbiamo usato nel chatbot di esempio è quello di dare all’utente 3 avvertimenti prima di essere rimosso dal gruppo. Ogni avvertimento viene gestito con una specifica variabile per utente ed il chatbot sarà in grado di ricordarsi del conteggio anche dopo mesi (oppure si potrebbe implementare un meccanismo per il reset del contatore degli avvisi usando un broadcast).

Se il gruppo da gestire contiene un numero molto alto di utenti, potrebbe essere necessario implementare una soluzione un poco più complessa e basata su database, ma per il nostro chatbot di esempio l’approccio scelto è più che sufficiente.

Ricapitolando…

In questo articolo abbiamo visto come creare un chatbot per gestire e moderare un gruppo Telegram con Xenioo sia estremamente semplice e flessibile.

Vorresti provarlo subito? Questo chatbot è disponibile come Template gratuito all’interno di Xenioo, ti basta entrare nel tuo account per poterlo utilizzare.

Hai delle richieste specifiche per il tuo chatbot Telegram? Non esitare a contattare direttamente il nostro team oppure scrivi alla nostra community Facebook!

The post Come creare un chatbot per moderare un gruppo Telegram appeared first on Xenioo.

]]>
/come-creare-un-chatbot-per-moderare-un-gruppo-telegram/feed/ 0
How to make a Telegram chatbot with Xenioo /how-to-make-a-telegram-chatbot-with-xenioo/ /how-to-make-a-telegram-chatbot-with-xenioo/#respond Fri, 18 May 2018 07:50:16 +0000 https://www.xenioo.com/?p=785 In this tutorial we’re going to learn how to set up a Telegram Chatbot using the our chatbot platform. It just takes a few easy steps! Just like Facebook Messenger, Telegram allows you to run chatbots to automate conversational flows with subscribed users. And unlike other platforms, Telegram can even manage conversations between a group of users. And as usual: there are no changes to your bots, and everything is included in all the plans(even the free plan!). Since Xenioo uses a ...

Read MoreHow to make a Telegram chatbot with Xenioo

The post How to make a Telegram chatbot with Xenioo appeared first on Xenioo.

]]>
In this tutorial we’re going to learn how to set up a Telegram Chatbot using the our chatbot platform. It just takes a few easy steps!

Just like Facebook Messenger, Telegram allows you to run chatbots to automate conversational flows with subscribed users. And unlike other platforms, Telegram can even manage conversations between a group of users. And as usual: there are no changes to your bots, and everything is included in all the plans(even the free plan!).

Since Xenioo uses a seamless integration with all the supported platforms ,nothing will change the way you create your chatbotsThe great news is that you can pick any of your existing chatbots, and make them run on Telegram! All you need is a valid Telegram chatbot API key.

How to set up a Telegram chatbot

Telegram uses an interesting approach to bot API key creation. To create a bot, you need to talk to a bot which is appropriately called “The Botfather”.

In order to chat with BotFather, just add him to your Telegram contacts list and start chatting.

After this initial greeting, you will be presented with a list of commands. The first command that we are looking for is, of course: /newbot.

As soon as you send this command, BotFather will ask you for a full display name (the name that other users will see), and a bot user name (an internal name that will mostly just be of interest to you).

The creation is almost immediate: once BotFather has finished, he will present the link to you so you can use it to share to your new bot account with the API key. Copy this key as we will need it later for Xenioo.

how telegram bot works on your channel

To finish off your bot, you can go ahead and specify the avatar picture you would like. This is also done through chat commands: type /setuserpic, and then follow BotFather’s instructions for uploading your bot avatar image.

All the information you give to BotFather is saved and kept throughout the chat session. If you later wish to change your picture, create a new bot, or change the API key, just go back to BotFather, as he will know all about your bots.

How to publish your Telegram chatbot on your channel

Now that Telegram has created your new API key, it is time to make your chatbot live.

As you normally do on Facebook, Slack and Web Site, just click on the publish button to open up the channels configurations. But this time of course, you’re going on Telegram.

set up telegram api for your chatbot

Now go to the Telegram settings dialogue and paste the API key that you’ve been given by BotFather, and save to confirm.

Click on the publish button, and within a second, your chatbot will be online!

If your chatbot is not in your contacts, all you need to do is searching it using the Telegram search. Then start talking to it to see it running.

Much like Facebook’s first contact, Telegram also uses a Get Started button that will initiate a bot conversation: this is all automatically managed by Xenioo.

start to use your bot on telegram

Groups, Text and Privacy

Once your chatbot is online, you can interact with it in exactly the same way you interact with other Xenioo communication channels.

What you write is sent to Xenioo, and the text you send can be used to activate complex commands or dialogues.

An interesting feature of Telegram is the ability to create conversation groups in which you can invite multiple users. Within these groups, multiple users (up to 100,000!) can simultaneously discuss and interact with each other.

This is one reason why Xenioo have added Telegram!

A group can also have bots within it, and your bot created by Xenioo can be simply added by searching for it in the Telegram interface.

Once you have added your chatbot to the group, you will notice a particular behaviour. What you write in the group is not interpreted by the chatbot unless it is preceded by a slash (/).

This is a default setting implemented by the Telegram chatbot, and is strategically designed to avoid traffic: generally speaking, a bot within a group is thought to participate as an external helper, and is not set up to intervene on what users may say.

In some cases you may want to ensure that chatbot activates when someone in the group says particular words or phrase. In this case, the settings of your bot must be changed through BotFather.

To connect to BotFather again, use the /setprivacy command for your bot. Follow instructions in chat so you can configure your bot to respond slash commands, or to receive any conversation.

Again, for Xenioo these settings are transparent, and will react correctly based on your configuration.

Single and Group Conversations

The management of conversations within Xenioo fully supports all Telegram’s features.

As with Facebook, Web Site and Slack, with Telegram, you can also view the entire history of conversations with your users, and eventually take over, thereby gaining full control.

check and manage conversations by xenioo account

Telegram groups are also fully supported!

In fact, you will be able to view both single conversations and group conversations. In the latter case you will be able to talk to the whole group at the same time!

All Telegram features are already available and enabled in all Xenioo accounts for free!

Are you not registered yet? There is no better time to start exploiting all Xenioo’s cutting-edge options to help drive your success!

The post How to make a Telegram chatbot with Xenioo appeared first on Xenioo.

]]>
/how-to-make-a-telegram-chatbot-with-xenioo/feed/ 0