How to design a telegram bot

(Peter) #1

I find the tutorials seem to get into great detail on specific things, but I just need a better feel on how to design my bot.

Are there some overall design guides anywhere?

Thanks,
Peter

(Peter) #2

I am doing pretty much the same thing. :slight_smile: I take you are not new to coding so it is pretty straightforward in fact. Flow gets connected to your bot and then you follow the guidelines to publish it.

Is there anythhing specific you are stuck with?

(Peter) #3

Just how to get started with a bot that announces the menu of commands and then let’s users pick them. I can’t seem to find a sort of guide or flowchart that tells me what flow actions I need. There’s just this huge set of actions to choose from with no overall strategy. Is there a bot that can help me :slight_smile: ?

(Peter) #4

You’ve got something better than a bot. Us. I dare to hope our IQ is slightly higher than the bot’s. :slight_smile:

The ‘Ask a question’ action allows you to ask question (if I got it right what you mean by ‘menu’).

There are two basic options: Text and Choice. The first waits for the text to be entered and the latter shows a set of buttons (two in the example above: ‘Racing’ and ‘Extra Education’).

See https://support.flowxo.com/article/133-building-flows for more details. Or come back here. :slight_smile:

1 Like
(Peter) #5

Thanks Peter. Will try that. I just feel a little guilty asking for fish and getting them, instead of being shown how to fish :slight_smile: Cheers.

(Peter) #6

No worries. We are in the same boat. :slight_smile:

(Peter) #7

So if I ask a question with 3 choices how do I have a different flow for each choice they could give? I wish there were more examples as the help just says what stuff does not how to use it. Very frustrating.

i.e. as in the Example if the user picks “Racing” how do I test for that? I don’t see the choices appearing in the flow for the next action. And how to get them to do something else if they picked the other choice?

(Karen Barker) #8

Hi @pdog,

If you’re wanting to trigger new flows by a users answer the best way is to actually use the Send a Message action with shortcuts as opposed to the “Ask a Question” action with choices.

Send A Message shortcuts automatically trigger a flow if there is a flow with a matching keyword available.

The Ask A Question action saves the users response as an output to that action. This means you can continue in the same flow and perhaps branch further actions by using filters. You could use the “Trigger a Flow” action in this situation to branch into another flow with a filter of Question answer = X.

(Peter) #9

How to do this? Where do I put the matching keyword? Is it in quotes? Any examples?

(Peter) #10

If I have 4 menu items do I generally make 4 flows - one per item? How do I end the “menu” flow and what do I start each of the 4 menu item flows with or do they all go in 1 flow?

(Karen Barker) #11

Hi,

How to do this? Where do I put the matching keyword? Is it in quotes? Any examples?

The matching keyword means this is a new flow with a keyword trigger. For example if you had a shortcut of Shipping you’d set up a new flow with the trigger set as follows:

If I have 4 menu items do I generally make 4 flows - one per item? How do I end the “menu” flow and what do I start each of the 4 menu item flows with or do they all go in 1 flow?

Probably for a menu I would recommend doing separate flows - this allows you to keep your flows relatively short and it will mean they don’t become as complex to debug. If for instance you are only doing a couple of actions based on each menu item it might be better to use the Question action and just filter the next tasks based on the answer to the question.

A flow automatically ends after the last action in the flow has run. If you’re simply doing a menu flow which splits off to multiple different flows then it probably only has a Trigger and an action to send the menu message with the shortcuts. :thumbsup:

(Peter) #12

This helps. Sorry for all the questions but it’s hard to get the overall picture on how to design these things. I’ll go through all the tutorials again too.

(Karen Barker) #13

Hey @pdog

No worries - feel free to ask any questions :slight_smile:

(Peter) #14

I have a catch all that lists the 4 commands and a flow for each command. The problem is that when a command is done and one of the flows completes, the prompt just sits there and the user doesn’t get “back” to the menu list which the catch all provides. Do I need to add a send message action to the end of each flow, that is the same as the catch all (which lists the menu items)? Surely there’s a better way to somehow have all the flows show the menu when they’re done, without me hard coding this into the end of each flow?

(Karen Barker) #15

Hi @pdog,

Unfortunately yes you would need to hard code a message to regive the menu options at the end of each flow.

The only other option would be to have a 2nd flow which has the menu and uses a keyword trigger. You could then use a Flow trigger action at the end of every other flow to trigger the menu keyword flow.

You could possibly lose the catch-all flow with this 2nd message and use the bot Welcome Message to send the menu if a user sends a message to the bot which doesn’t trigger one of the existing keyword flows. :thumbsup:

(Peter) #16

Ok I rebuilt it and this works well. I have no catchall but the welcome message show the menu as well as the “end” of each command flow triggers the menu flow.

1 Like