Creating a VK Chatbot with AI via Senler
Creating a chatbot for your VKontakte community using the Senler service can be done in several steps. Below is a step-by-step guide to creating a bot that will interact with users through "clean" and "teacher" modes.
Step 1: Creating a Chatbotβ
- Log in to your personal account on the Senler website and select your community.
- Go to the "Chatbots" section and click the "New Bot" button.
- Enter the bot's name and save it. The system will automatically generate a bot key.
Step 2: Setting Up the First Blockβ
- Create the first block that will send a message to the user with the text: "Hello, choose a mode".
- Add two buttons:
- First button: name "clean", type: text.
- Second button: name "teacher", type: text.
- The color of the buttons can be chosen arbitrarily.
Step 3: Creating User Variablesβ
1. Create two action blocks and add the user variable mode.β
2. For the first action, set the value to clean, for the second β learn.β
3. Add the message "write a question", and check the "Wait for response" box.β
4. Create an Action where the response to the message is saved in the user variable question.β
Step 4: Condition Groupβ
- Create a "Condition Group" block with two conditions:
- First condition: mode = clean.
- Second condition: mode = learn.
Step 5: Integration with ChatGPTβ
- Create two ChatGPT integration blocks, one for each mode.
- Set up ChatGPT for clean mode:
- Insert the OpenAI API key.
- Select the Chat type and model.
- Set the instruction: "Reply to the user in their language".
Step 6: Setting Up ChatGPT for Learn Modeβ
- Repeat the settings as for clean mode, but change the instruction to: "Reply to the user in their language. You are well versed in JavaScript, TypeScript, React Native and similar languages".
Step 7: Completing the Setupβ
1. Add a message with the variable chat_gpt_answer ((%chat_gpt_answer%)).β
2. Add a button named "Change mode" and check the "Wait for response" box.β
3. Connect all the blocks to complete the interaction chain.β
Testing the Botβ
Creating a Chatbot with ChatGPT for Telegram on the Make.com Platformβ
Creating a chatbot with ChatGPT integration for Telegram can be implemented using the Make.com automation platform (formerly Integromat). This allows you to quickly and easily set up a bot without writing code. Let's look at a step-by-step guide to creating such a bot.
Step 1. Creating a New Bot in Telegramβ
- In Telegram, find the @BotFather bot and start a conversation with it.
- Send the command /newbot to create a new bot.
- Follow BotFather's instructions, enter the bot's name and unique username.
- Copy the API token provided by BotFather - it will be needed to set up the bot.
Step 2. Creating a Scenario in Make.comβ
- Register on the Make.com platform and create a new scenario.
- Select the Telegram Bot module and the Watch for updates action.
- Insert your bot's HTTP API token in the Create a webhook field.
Step 3. Integration with OpenAIβ
1. Create a new OpenAI module and select the Create a completion action.β
2. Insert the OpenAI API key you received upon registration.β
3. Select the ChatGPT model of your choice.β
4. Add message 1 with the role System and content "Reply to the user in their language".β
5. Add message 2 with the role User and content "1. Message: Text"(OpenAi).β
6. Set the Max tokens value depending on the selected model.β
Step 4. Sending a Response to Telegramβ
- Create a new Telegram Bot module and select the Send a Text Message or a Reply action.
- In the Chat ID field, insert "1. Message: Chat: ID"(Telegram Bot).
- In the message text, insert "1: Message.Content"(OpenAI).
- Select the MarkDown mode in the Parse Mode field.
Step 5. Setting Up the Webhookβ
- Copy the webhook URL from the Make.com scenario.
- Bind the webhook to the bot using the template: https://api.telegram.org/bot'TOKEN'/setWebhook?url='MAKEURL' Replace 'TOKEN' with your bot's API token, and 'MAKEURL' with the webhook URL from Make.com.
- Paste the resulting link into the browser.
Step 6. Testing the Botβ
Now you can test your bot by sending it a message. The bot should respond using ChatGPT capabilities. Thus, using the Make.com platform, you can quickly create a chatbot for Telegram with ChatGPT integration without writing code. This allows you to easily automate user interactions and provide them with intelligent responses based on ChatGPT capabilities.