OpenAI has revolutionized the ways we communicate. Since it was launched, there are thousands of tools capable of integrating artificial intelligence for efficient, much simpler and faster communication.

However, when you decide to integrate artificial intelligence into your business there is always a very important challenge. You need to offer specific suggestions that allow OpenAI to fully understand what you want. And this is done by relying on trial and error to figure out how not to repeat them. You need to learn how AI works and use it to your advantage.

We at Callbell have integrated this option for you within our chatbot, from which you can automatically communicate with your customers. That’s why in this article, we want to explain how to integrate OpenAI with Telegram in order to create a chatbot with Callbell.

Callbell and OpenAI

Callbell is a tool capable of connecting customers with companies using different messaging apps in one place. This tool presents multiple options with the sole objective of improving sales and support processes, granting greater provision of CRM, chatbots, specialized statistics, sales funnels, APIs and much more.

It has currently managed to integrate a new option that allows OpenAI’s AI to learn and interact through the Callbell chatbot. All this by simply entering a prompt for the AI to encode and respond to messages. The process is extremely simple, although it requires configuration to allow it to function correctly.

If you want to integrate artificial intelligence into your chats on Telegram and other messaging apps like WhatsApp, bringing your service to a level capable of distinguishing itself from the competition, being the first to offer a completely AI service, continue reading this article and find out how to do it with this guide.

How does OpenAI work on Callbell?

This feature allows you to generate a text based on a stimulus or previous messages present in the chat. It can be applied to multiple scenarios, from classic interactions with an assistant, to specific actions like summarizing conversations for your agents, granting recommendations or giving importance to behaviours adopted by users. The effectiveness of this depends mainly on the quality of the stimulus provided.

Here is how it works and what its limitations are:

1) The bot always performs the action synchronously, which means it waits until the OpenAI API responds before continuing with the next step. Similar to how Webhooks work, if you have consecutive actions with OpenAI, then they will be executed sequentially and not in batches.

2) The bot continues its flow even if OpenAI is not working, for example due to a time-out.

3) You have to manage the response, whether positive or negative. You will need to specify all variables to store OpenAI’s response. It is up to you to use them in the bot, for example, to block options, messages or notes.

How to get the OpenAI API key and integrate it with the Callbell chatbot on Telegram?

Now we need to look for the OpenAI API key to be able to integrate it on Callbell. We will do this so that Callbell can interact with OpenAI regarding conversations and subsequently receive responses.

Note: Before we get started with setting up our AI chatbot, remember that you need to create a Callbell account (you can click here to do so) and connect it to Telegram (you can add Telegram to Callbell by clicking here).

1) The first step to take to obtain the OpenAI API key is to access OpenAI and enter the link by clicking here.

2) Once inside, we will only have to click on Create new secret key. The program will then give us a code to copy (and this will be our key).

3) Once copied, we must go to our Callbell account and insert the chatbot we wish to communicate with OpenAI, clicking and selecting the one we want to configure.

4) Then, inside the chatbot, in the bottom left corner, we will click on the box that has two brackets and an x in the center, like this (x). This field is called a variable.

Callbell Chatbot

5) Subsequently, once we click on the variable, a box will appear in which we will have to enter the name, the type (in this case, we leave it in chain) and the secret key (API) that we wish to enter into our account from OpenAI.

Note: This newly created variable will be the one to insert into the OpenAI token field once the action has been created in our chatbot.

Callbell Chatbot

How to configure Callbell chatbot to use OpenAI in Telegram conversations?

It is time to configure your Callbell chatbot to interact with OpenAI and automatically serve your customers directly on Telegram using ChatGPT’s artificial intelligence.

Since this process turns out to be a bit long, we are going to create an extremely simple chatbot, so that you can completely understand the concept and from there do your tests and configure it as you see fit.

Before starting, if you want more information, you can consult our guide.

1) The first thing to do is create a new chatbot on Callbell. Once we enter the builder, at the bottom where it tells us to wait for a response, we click to add an action.

2) Now go to the Logic section and select OpenAI.

 

3) A box will appear with several options. In the title you can enter the name you prefer. Then, in the OpenAI Token part, select the variable created in the previous steps.

4) Now it is time to add a Prompt. You can also be very specific, giving OpenAI all the necessary instructions, so that it can answer potential customers’ questions.

An example of a prompt to use to make the chatbot redirect potential customers where we want them to go is this:

PROMPT:

You are a bot that qualifies potential customers for a Hosting services company, a company that sells hosting with all the integrations, including WordPress, for both individuals and businesses.

Introduce yourself as an AI assistant when asking questions. Remember to be extremely polite in your responses.

Your task is to classify potential customers into three groups:

“HOT” Category (good leads), “Warm” Category (average leads), “Cold” Category (bad leads) and “AGENT” Category (people who are not leads, but who ask meaningless questions).

You do not necessarily have to ask questions. For example, if you already have the information you need from the first message, you can classify the user as Hot, Warm, Cold or AGENT.

In this case, return the value “Hot”, “Warm”, “Cold” and “AGENT” without a text. You must not write to the user, be it “Hot,” “Warm”, “Cold” or “AGENT”.

Note: Always keep in mind that when you tell the AI to return the value without text, you are asking it whether a customer is classified as Hot, Warm, Cold, or Agent, and then being sent to the corresponding chatbot flow.

Criteria for categorization:

Hot Category: If the prospect mentions that they need hosting for their website, if the prospect says they want to build a website and want to host it on our hosting, if the prospect says they need more space for his website, if the potential client wants to change hosting company or wants to start his business with our company.

If a lead is identified as “Hot”, simply return its value, or rather, “Hot” without text.

Warm category: If the potential customer is looking for more information on hosting, if they want to know what hosting is, if they are looking for hosting for their business, if they are evaluating different hosting services but have not yet planned.

If a lead is identified as “Warm”, simply return its value, or rather, “Warm” without text.

Cold Category: If the potential customer is looking for information on hosting without having any interest in purchasing, if they want to know what hosting is for, if they want to know how to create a website or simply if they have questions regarding hosting issues without want to buy anything.

If a lead is identified as “Cold”, simply return its value, or rather, “Cold” without text.

AGENT category: If a potential customer asks meaningless questions, if he asks for a service other than hosting and web hosting, return the value “AGENT” without text.

You do not necessarily have to ask for something. If you already have the information you need from the first message, you can classify the user as “Hot”, “Warm”, “Cold” or “AGENT”, returning the value, or rather, “Hot”, “Warm”, “Cold ” or “AGENT”.

Some examples of questions to use for categorization are:

Ask what solution or feature the prospect is looking for

Ask what industry their company operates in.

Ask what hosting specs they need.

Ask about their budget for this solution.

If, after 4 answers, you cannot determine the category, return the value “AGENT”.

5) Once you have established a prompt capable of making the chatbot interact with the artificial intelligence, it is time to configure the previous message analysis option. In this part, we will check the option only for the current session.

6) Check that in the options for saving responses and storing possible errors (if any), the options last successful webhook and last failed webhook appear, respectively.

7) As an ultimate step, to complete the configuration of the AI with the Callbell chatbot, click Save.

Callbell Chatbot

Finish of the chatbot flow for categories.

Now it is time to configure the flow so that when the AI redirects the user, it will be able to get the options useful for assigning the categories Hot, Warm, Cold or Agent.

1) The first thing to do is create 4 categories, since the AI is focused on 4 sections. We will do this for each of the categories (Hot, Warm, Cold and Agent). In this case, we click on the action under the flow and create 4 actions in the Logic section.

2) Once this is done, we will configure them individually as follows 

3) For each of them, we choose a title (whatever you want) then, in the box to select the activator, we modify each action for all the categories.

Hot Category:

Choice of trigger if: the last webhook success (let’s say the same option we set with the AI configuration) is equal to Hot.

Callbell Chatbot

Warm category:

Choice of trigger if: the last webhook success (let’s say the same option we set with the AI configuration) is equal to Lukewarm.

Callbell Chatbot

Cold Category: 

Choice of trigger if: the last success of the webhook (let’s say the same option we set with the AI configuration) is equal to Cold.

Callbell Chatbot

Agent Category:

Choice of trigger if: the last success of the webhook (let’s say the same option we set with the AI configuration) is equal to Agent.

Callbell Chatbot

Always consider that you can change the options and the prompt depending on the needs of your company. This is just a small example of how OpenAI works with Callbell and Telegram.

4) Finally, we configure the flow action called response (or rather, a default action that appears when you select OpenAI). This will work as a Fallback so that OpenAI sends a response directly to the user.

5) Below the aforementioned response, we add an action called send message, easily found in the interactions section. Inside we insert the last webhook success variable so that Callbell can retrieve the customer’s last response, then sending it to OpenAI in the form of a response to the message.

Callbell Chatbot

6) Finally, we add send message below, easily found in the interactions section, call, wait for response.

7) We continue to add the last action, wait for the response, present in the logy section and then we continue to start the bot flow, or rather, OpenAI.

We follow this process every time a prospect sends us a message, Callbell sends it to OpenAI and the flow is restarted, allowing OpenAI to answer the next question, until the AI decides to direct it elsewhere to finish the communication.

Integrar OpenAI a Telegram

Conclusions

As you can see, the advantages of using artificial intelligence with OpenAI on Telegram using Callbell are varied. In this way, in fact, you will have an assistant at your disposal capable of answering any question 24 hours a day, 7 days a week, without the possibility of failure.

Remember that you need to create specific prompts so that everything works correctly. That is why it is ideal to run several tests when setting up your chatbot with artificial intelligence. However, do not give up! With a little effort, you can do it!

If you would like to try Telegram, Instagram, WhatsApp or Facebook with OpenAI using Callbell, click here.

964aef37cbd523c1a8d2250157bf3829?s=100&d=mm&r=g - How to integrate OpenAI on Telegram to create chatbots

About the author: Hello! I am Alan and I am the marketing manager at Callbell, the first communication platform designed to help sales and support teams to collaborate and communicate with customers through direct messaging applications such as WhatsApp, Messenger, Telegram and Instagram Direct