📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Погружение в N8N. Собираем ИИ ассистента, используя N8N и Bubble

ИИШНИКИ | Ноосфера: ИИ, деньги, lowcode, мышление2:57:31

Transcription

So, friends, well, I finally acclimatized. We will stick with the same Telegram because it is the most modern chat interface today, with the most features and the widest API.

We will do all of this in the context of the GPT bot, which can hear, see, and speak. It can suck and lick, but it doesn't need to do that.

Oh, Gen has joined us. We will connect all possible Open APIs, and we will do this to not just connect APIs but to better understand agent models, function calls, and how to use data to create user experiences.

Today, we won't climb to the peaks of the Himalayas, but we will understand everything in general because here we have the most active guys, and we will synchronize our understanding of working with the main types of data: text, images, audio files, and the transformation of binary files, sending them to Telegram, for example.

With payment and client logic, I will show you my invention. We will use N1. If anyone has time now, register an account; it takes about 5 minutes. Register it on the demo or the real version with the launch. This is likely a beta version, so you can enter na10 L Chain and find the link.

But even if you can't keep up or click around, that's not required. If you can't follow along today and repeat everything by hand, that's okay. Today, we will focus on answering your questions so that you can do it yourself.

The most important thing today is to generate understanding. Many of you already have a basic understanding, and you will be able to extract deeper insights from what I will say, building on these foundations.

So, today, first of all, the task is to literally feel the continuation of yourself through these agents. I will show you how to create, so to speak, how to work with your own data structures in any database. We will use Bubble because it is simply understandable for our brains.

We won't need to look at other methods. We can directly connect to Bubble and make decisions in the bot based on what Bubble returns or what we send to Bubble. For example, we can send buttons, block a user's subscription, and so on.

We will create a client-side GPT bot that will be available in any window. However, we will master many more topics.

Let's not linger too long and move on. If there are any questions or clarifications or wishes, feel free to reach out. I will start the demonstration now to see if everything is visible.

It seems I closed it, yes, everything is normal.

So, what do we have here? Nikita has joined us, excellent!

Now, friends, I will briefly explain what has happened and what is already here so that we can understand everything.

We will understand how Telegram works through the example of these complex bots where you can make payments and choose something among many buttons. We will generate these buttons and send them.

By receiving webhooks from Telegram about new messages in private chats, we will respond to them. This is basically everything we have already seen in YouTube tutorials, but with deep logic for transformation and working with images and voice messages.

We will teach the bot to respond to us with voice messages as well.

So, Leonid, I am here and ready to help you. How can I assist you today?

I just write, "Are you here?" You are on [music] the line.

This can be done with a voice message.

"Hello bot, write a greeting for the guys from the no-code community."

It didn't send.

"Hello bot, where are you? Why aren't you accepting my voice?"

And it started executing, and it is logging.

Today, we will figure this out. First, I will bring you up to speed on what bot is here.

So, Telegram basically sends a message when we enter the bot phase and create a new bot through this menu. We get an API token, which everyone should know by now.

Then we can call Telegram's API to invoke methods.

What are methods? Let's synchronize. Who among you knows what an API method is?

This is something another program can do for us.

In this case, look, I will open the documentation for you. I want you to leave today with the feeling that you can now understand any API because we are in an internet where all the necessary APIs and functionalities are scattered across the network like puzzles.

Our task is to assemble these puzzles together to create a unique user experience.

And how do we do this? By using different programs. For example, this is the official payment bot of Telegram for accepting payments in crypto.

Anyone can start accepting payments in crypto in about an hour if they know how to work with the Telegram Bot API, which is a different protocol with different methods.

Now let's see what methods are available.

In our case, methods are usually indicated in the documentation in large print, like "get me" and "create invoice." These are methods.

There is also another method, "transfer," and usually, in normal APIs, methods are named according to what they do.

If a method is called "get invoices," it means it retrieves invoices.

This directly indicates that Telegram, for example, has only two main types of entities: types and methods.

Types are data objects, and methods are what you can do with these data objects or their specific properties.

In this case, "get me" retrieves your current session.

For example, it returns basic information about your bot.

If you simply take it and go to the API connector, let's quickly create a new bot.

So, let's go ahead and create it.

We were issued an API token.

Now, everything we need to do is in any API connector, whether in N or in Bubble, we just need to add a new API.

What is here is the same as there.

We add a specific API call, and it always indicates which methods they support.

You see, it says they support GET and POST HTTP methods.

So, we just need to use GET, and we will simply get basic data about our bot.

First, I will just enter it as a variable, B ID, so I can insert it here once and then use it.

Next, I will just look at what my basic request is, what my basic URL is.

So, we will quickly go through this and dive into it.

I can see that I need this structure for the request.

After the Bot ID, I will have a specific method.

What this program does internally is it sends a message, retrieves information about the bot, or can send a photo, audio message, or voice message.

This is what we need to operate all the bot functionalities.

I got the basic structure, B ID, and GET, as far as I remember, is written with a lowercase letter.

Now, this should ideally work.

Yes, we received the data structure, and we got the type.

In this case, it is T.

We just received all the information about the bot so that the bot could communicate with itself.

I don't know when that might be needed, but the bot ID is always useful.

So, we now understand that we will be calling various methods in various APIs and linking them all together to create user scenarios.

I will now tell you what scenario we have here, and then we will figure out each of these nodes.

We need to fix this because this thing broke.

Most likely, the API key fell off or something else.

I will tell you everything, and we will name them together.

So, when Telegram...

Let's summarize one of its methods: "set webhook."

There is "getting updates," and "set webhook" is also a method in its program.

When we say "set webhook," we are simply saying, you see, from the required parameters, only the URL is necessary.

So, to which URL to send requests?

In our case, the URL to which we will receive requests will be this node.

We add it like this, and we assign it here, saying which method to call.

This is essentially our own endpoint for the API.

Here, we are an external program for Telegram, which it manages by sending us requests.

But we set up our internal logic.

We have two URLs: one is already in production, and the other is...

We can copy something, and then we need to call the method by duplicating this node.

We will say that this is a method and just specify here in the parameters that it will be just because it is convenient for us.

I will insert the parameter, write the URL, and send the address to which to send it.

After I send this method, now Telegram will notify me of every message or every update.

There is also a point about allowed notifications, and here you can specify whether to react only to messages or only to callback queries or to everything combined.

If you didn't specify anything, a callback query is when you click a button in Telegram, and it returns some value.

The user doesn't see it, but you see it, and he understands, "Aha, this was sent from the button," and accordingly, it triggers another logic.

Today, we will build the logic for this bot and assistant.

In this case, we will give the user, for example, if he hasn't purchased a subscription, two buttons to choose from: the first to start and the second to learn the conditions.

After he selects one of these buttons, we will follow up with the next actions.

Why is this cool? Because in no bot constructor...

Well, bot development is currently booming, and in none of them are there real, unlimited possibilities for setting up such logic conveniently and working with a database.

Today, we will work on connecting the GPT bot with the database to create sufficiently complex logic.

For my bot, I did the same thing: I set the webhook, and in this case, it sends all its hooks only to this address because a bot can only have one webhook.

Unfortunately, it cannot send data to two places at once.

But we will set up a logic where this webhook address will change depending on whether we need to receive messages here or in Bubble.

At some point, towards the end, we will check if the user has a subscription.

For example, if they do, the webhook remains, and the next message from them will be received here.

If the subscription has expired or they are currently in the pre-subscription stage, for example, when we are just selling to them, they will be able to test four different messages.

They will be able to send a voice message, send a picture, generate a picture, and generate text.

Depending on what stage they are at, we will allow them to send a message once, and it will come here once, and then it will change back to our Bubble endpoint.

So, Telegram will change the places to which it sends notifications based on our own logic, depending on how we want to set it up.

Why is such logic implemented?

First of all, it turned out that it is very convenient to create bots in Bubble, possibly even more so than in other platforms.

We have agents, and we cannot ignore that, especially since this is on my server, and it is beneficial.

In Bubble, you can organize this cool logic, and it is much more profitable than any chatbot constructor you can imagine.

Because for $32, with the number of messages and the functionality you get in Bubble, you won't find that in any chatbot constructor.

The integration with Telegram and MGE is done quite easily.

We recently built a similar agent on WhatsApp.

Now, while all of this sinks in, I will tell you about each node individually and show you what exactly Telegram sends.

Let's look at this update. This is my voice message.

If I click on this node, I will see what Telegram sent me.

It sent me the update ID, the message ID, and the specific ID within this chat, as far as I understand.

And from whom? This is my Telegram ID, which is not a bot, thank God.

I don't know if you saw the video where a guy plays a funny scene about checking if you are a robot.

So, there is a first name, username, language code, whether there is a premium subscription or not, chat ID, and everything in that spirit.

Next comes the content object, which is the type of object.

Now, let's find it.

If we find it, it will most likely be called "file" or "audio."

Voice, there it is.

We see that we received an object of type Voice.

We don't even need to read that because it is all clear, but there are certain complexities, and I will tell you about them as well.

It sends me a file ID, a unique file ID, the file type, and the duration.

This is the first type of update it can send.

The second type of update is most likely text.

You see, there is a message, and it has text, not Voice, as in the previous case.

It can also be an image.

Now, let's find an image under the long requests.

Most likely, we need to look earlier.

Now, let's see what was here.

Oh, this is just why it took so long to execute the start command.

Okay, let's find a long one.

You see, the execution time of our request is shown everywhere.

We need to get to this one.

Let's see if this is an image.

No, it generated a response.

This one should be it.

No, everything is...

Why is it Voice?

The point is that we will also find an image.

We will send it to him now, I don't know, the first one that comes to mind.

What do we have?

I will send a picture, and we will see how this update looks.

So, something just went wrong.

I only managed to raise my hand.

We see an execution error because something fell off.

In our case, we didn't get the ID of our bot.

This is strange because it didn't execute.

You see, from this node, I should always pass the ID of my bot.

Now I will show you how this is done.

Let me hide this thing.

So, let's first see how this update looks.

We have already analyzed the voice file, which is sent as a file ID.

So, it is sent, but we can't do anything with it yet.

We can't just take it and see it.

So, we need to do something with it.

Photos, as you will see, are sent to us in three or four versions with different compression levels.

So, a preview, compressed, to then send it to the agent or interact with it somehow.

So, we saw that the photo looks roughly the same, the text looks the most pleasant, and what else do we have?

Voice files are treated the same way.

Now, several stages of verification occur to understand how we lead to the agent.

Our task is to ultimately remove all the hassle from the user so that they can pass their request to the GPT model or agent conveniently.

Fortunately, Telegram allows us to do this.

First, let's return to the editor.

If you need to reach a specific data object and you don't know how to do it from the editor, you can copy the path to the item.

Let's check.

Yes, everything is excellent.

It selects our current node.

Sometimes it can be done even easier, where it is indicated just like this without all of that.

But you will see this later in my work.

You can also copy the parameter path and see how it will look.

By the way, this is how it looks.

This is the path to reach this.

To extract the text, we can in any node, if it is connected to webhooks, either directly or indirectly.

For example, this one is not directly connected, but we can reach it by simply inserting such text.

Look, in this case, I am reaching for the chat ID.

I say, "Refer to the node ass."

Yes, this is our first node.

Look into its J, its B, its mess, its chat, and its ID.

If we look at the structure of all of this, it will look something like this.

We go to the upper-level GBO in the item.

Yes, in the item, we look at the chat, we look at the J, we look at the A, we look at the ID.

If I copy this parameter path and paste it here, for example, there is a convenient note feature.

Well, right now it is not active because we are in test mode, but I will see the exact expression.

The only thing is that for some reason, I didn't like how it was written.

Before, it was written more correctly, maybe like this.

In general, this is not the point.

Initially, you can even go into any node and say, and start entering an expression.

Expressions are written in double brackets.

You will immediately be able to select your assist.

For example, where is it?

Here it is.

I will write it, and I will say, "In what language did they send me the request?"

Then M, and I can extract any file.

I can immediately get the text if I need text, or I can extract T ID because the chat is a nested object in the mess object.

That's it.

For example, through the chat ID, I identify who wrote to me.

Oh, rather, who wrote to me.

Through mess T, I understand what was written to me.

And then there is a series of checks.

The first check is what type of update it is.

Is it a button press, or is it a specific message in the chat?

How is this checked?

I simply say I need to check.

There is a node called If.

Yes, If is called switch, and I say I need a boolean check, yes or no, true or false.

I say, "Look at its body."

I am just calling a built-in method here, hasField.

This thing checks whether the field exists or not.

If it has, it returns one; if not, it returns zero.

I write what I need to output.

If it equals false, return zero.

So, let the data flow in this case.

Yes, let everything that came here flow through this path.

If it is true, then redirect it to this path.

I have nothing here; I have nothing implemented.

This is just a placeholder for now, and I will work with it, redirecting the webhook to Bubble.

So, I will pass the parameters to Bubble and work with them from there.

Not in the webhook, but directly from the data here.

So, the next check is hleField with voice.

If there is a voice, return to zero, meaning redirect the data to this path.

If there is no voice, then check if there is hField for the same principle.

If there is a photo, I redirect to another side.

In my case, I don't have a photo, but if there were, it would redirect here to this non-working node.

We will fix it too.

Then I check that everything that remains means I have text.

If I excluded everything else, if I excluded the callback, if I excluded the voice message and photo message, then I only have text left.

But in the case of text, I also need to check what kind of text it is.

Is it regular text, or is it a command text that starts with "start"?

Yes, I say check start.

If item json message text contains the command start, which is the standard command for Telegram bots, then return one.

If it does not contain, return zero.

Accordingly, if it contains, we will launch one logic, most likely pass it to Bubble.

If it does not contain, we will launch the agent logic.

So, what do we do?

I show you.

If you see, I have only one scenario worked out, which is that it contains start.

As far as I see, you are on the line, and it says zero, meaning it does not contain start and is passed to the text message record.

You see, there is a node called "write some variable that you need later," and you can set it a specific path.

In this case, I am just writing the text into this variable.

I write prompt O.

Why is this done?

I explain because in the latest feeds, everywhere I have prompt 1 written because the agent accepts this structure.

It says that I pass it the date and time and the name of the person who sent it.

You see, through the webhook assist, I send the first name, meaning who is writing.

I say, "I am asking you," and then I specify what he is asking.

So, J PROMT, you see, why is there such a short variable call here, and here it is so long?

Because this variable is the previous one.

This is always a node.

Here it is the previous one, and all these nodes have the same prompt parameter in which the text is contained.

Therefore, to reach the previous node, you can do it not with such a big method but with a simple dollar sign and through a dot, we indicate the name of the field that we returned.

You see, this is the previous field, and this is what we generated.

Yes, and here we have the GPT response.

Yes, Leonid, I am here and ready to help you.

How can I assist you today?

So, I passed my name to him, and he addresses me, "Yes, Leonid, I am here and ready to help you."

I simply wrote that you are a multifunctional multimodal assistant, always responding in Russian.

I did this in English, and then it is simply sent to the person who wrote to me, meaning who wrote to the bot through the Telegram Send message method.

I take output J from the previous node and just shoot it into Telegram, and I receive it.

Plus, I send it as a voice message.

There is also a model from OpenAI called Text to Speech, but I call it here in Bubble.

I take backend processes, and I have a special one because I honestly swear to you, guys, I couldn't figure out how to send a voice message to this speech model.

It was just a challenge.

I sat for a couple of hours and couldn't finish it, but I was probably already tired, and I did it in 5 minutes in Bubble.

Everything is quite simple here.

I will tell you about this when the variable says that it needs to request text and then send this voice to the chat ID that this method sends me.

So, look, I am addressing my Bubble through the URL, meaning I call it, passing the ID in the body so that it understands to whom to send the message from here.

Because I want to return it and send the message back to the user, and what GPT responded to translate into speech.

You see, I have here MTI response m because Bubble does everything there, and it doesn't need anything.

Now let's see what Bubble returned to me when I tried to send a voice message.

It sent some error.

Oh no, this is not Bubble.

Now we will quickly fix this.

So, look, here I specify B ID just as a field, as I showed you.

Yes, here is J B ID, but I didn't connect it.

So this node doesn't run constantly.

Therefore, I just need to take it and pull it, probably to JSON or, oh yes, to the webhook.

So that it also runs.

Now I need to update this node, or rather the environment.

Now, every time it runs from here, it will immediately pass data to this node.

This may not work because there will be some conflicts, but we will check it now.

We will resend the voice or even a photo.

I will just forward the photo to save time.

Let's see what happens in execution.

Again, an error says that the data simply didn't pass.

Yes, again, this problem.

You see, this node started, but this node didn't start on time, and everything was wrong.

So we will elegantly resolve this conflict.

We will simply take and disconnect everything unnecessary from here.

Although even like this, it is possible.

We need to pass the impulse from the first cell to check the photo first to B ID, and from it, pass the impulse to...

This way, our system will start.

That's it.

Just like you will build this, you will then go in, forward messages, go to the executor, and see how everything is working.

You see, in my case, the movement just didn't go.

So for now, I will make it much simpler.

Is everything clear so far, or what?

What is in this orange color is an error, or did you highlight it in orange?

This is where the nodes are, like set HTML.

Yes, you see the orange color?

Yes, this is it.

You can make a note for yourself so that you can remember what this group of nodes is responsible for.

Because you should also abstract them.

You should remember, "I can write here, this is photo processing in my case."

Yes, and no, this is Voice.

So, I will show you what this thing does.

This thing receives the Voice File ID from Telegram.

Then it gets it, using this B ID.

How to make this all convenient?

Interesting.

Here, B ID is inserted, and the method Get F is used.

This thing, using the file ID from the previous node, retrieves the file, and we end up with a specific MP3 file.

After that, the MP3 file...

Oh, by the way, interesting.

We pass it to the model transcription, which converts voice to text.

Here, we will pass the file in the field with the name file.

Yes, where is this seen?

This is seen in Open.

We just go into any A and look at what we have.

Legacy completion functions, here is the documentation, and spe to text.

We need to pass the file name and the model.

It simply returns text, automatically determines the language, and everything.

After we pass this file to it, it returns text, and we write this text where?

Correctly, in the prompt.

By the way, we don't even need to append everything here because we will pass it in advance.

So, here is the text that the model returned to us.

After that, we pass it to the agent.

Now let's figure out what the agent can do.

I showed you the basic prompt.

You are just an assistant.

I can complicate it as I need.

Yes, this prompt can be kilometers long, but the most interesting thing is that I gave it the GPT preview model, which is the most modern one currently working in GPT.

I gave it two tools in my case: DALL-E for image generation and Vision for recognizing objects in images.

Look how simple it looks.

Yes, you call this tool when the user asks you to generate an image.

The input you need to pass to this tool should be the prompt filled with the user request.

In the end, it passes not the prompt but the query, and the Vision Tool calls this tool when the user asks for specific content or context of the image.

It understands when it needs to call the Vision model, and all these models are described here.

Look, I go into Vision, and it says what structure of data to request.

What do you think?

Is it that simple?

No, these are separate workflows that I give to this agent as its tools.

These are separate specific scenarios.

In my case, these are Vision and DALL-E.

You see, they are inactive because they are called internally from this assistant.

Vision looks like this: in the era of programming, your complex model looks like three cells: start workflow, execute function, and return result.

In my case, it passes this structure.

Look, it specifies the GPT Vision model, specifies an array of messages in text, the text itself, the prompt that the previous step passed.

By the way, it is not a fact that it works now because it should pass the query, not the prompt.

Let's check.

Yes, and the prompt is also passed because I somehow started passing it correctly; I don't remember how.

After that, the model returns us a response.

Oh, and here the type Image is passed, and in iml, the file is passed, meaning the binary file we received from the previous step.

Let's see how it can look.

In this case, it is just a link.

You see, thank God, a specific link to the image, meaning we don't even need to download it first to pass it here.

And this is a blessing because it would be more complicated to pass between two workflows.

In the response, if you use the agent, at the end of each workflow you give it as a tool, you must create a field through the node Set Field.

With data manipulation, Edit Field, you create a node that you call "response."

Its type will be a string, and in the value, you can put anything.

This is what is returned to our assistant after it calls this tool.

By the way, something fell off.

Look, Vision...

Oh, sometimes check, you may lose connections like this, and then you will think, "Why isn't it working?"

It is better to restart.

If you opened a workflow, refresh the page, and then edit it.

It will significantly reduce the likelihood of hitting something.

When it calls the Vision Tool, it returns what is drawn in the picture, and it understands how to work with this response.

It can shorten it, expand it, or return it as is.

You can make it so that when using this tool, it does nothing afterward, just responds.

Then it sends this as a voice message in Bubble.

So, through Bubble and text, it instantly sends it through the Telegram node.

You see, here you can use ready-made Telegram nodes.

Yes, they are here, and there is a lot of useful stuff.

So, with all these brackets and everything in Bubble, you can also call methods natively.

If I need to send a message, I will, of course, use this node to do it through Telegram B App.

You just specify...

How to fold this?

You specify your method.

In this case, where is it?

Here it is, send message.

You can also embed something in this.

Look, there is another node.

What is really convenient is that you can request a location.

There are also triggers below.

By the way, look, on each of the events: callback query, channel post message.

But here there is no voice message and photo message, which is inconvenient.

Oh, here we have a message.

Look, we can add a reply keyboard.

We add a row, add a button, write "Give location," and here we can request the location.

The user can send their current geolocation with one click so that we can use it.

For example, if we create a multi-user service where people interact with each other based on location, it could be like Telegram Tinder or something else.

We can do this right inside the application.

Yes, this is a big idea.

If you do this inside, well, wrap it up.

Nodes are just functionality, but functionality without monetization sucks.

Why?

Because what is the point of people using all this if we pay for it, right?

We need to wrap all of this in a way that welcomes users, teaches them how to use this bot.

Imagine that now you have the opportunity to talk to it by voice.

For example, you can say within one session, which lasts for now 11 messages, but I can dynamically adjust it.

For each user, if they bought some cool subscription, their context can be 20 messages, 30 messages.

You can say in the first voice message, "Hello bot, act as a two-way translator from Indonesian to Russian."

It will say, "Okay," and that's it.

Then you just send it a voice message in Indonesian, saying, "Oh, durian, all that stuff, come tomorrow."

You don't understand a thing it says, you pass it all to your bot, and it returns a full translation in Russian without any comments, nothing.

But if you didn't pay for it, then something went wrong.

We will do it so that Bubble, working with logic, meaning managing access to all this beautiful chaos, accepts payments and teaches people through buttons and all that.

Now, we might take a break for about 7-10 minutes, and then we will return to all of this while you digest the base of what I have told you.

You can ask questions during this time.

What do you need?

After that, we will return and create the logic with all the beautiful buttons, message editing, and so on.

So, I am here.

Valer, you can ask anything.

You can turn on the microphone.

I don't know, Leo, look.

They don't look alike, do they?

All of them are basically about the same thing; they just simplify requests to the models to varying degrees.

In the end, the most powerful combination right now is this one inside.

Why?

Because in Bubble, there is its own database, and we just use it additionally as logic.

If we have N installed on our server, we only pay for Bubble $30 and get absolutely unlimited functionality compared to any of these Build Chip Flow Wise, which are all overlays on either LM or these things, meaning on agents.

Moreover, even these agents are no longer needed; no overlays are needed for all of this, considering that Open has rolled out.

Of course, we need them for now because it is convenient.

Or they are wrappers for various APIs and data manipulations.

So, understand this: you can do more in Bubble than anywhere else.

You can even create a catalog of products and issue it as buttons.

Incredible opportunities open up as soon as you understand how Telegram works.

You just need to go through their methods a couple of times.

But what you can build later, of course, you won't get such full control on any service.

Here is a question: does ChatGPT have memory?

And do you still use vector databases?

Yes, look, now it is not particularly needed, but for some reason, I still prefer Supabase because it seems to work slightly faster, probably because OpenAI's servers are under heavy load right now.

The load is absolutely colossal, and the assistants are a bit lagging.

If we look at our Chat, yes, how quickly it responds with our vector memory.

We use PCon as well, which is a vector database.

Yes, there are a ton of them: Supabase, PCon, and the built-in Firebase.

I don't think Firebase has a vector database, if I'm not mistaken.

But maybe they did something.

A vector database is just a different database; it is not tabular.

It is not like in Bubble, meaning there are no rows and columns.

It is just a set of tokens in a row.

Now let's see some database.

What do you think about the vector database?

Well, right now, this is not a vector; it is just a text database, I can say.

I haven't even seen that you can store files there.

Well, something can be done, but Notion is a separate tool.

It is a no-code tool for automation.

You can also create some automations there, write custom code somewhere.

They will definitely grow into a very large no-code solution.

They are already very big, but they are currently focusing on project management.

So, there are as many ways to apply it as there is everything on the internet.

So, guys, let's take a 4-minute break, and we will return with renewed strength.

I am currently studying NN, HTTP, conditional logic, and plus data transfer.

I don't understand what an array is, and there are all sorts of variables.

With code, you pass data.

I don't understand this.

Now, one second, I took 50,000 for the order.

In the end, I made it.

I always call it by deadlines, a little more than I think is necessary.

In the end, I did it.

So, I called it by deadlines, 7-10 days.

There was no super clear TЗ, so there were no questions at all.

But in the end, I did it in about two working days, meaning roughly 18-20 hours.

I just did it.

Everything turned out great.

Now, everything can be done super quickly, considering what we have in our hands.

I built a full-fledged Telegram bot that provides location selection, then category selection of products, and then specific products from that category in the form of buttons.

I will show you today how this can be done, and you will understand the principle.

It then accepts payments in crypto through the Telegram crypto bot, checks the payment, and issues a digital product, like access or something else.

All of this literally takes 4 hours of work.

Yes, we will do this today.

The funny thing is that it is very simple when you understand everything we will discuss today.

I have identifiers.

I have data that should...

There are some identifiers, and some data is the essence.

Yes, the identifier allows you to understand to whom a specific piece of data relates, and the essence is to create logic, meaning to exchange and transform them.

Today, we started thinking more in this context.

Now, when you understand what the main types of data are, you understand that in any business, there are auditory, visual, text, tabular data, and data that are people, meaning specific users.

Now, with different ways to work with them, either through some separate services or through other services, you can create almost any functionality.

But at the same time, you need to simplify your structure as much as possible.

Today, we looked at how three types of data come to us.

Let's define what these types are.

If it is text, that is one; if it is voice, that is another; if it is a photo, that is the third.

We tie all of this to the essence.

In my case, for example, at each stage, everything is tied to the user's Telegram ID.

Even the memory buffer is tied to the chat ID.

Then, if I need to reset the current context, I just replace one letter here, save it, and then the bot communicates with me from scratch, for example, if I am testing it now.

So, does anyone else have questions, or shall we move on?

Let's move on.

Please write something in the chat, like pluses or something else, or minuses.

Give some feedback.

Who else is sitting here?

It is important to understand at least minimally what is happening.

If there is minimal grasping, we can move on.

By the way, I registered, and I have 3 days or 2 days left in the test mode.

What can I do?

In theory, you can do everything.

It is better to look at specific tutorials on how to install it on your server and just set it up.

Again, I will always be in touch with you.

Just document everything you do, ideally in video format, and set it up for yourself.

You can share it with the guys.

This is something I haven't managed to do because it is not a core thing, but it is important.

We can work with the entire community, and you will have a solid tool where you can use all this power for about 400 rubles a month, or for 300, I don't remember how much it costs.

So, I recommend starting with this, and then moving on.

You will level up, and you will set it all up through the terminal, through several different services.

In general, I will send you how to do it.

All the best!

Okay, guys, if there are no questions now, let's continue.

If there are, ask.

I will now tell you how we plan to organize user identification within Bubble.

We simply create an entity for each user.

Now, here we can delete this.

Can I ask a question, please?

First, how much does it cost?

Nothing.

If you install it on your server, it costs you the price of the server.

For example, 300-400 rubles in the case of Geto.

You can run a trillion processes on it, unlike all these Ints, Maves, Zars, and so on, where you only pay $30 a month for a small number of requests.

I already process up to 10,000 requests a month easily because my crypto bot works on it.

All Telegram bots work on it, and it communicates with Bubble.

In general, a large number of things.

So, you just need to set it up for yourself to have your own tool.

Then you have complete freedom.

But first, I recommend just going in to feel it out.

I think they even give a 14-day trial on the beta version.

Maybe 10, I don't know.

And that is enough to really get into it and collect something.

Then, you can gradually set it up for yourself because it is not a very pleasant process.

It is not just about going to a website and registering; you need to dance with a tambourine in the terminal.

But globally, everything is solvable.

If the guys will also plus, we can take it live.

Yes, for example, I will honestly say that when I installed it, I first installed it through the built-in Beget, but there is a different version on Geto.

It is without Chain.

But even, wait, I updated the version to the latest one, and it still wasn't working.

Yes, it is possible because you updated the last version, but you updated not the beta version; you updated just the main chain.

But I think now you can do it like this.

If you just install the basic na10 through Beget, you can do it with one click.

Yes, conditionally, you need to update it later through the terminal.

You can install the community node, and here you enter its name, and it will appear.

In our case, it should be popular.

Now let's see the chat.

There is a lot of useful stuff that you can find.

You can install it for yourself, and it will also look beautiful with nodes, for example, with database text manipulations.

Isn't that cool?

So, let's try to install it.

I will just enter it here and check.

Most likely, it can already work.

You see, I have here that the community node is not installed, L Chain.

This means that I already have a version with it built-in.

This way, you can install it.

What is cool here is that you can just copy this name and paste it there.

Now, the second question: I heard...

Well, because I didn't watch YouTube.

Oh, first, start with YouTube.

Yes, and then refine it with this webinar.

Look, in terms of the structure of learning, I mean, YouTube is the first priority.

Because it is the first approximation to understand the architecture of these guys.

But everything I showed you today should be anthropomorphic thinking.

This is just, well, a chain, conditionally speaking.

In your case, you don't need to understand that this is specifically a wrapper for a large linguistic model.

A large linguistic model has memory, has current memory in the dialogue.

Long-term memory is in the vector database.

This is where data is stored in the format of relationships between words.

The angle between them is measured, and then smart searching is performed in this database.

In our case, with the waiter, we put the menu there, and when the bot understands that it needs to get from its long-term vector memory, for example, a lactose-free dish, it writes some primary request.

Yes, dishes like that, then it selects lactose-free ones.

So, first, it gets just the dishes that fit based on fullness and other criteria.

But this can be said to be close to how our memory works in the brain.

We base our recollections on specific keys and values, while we base them on associations and connections between specific words or sets of phrases.

This kind of search is performed by the agent, and it has hands.

Why did I mention anthropomorphism?

Because it can be any tool.

We can connect it to a calendar or something else.

Now, let's go into the left assistant.

Now I will show you Leo's bot, and I have a structure here with voice messages.

My bot has a bunch of different hands.

Here, it can book events in my calendar, delete them from my calendar, perform mathematical calculations, and look at all my events in my calendar.

Yes, this is used to do searches for restaurant automation.

This is to remind a person of an event.

If a person signed up for an event in my calendar, it will take the chat ID and the reminder time and send a reminder to the person at the right moment.

So, this is how they are structured.

We connect to them through external interfaces: through chat interfaces, through voice interfaces, or through Gmail, for example.

A person can write you an email.

You can create a Gmail bot with GPT.

So, not in the Telegram chat, but in Gmail.

You received an email, and you insert a node for Gmail, saying, "Well, this is a message."

You add it, and between them, you insert the agent or just a GPT request.

This is a simple automation of your emails.

You can choose not to respond or analyze them.

For example, this email is spam, delete it, or forward it to me for analysis.

You can classify your emails using GPT through these three nodes.

The first node receives the email, the second node tells GPT what to do with it, like, "Return the probability that this email is interesting to me."

If the probability is 10, forward it to me; if the probability is zero, delete it; if the probability is something else, do something else.

So, the order is like this: figure out the structure of agents, then look at the vector database to understand how data is transformed to reach the agents.

Yes, our task today is to understand how to handle any API request.

We will get more and more knowledge, and we don't need to know much.

This is the beauty of it: all this complexity, it seems, boils down to two main questions: where do I get the data from, and what identifier do I extract from them, and what do I do with them through which API request, and where do I collect them later?

If it is a structure in a database, like a table, in our case, yes.

There are also lessons on how to connect to a vector database, and you can specifically do it.

It is better to watch it not on YouTube but in our Telegram channel, rewind in order of appearance.

The first video on the topic of bots has a specific cover.

We will also gather this with Valery.

Yes, yes, yes, so that we can have deep information that you won't find anywhere else.

This is highly valuable, and secondly, to perceive such information, you really need to sit down.

This is not something you can just watch as an educational video on YouTube.

So, yes, please, I am glad if I could clarify.

By the way, this is how one of these workflows looks.

You can call it directly from here.

This specific thing refers to here, and it retrieves all events from my calendar, filters only confirmed ones, extracts the start date, end time, and name, sorts by start date, formats the response, and responds to the agent.

Now, let's move on to the juicy part.

Our task is to first receive data from the Telegram bot or from the agent.

In principle, I believe that we can even not use this method of passing webhooks between one side, meaning sometimes receiving here and sometimes receiving there.

For example, yes.

Why?

Because, in principle, all of this can be done...

Now I will tell you what to do.

Look, our task is to have the ability to identify each user to tie how many tokens they spent, how many requests they sent, whether they have a subscription or not, and so on.

In Bubble, usually, in any no-code tool, we do this by creating a user entity.

Yes, we have a user, and they have a login, password, and all that.

In the case of the Telegram bot, we don't even need that because they are already authorized in Telegram.

We just need to know their ID.

So, we create an entity called TG User, meaning Telegram User.

The most important field is the Telegram ID, which is our main identifier that resolves everything.

Every time a new user writes to us, we need to create such a record.

Let's see what I have here.

In TG users, it is currently empty.

So, let's try to do this right now through our bot.

I have just disconnected our webhook, and we will work with Bubble's logic.

I will say, "What are we going to request?"

We should already have a prepared request.

Here it is, but for some reason, it has incorrect coordinates.

Now, this workflow is not the one.

Let's start from scratch so that it is as clear as possible.

We say Bubble, and we say, for example, we choose authorization.

This is my authorization that has already been created.

Yes, it is created simply by inserting the token of your application.

You go to Bubble, go to API, and here you say whether to allow backend workflows and whether to allow the data API.

You refer to the data API and say what needs to be specified.

What things can be obtained through access?

In the privacy settings, specifically in the data, you set the access rights.

Here, I should specify that this TG User is not MT, for example, and say that it can be edited and all that.

But it is strange that it should have been indicated that it can be edited and so on, but we see they removed that.

So, what happens?

I should receive an object.

What object?

Now I will show you.

The object that is in the field, in a specific field.

Yes, specifically in the field now typ - this is my user ID.

This is not it.

Now let's see.

Interesting.

We will make it even prettier.

It has its own documentation, and in this documentation, we can search.

I will find a ready-made request to explain it to you.

By the way, we are not in that bot.

Now we will return to our bot, and maybe we will find it.

So, what we want to do is copy everything.

Now we will find here to request a message.

This is a cool way we can perform a specific search in Bubble.

So, what will we do?

Let's disconnect all this good.

Nothing terrible will happen; it is just for the tutorial purposes.

Then we will connect it all back.

So, the first action will be to get a record, and if the record does not exist, we will create it.

This record will be TG User, but with a lowercase letter, probably.

Yes, TG User with the field Telegram ID, in which we will write the Telegram ID.

So, we say, "Look, do a search in the knowledge base for objects called TG User."

Then Bubble tells us directly, as it is written in their documentation, how to search.

When we want to get an object from the database using the GET method, we need to specify constraints.

They don't look very pretty, but as soon as you look at them for about 5 minutes, you will understand that here the key, in my case, is the Telegram ID constraint.

Type Text contains, meaning there is a condition.

Yes, this is a logical operator.

We have already discussed the logic that the operator that text contains is written like this, with a space.

So, everything will be fine, and the value is what value contains the message chat ID, which I have already specified here.

Now, one second, the computer is shutting down.

I will quickly do this.

So, when they turn green, it means we have access to them.

Right now, we don't have access because the workflow is not running.

This is understandable.

What we have is J format.

Yes, in principle, everything we do is built on JSON, and praise the great JSON.

So, we are searching by chat ID, and then it should return an object.

In what form?

Look, it will return a result, and we will check the field.

We will just copy this thing.

Let's first see.

We will do a simulation, by the way.

I really love doing request simulations in Bubble because now I will show you what I do.

Now there should be a test hook.

Here it is, and I have just written the same thing that Telegram sends, but quickly.

So we can send it without waiting for Telegram messages.

We can test our webhook right away.

Look, this is a pretty advanced topic that I use constantly in practice.

Look at our test.

Let's check if the area matches.

Yes, the area matches, and we say listen to the test event.

Then I just run the same thing that Telegram sends.

It returns the same structure that will be sent by Telegram.

This is very convenient.

I copied it from other workflows.

I just took it and copied it all the way to here.

From this icon, I select this upper one and say Copy selection, and it inserts everything I need.

Now I can paste it here.

You see, I see that everything was pasted.

Now I will just delete everything before update ID, save the bracket, and here, by the way, up to the second bracket, I need to delete.

I need to see how many I have there.

In the end, yes, up to the second bracket.

Now you see, everything is the same, but I can work with it conveniently within the editor window.

Because you see, here it is, and it has already been passed.

Now, the green J is already green.

I see my ID, which is my Telegram identifier.

Now I can request the corresponding value, and it will return nothing.

You see, the type is not found.

TG User.

This means that we may have done something wrong with the type.

Maybe we should try to enter it.

First, we can check if I marked it in the API.

It may not be marked.

Now, let's say TG User is not marked.

Well, now everything should appear.

Execute node.

Look, it returned results, and the count is zero.

Great, that is what I need.

This is what I need to check.

If we have no one, then I check what I check.

I check results.

The count, I think, is checked.

Well, we can do it this way.

Look, if I just delete this, I can say if fse, then we need to create a thing in B.

So, we need to create this user.

We will say Create object Type TG User.

We choose our credential and say that we need to write in the field called Telegram ID.

Correctly?

Correctly.

Telegram ID here, we choose Expression and just insert from the webhook.

We insert the chat ID.

Boom!

Now I will execute this node.

Now, one second, check why it is not connecting to this node.

Now let's execute it again.

Now everything is done.

We can save and reload.

Sometimes it happens.

If this doesn't help, just...

Oh, by the way, this is cool.

We are doing everything in copies.

Great!

So, let's execute the test webhook again and try everything from scratch.

I say, "I go here."

Everything executed, and I check here.

It passes here, and it works.

Now, we need to check if we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect them like this.

So that it first writes the value here.

You see, it has been written.

Now we can reach the ID in this specific node.

Yes, this will be the node.

We will call it.

Next, we check if everything is in order.

Oh, everything is in order.

Now we can check if the count is zero.

If it is zero, we just create...

Aha, we should select this moment.

Chat ID.

Well, then we can try to switch.

You see, it may be because of the beta version.

This is also normal.

Usually, everything works when you run it in a real environment.

Right now, it is not executing.

But we can come up with something with this.

Now let's see more than that.

We can try to do this.

You know, we can move this thing here and try to connect

I'm going to work on the reply markup, and we'll change it. We'll say, "Well, for example, [music], uh, by the way, maybe I'll just show you first so that it's clear."

Let's say we check everything. I burned everything. In short, we need to change everything. So, what do we do? We do a callback. Something wasn't working there. Let's check and go back to see what we had with the callback to make sure we fixed everything.

Here, it just didn't work. It seems the data was passed here, but it just didn't check anything. Let's send some callback again, go to Edit, and say, "By the way, here's what we can do."

Look, guys, to quickly test our bot again, we can do the following. We can go back to where we tested sending messages. I already have a ready scenario with a callback, but let's do it. [music]

Here it is, you see? The data will be, for example, P, and I can now run this test again. It's waiting for a session; it's waiting for a test event. I'll send it. [music]

I sent it to the wrong place. So, we'll just go back to where our initial test callback was and take our address from there. We just sent it to the wrong address.

Initialize. Everything is great; we received it. Let's check the callback, and it sees that the callback exists and contains some parameter. Now we need to send this parameter.

Where do we get the Chat ID from? If it's a callback, we need to send it. Let's get the Chat ID. We also need to send the date. Let's check if that's correct.

So, here's our callback data and Chat ID. Everything is correct. We add a new field, call it Data, and in the Expression, we insert, guess what, this value. Let's check. Yes, it works.

Now we need to restart it. Let's send the test request again. Oh no, my friends, this is going to be a disaster. If I understood everything correctly, it will be very bad. I hope I didn't save it, so everything is fine.

Let's check again. You know, sometimes these connections just break, and you think, "Okay, let's gather all our missing data." We take the Chat ID and add the date field. Now everything should work.

Again, we get a data mismatch error. It needs to be a string. So, what do we do? We use JSON.stringify, and everything worked. [music]

So, what did we do wrong? We sent it to the wrong assist; we needed to send it to the callback.

And by the way, it should have worked correctly now. Let's check if our message ID was saved. Everything is great; the message ID was saved. Isn't that wonderful?

Now we execute the node workflow not found callback. What do we do about this? We had two 3 L instead of two. No big deal.

Look, you see the last message changed. It was one thing and became another. So, we can build our entire experience within one message.

Look, I'm starting all this. Now we should check it. Let's see what stopped us in the execution. [music]

Ah, it stopped us because it couldn't do everything. We just needed to write it like this. Let's try starting again.

It stopped again. We'll figure it out because something is happening here. Oh, we have the old name. It was in the previous node.

In this one, everything should be new. Switch. Everything is fine. Create account. Everything is fine. Create account ID. Everything should be good here too.

Let's check. Everything started successfully, and we should have received a message. Great, it came.

Now we would have created a handler. Let's write here, "You selected something," meaning what the person selected.

And we [music] will say, "You selected," and just put the date here. Now this button will show what the person selected.

Let's click it and go through the training again. Let's check. [music]

This node, yes, it can't do anything now. So, we will just write it to continue on failure and all the others that follow it.

You understand that this is a workaround, right? Later, we need to complicate this logic a bit, for example, to find the user only after the callback.

So, if it's not a callback, we redirect here. In this case, this is how it will be. Now, I'll probably update it.

It should look like this: we take it off from here, and only if it's not a callback, we do it like this. Here we have an account; here we don't have an account yet.

We find the user only if it's not a callback. As strange as it sounds.

Everything is connected, and let's try everything again. Clear the message history, click Start.

Let's see what happens. The switch worked. Finding the user also worked for some reason, even though we clicked Start.

So, what's the type? Here it is, the text Start. Our task was to check on Start.

What returned? No output came out. For some reason, we have Jon response count.

Oh, I see. We just didn't set up the routing rule here. Let's check the execution. It executed, sent the message again, so something is wrong.

Let's check Start. The request executed, you see? The request to Bubble went out, but something here is not included.

Ah, the Chat ID parameter was missed. Why? Because we didn't pass it from there.

So, we need to check why this data isn't reaching this node, even though it's connected to our main node.

Let's see what we can do. We can take from this node, because it directly passes the Chat ID, and we just take it from there.

We'll say Chat ID, copy the path to the parameter, go back to our editor, and say, "Here it is, my ID."

This should work. Let's test everything. Great, it worked. Now we click the button.

You see? We have one message. Now we can refer to it, and it says, "You selected something."

And there's also a link sent, "Here's your choice." You see? You can't set up such logic through one constructor to make it super flexible.

For example, I can say, "Here's your choice; you selected Pay," and we can assign another purpose to this button.

For example, here there can be a specific payment link. Look, we have it.

What do we have? This should be a different link. We can just send it here.

We'll say UC invoice, say the cost is 1,000 rubles, and we'll leave the Return URL as is.

And we'll say, "Only when Data contains Pay." That is, only if the callback Data contains Pay, then we do all these actions.

For example, let's swap them and just insert "You selected" here, and "Pay" here.

And we'll insert the result of the first step. Now I'll tell you what this will be called: Create invoice.

What? Something is unclear. Let's check.

Now, just in the use case, I want to show you how this logic will work with payments.

Just imagine a person reached the Pay button in a couple of clicks.

We create it, and it should be just confirmation, confirmation, confirmation.

No, not confirmation URL; that's 100%.

Yes, everything is great. Then we just need to set up the next step and restart everything.

Oh, oh, oh. Start.

We can delete this message, for example.

Look, I don't want the Start message to be here.

I can call the method Delete.

First, I can create a special workflow called Del, and I'll pass only the message ID and Chat ID.

That's all I need for that.

You remember, right? They are numbers, so why convert them back and forth?

Here, we just call the method Delete Assistant Bot TG Delete message.

The message ID will be the message ID, and the Chat ID will be the Chat ID.

And here we just say, "Schedule AP workflow Del mess when the current date and time plus 7 seconds."

Ignore authentication rules. The message ID will be the result of the first step, and the ID will be the ID after the automatic message sending.

Oh, wait, that's not it.

We need to put this all in here.

We need to pass another parameter called message ID, and its value will be taken from our JSON.

But everything works a bit more complicated.

Let's see what else we need to add here.

Message ID will be a number, and it will be message.ID, most likely.

Let's see if this can work.

But we need to write this in Start Assist so that we accept it.

Now we accept message ID, and it will be a number so that we can schedule it.

We'll say, "Clear message message ID," and that's it.

Now, when we react to the Start button, we will have our messages.

Let's initialize it again.

I'll check if everything is correct.

Yes, I don't care anymore; everything is already revealed.

Assistant bot, is my bot ID written correctly in the Delete message method?

I need to take the right one.

Let's see if it's correct.

Yes, everything is correct.

Now, I'll insert my text here.

And that's it.

Now, every time the start message should be deleted.

All we need to do is check it.

I just don't want it to hang around for too long.

Let's see if everything worked.

Maybe there was an error.

No errors, everything worked.

The only thing is that the message hasn't been deleted yet, and it didn't respond to us.

Why?

Let's see.

We don't have the Chat ID identifier.

We seemed to have done everything, and we didn't send the message ID either.

So, let's do it all over again.

Just what I wanted to do: restart our hook with the message text parameter being Start.

Well, yes.

Aha, Start.

Everything is going smoothly here.

Let's check how far we can reach.

The Chat ID is there for some reason, but when we start it, it's not there.

And also, the message ID hasn't been set.

So, we need to write it correctly.

Webhook assist, we take the message ID here.

Blin, I wonder how this will be.

Let's execute it again.

Everything sorted out.

We have the message ID and Chat ID.

But now we need to check if this will work from here.

Start execution.

Everything worked, friends.

Now this message should be deleted.

It just got deleted. Did you see that?

I didn't delete it; I meant the second one.

Now we have a clean chat.

Yes, our interaction with the bot happens within just one message.

We don't need to create them one after another.

I click, and I know everything; I pay.

Now I should receive a link to Yandex.Kassa.

In theory, it didn't come.

Let's see what happened.

The callback came; we sent the data there, and we got an error back.

Look, UC invoice returned an error.

We need to generate a unique SK each time.

In Yandex.Kassa, this is a strange thing that is absolutely unclear why it's needed.

Here we have everything, but indep SK just needs to be changed.

Let's check if we sent one-time buttons or not.

Can we click them again?

Yes, we need to start over.

Let's clear the message history and go.

Now the message will be deleted.

We can do this right away so it doesn't hang around.

Oh, it got deleted.

Now we click, "I know everything, pay."

Look, Yandex.Kassa sent us a ready payment link, which we just need to go to and pay.

Then the bot will be able to figure out that this is our payment.

Why?

Because we are in Yandex.Kassa.

Here we can add some additional information.

They have Yandex.Kassa.

Here, the keys are not protected because they are all closed, thank God.

Let's go, Sergey, see you later.

And notifications API.

Look, payment acceptance.

Now, quick start.

Give payment.

What else can we send here?

We need to see because they don't write about payments in metadata.

We need to send another parameter called metadata, and we can include our Telegram user ID there.

This will be quite convenient.

After that, we can identify any payment.

We can really do whatever we want.

Let's see how this looks.

Order ID.

No comma is placed after it.

In rr ID, we insert the variable.

We say g ID, make it non-private, and just during code generation, here it is.

We insert it into Yandex.Kassa.

Oh, we need to identify it.

Let's restart it.

Well, this can be a variable.

Everything here is absolutely correct, even down to the currency.

Everything is correct, and we will insert the Telegram ID.

So, friends, you now have a ready payment.

You can check it later because Yandex.Kassa has webhooks, HTTP notifications that you will receive at your address.

In my case, it's already ready.

You just need to set it manually for now.

I have it connected to Tilda.

Here, you will create another one called Cher and write the address of this workflow, as I showed you at the very beginning.

You will go to your project settings, copy this, and paste it here in the notification address.

And that's it.

You will say what notifications you need to send, and every time they send you notifications, they will send you the order ID in the metadata, which will be the Telegram ID.

I don't know, maybe even this can be changed to be Telegram ID.

Most likely, yes.

So, if we run it now, everything will work.

Aha, and we need to change it, as I understood, almost every 5 seconds.

So, it should also be unique.

Did you see that?

Everything worked.

Look, we get the ID of a specific invoice, and for now, it's pending.

It's not paid, but we have the metadata Telegram ID, which is correctly named, and it will be sent to us when the order is either paid or canceled.

And we will also take a handler that will make changes in our system.

We will say that if the payment is successful, then in the Balance field, which will be a number, write the corresponding value.

But first, you need to figure out the data structure that Yandex.Kassa will send you.

This is done very simply through test payments.

We can create a test store and do all this, and then we can determine the data structure to understand what to do.

Because right now, we can't approach this step simply because we missed the step of receiving a specific notification from the test store in Yandex.Kassa.

But now that we understand the basic logic, we have a callback handler.

So, all this is unnecessary.

Let me create an empty folder now, and we'll just put this workflow in there.

We don't need Delete message; we need workflow Folder Bot Web.

We don't need Start assist; this is the same logic, but I made it inside the bot.

I'll remove it because I don't need it.

Text to Speech, I need, and Yandex.Kassa Checker is needed for payments.

Now we will go to our folder.

Here we have everything.

In four cells, we can organize a complex logic.

Why?

Because you have a condition that checks the callback data.

If the callback data contains one parameter, we launch one scenario; if another, then another.

You can name them directly.

I write it like this: "Give money."

Yes, the first one is to request money.

So, request Yandex.Kassa.

"Give money."

At the beginning, you can set your internal standard.

And that's it.

It's very convenient.

You write Pay.

Yes, that means if anything, you react to the callback data that contains Pay.

And this way, you will have a very convenient hierarchy of cards.

You will understand which card responds to which callback data.

Because if it's to go through training, it will be a different question.

It will be stages, and here we will give three course options.

So, we won't show what they selected.

We can even send without buttons or just buttons with training options.

Yes, you see?

Stages of course selection.

We have a unified system that manages callback buttons.

Part of this system lies here because it sends us the contents of these buttons.

The main functionality opens only if we receive some condition.

For example, if we understand that it's not a callback, then we need to find the user.

We also need to record some data for this user.

We need to understand how many messages they have, how much balance they have.

If their balance is greater than zero, they can send another message right now.

If it's less, then they can't, and we redirect them back to Bubble.

So, friends, I believe that just by reviewing the webhook again and building something on your own, you can tackle any task.

Because it's complicated with Telegram, but if you create your interface, you won't have to deal with half of these issues.

You can do everything, for example, in Bubble, where you can allow image input, voice input, audio player output, and you have a full-fledged assistant.

I think we won't deal with agents today, that is, how to set them up, because everything is on YouTube.

There are specific tutorials on what to do and how to launch them.

I'll pass today's meeting to our student for editing.

I don't know if he's here today or not.

Bro, let me know if you're here, Danil.

We need to hide some keys at least.

That's it.

Now I'll see where our chat is.

Oh, brother, hello.

So, I think we did very well today.

I think if my brain is fried, yours is probably fine.

But today we still delved into very fundamental and important things.

It's really important to review this and ask questions because questions will arise from the fact that you just couldn't remember everything, and that's normal.

So, it's better to send voice messages and screenshots in the chat.

Yes, the recording is there.

The recording will be available.

So, send screenshots and questions in the chat at every stage.

The more completely you describe your situation, the faster you'll get a response.

Because as you can see from today's session, this can all be done quickly.

We gathered everything with explanations and actions in, what, three hours?

Maybe even less.

And that's it, all in the general chat.

So that everyone can follow along and give comments, and I'll also be watching.

Because if you figure this out, it means you understood data exchange.

If you understood data exchange, then you can do anything.

It means you need to go and say, "I can solve everything. Just tell me what's bothering you."

Because you have assistants, agents, and the opportunity.

Today, we essentially conducted a lesson on automation.

This is usually what entire courses are dedicated to, but since we started from the very basics, we can think in larger categories now.

And we just need to get a little more into this data exchange, key-value pairs through JSON, and identification, the connection from one to another.

Today, we also played with tools.

We transferred from one tool to another, using the same methods in the same bot from different parts of our product, but everything works as a unified system.

Because they communicate.

And as I told you, the main thing you need to be able to do is data communication.

If you set it up like we did today, if you managed to transform the data into the structure you need, like we did with the buttons, we understood, "Aha, I want to make a selection from five buttons or ten buttons."

There is a limit, but how do I do it?

I need to create a uniform array of texts.

How is this done in Bubble?

It's done by creating text lists.

In other systems, for example, it will be done differently.

For example, it will be done through an item list and transformation.

Or maybe you'll do it through custom code and pass a set to it, and it will give you a list of buttons in response.

Yes, that's also possible.

Even GPT can do that.

You can say, "Write me JavaScript that will take everything from the input and transform it into a list of texts that I will then use in the Telegram method."

So, everything is there.

Is there a question?

Yes, JavaScript and JSON are the same for communication.

I don't know, dear Gen, did you listen to the introductory course?

Yes, JavaScript is a programming language, and JSON is a standard for communication between programs.

JavaScript uses JSON, Python uses JSON, Bubble uses JSON.

Everything on the network that communicates over HTTPS uses JSON to send messages.

JSON is a structured way of presenting data, meaning key-value pairs, nesting, arrays, lists, and so on.

That's how programs communicate.

JavaScript is what the program is written in, meaning how it understands what to do.

I agree that they sound similar because JS and JS.

But that's only at first, which confuses people.

Because JSON is just a format for program communication.

It's how their postal delivery looks, and everyone has their own, but it's always JSON because it's the most modern communication protocol today.

I can send you a JSON object in which I specify the schema.

For example, I will send you available types, and I will send you audio format.

I will just call it audio, but it's not audio, right?

It's just a set of characters.

But in that set of characters, I can send you file ID, unique file ID, duration, performer, title, file name, and size.

And based on that data, you can transform it, for example, download it.

Because I will also tell you how to download it.

They have their own structure, and you just go and find out how to download something.

This object, File Ready to be downloaded, can be downloaded using the Telegram Bot API, file token, and file path.

But the file path is obtained using the getFile method, which you take from JSON.

With your code, you can do this using JavaScript or Node.js because Node.js is essentially just JavaScript under the hood.

That's how it is.

If JSON is fully JavaScript, absolutely right.

Yes, [music] I don't know why it's called JavaScript, but it's just a text format for presenting data.

You can use it with any script.

There are a few formatting rules for JSON.

You can also check that JSON has, well, it's just understood through experience.

For example, square brackets are arrays, curly brackets are objects, and they can be listed with commas.

The main thing is to always remember to put quotes; that's the most important.

So, friends, I'm very glad that today we...

I really hope you can review this and want to review it and delve into it.

Because what we went through today is something you should really get into.

It's better to ask questions because we can take this and lay it out again.

We already have it assembled.

You already have an understanding, and we can take it, call, and go through it again to refine how this entire system works.

Because at first glance, it may not fit in your head, but still, review it to solidify it.

Okay, remember this project too.

If it comes up, it will be.

Now, it's not connecting yet.

We had a client who wants to automate smart homes based on these agents and identification.

We can connect cameras, microphones, and various phenomena, so to speak, and third-party scripts.

Yes, you can collect anything in Node.js, but we probably won't collect it.

We'll be like web sockets.

What we discussed today is a thing that acts like a postman.

It sends a message, receives a message, sends, receives, and nothing happens until someone sends a message.

Streaming data is webhooks, and webhooks are needed in systems that need to regularly read the environment.

For example, sensory information from a microphone.

We need to regularly stream data from the microphone to the server so that if a certain keyword is detected, for example, we don't stream any data from the microphone unless the microphone's volume threshold exceeds, say, 3 decibels.

But if it exceeds, we start streaming it to the server in real-time.

It's not like we send and receive; no, we send a piece of text, cut it, send it, and keep doing that until the volume drops below a certain threshold.

Web sockets are a thing that hasn't found widespread application in no-code yet, and few have learned to implement it.

It's possible to do it through custom functions, but again, people implement it through third-party plugins.

There is even a plugin for sockets.

But we prefer to write it in code, create a small logic for it, and then have it send requests when it passes the initial filter.

For example, a websocket receives a stream of data from the exchange in real-time, and if a position closes, only then does it send us data through the standard protocol to our code system.

This is also very simple.

Websockets have ready-made code; you just need to add filtering on top of it to determine when to send a REST request.

That's the next step.

Now we need to figure out REST because, as you can see, it's already fun.

REST requests allow you to create magic because they can be iterated.

You can say, "Request once a second," and your server will handle it, but not necessarily.

If you request, for example, every 5 seconds, you have practically the same streaming.

But it depends on who you're communicating with and how many requests they allow in an iteration.

So, dive in.

If you figure out these bots and the database that works with them, everything will be fine.

There shouldn't be any questions left.

All these interfaces will soon transition to chat interfaces, and you won't need anything else.

So, guys, let's go relax.

Your humble servant has already been talking for 10:00 PM, and conversations take a lot of energy.

I need to replenish it with wonderful food.

Thank you for your presence, attention, liveliness, and interest.

The recording will be available.

Thank you, too, for your help.

Goodbye, everyone.

Let's go.