Telegram bot: List of telegram bot commands - bots

I can not find how to get a list of commands from a telegram bot. Neither via api nor via external binding. Is it even possible?
For example. I created a list of commands to bot with help the Bot Father. Now i want to get this list from my programm to check user input a command.
Thanks in advance.

you can use the getMyCommands method
Use this method to get the current list of the bot's commands for the given scope and user language. Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
Parameter
Type
Required
Description
scope
BotCommandScope
Optional
A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
language_code
String
Optional
A two-letter ISO 639-1 language code or an empty string

Related

Lex bot should not accept only integers

I have created an Amazon Lex bot that offers several services:
open a case
check status
status via email
welcome intent
In the first option, we open a case that requires a reason against which we are opening a case.
My bot receives all values as reasons even if the user gives some number it adds the number as a reason.
The problem
The only thing I want to do is that I just want to prevent my bot to accept only integer values. If my bot accepts reasons like "broken laptop" or "internet issue" that is fine.
It sounds like you need to use the AMAZON.AlphaNumeric type as your slot type. Combined with a Lambda function, you can then validate the user's input and respond accordingly based on whether the user inputs a number or a string of text.

How to programattically access parameter prompts in DialogFlow

I have a basic lead gen bot under which I have 2 services (in 2 different intents) for which I am collecting leads. Under both of them I am collecting the name, email, and phone number and I also have checked the required tick boxes.
It's working as expected when I am just availing/submitting lead for a single service. However, if in the same interaction I also want to go for the second service the bot is again asking for the name, email & phone number which it already has from my interaction for the first service. How do I make sure that it doesn't ask for the details if it already has them?
I also do not mind handling it programmatically using fulfillment but I could not find any documentation.
Any help is highly appreciated
you can use the user storage (https://developers.google.com/actions/assistant/save-data)
or alternatively you can try to link the parameters of the two intents to the same context parameters. Set your parameter value like this #context_name.param_name
I was able to do this by setting an output context in the first intent & using the input context in the second intent.
The trick was to assign a default value to the parameters in the second intent as "context_name.param"

How to handle user names in Dialogflow?

First of all, I'm new to Dialogflow as well as new to coding in general. I'm trying to build a bot that handles subscription pauses.
I have set up some intents and entities for the following steps:
Greet the user and explain what the bot can do
Request a pause for a service subscription (from a pool of ~10
services)
Ask for start time and end time of the pause (two different values)
Sum up the request and repeat the key values
I'm (almost) happy with it but I want to implement a prompt for a username. I don't know if any of the built-in variables can help me here.
That's what I'd like the conversation to look like:
(User): Hi, I would like to pause my subscription for [SUB_NAME] from
[START_DATE] to [END_DATE]
(Assistant): What is your user name for the subscription?
(User): [user_name_123 or UserName123 or USER_NAME] (alphanumeric, not following a certain pattern)
(Assistant): Done. You requested a pause for [SUB_NAME] from [START_DATE] to [END_DATE] for [user_name_123]. Please check your e-mails and confirm your request.
What (I think) I need is a very simple custom variable. In Python I would go for something like this:
user_name = input("What's your user name?")
I'd like to store this as a variable that I can reference with '$'.
Is there any way to do this with Dialogflow?
Also, is it possible to pick up the user name as shown above, i.e. without ML-compatible surrounding sentence structures?
I wouldn't want the conversation to be forcedly repetitive like so:
(Assistant): What's your user name?
(User): My user name is [user_name_123]
If you are using Actions on Google, you can use userStorage to save the username of the user and then later access it to perform tasks ( in your case pausing Subscriptions )
Assuming your intent returns a username, Setting a username in storage is as simple as :
app.intent('ask_username', (conv, params) => {
conv.user.storage.username = params.username; // use $ as conv.user.storage.$ if you want
conv.ask(`Ok, What would I help you with ?.`);
});
Then you can simply access the username as:
conv.user.storage.username
Hope that helps!
You can tag specific words in Dialogflow's training phrases with the type #sys.any, which will be able to grab a part of the input. Then you can grab it as a parameter.
Sys.any is really useful in these types of abstract input types, but will require more training phrases as matching only the username becomes harder.
Instead of using usernames, which don't seem to be authenticated to your service, you may want to look at Google sign-in or OAuth instead. The recommendation above will work, but isn't the best way to do usernames.

Dialogflow, Maps Agent - how to get lat/long?

Dialogflow offers a pre-built agent called "Maps" that helps to catch the location from user's statement. This Maps intent resolves the location and returns data such as
City name (when I search for Google, Chicago)
Business name (when I search for Chennai)
subdomain-area (when I search for "where is saidapet")
admin-area (when I search for Schaumburg)
What is the logic behind this Agent?
Is there any schema defined anywhere so that I know which field to expect for a given search?
Is it possible to get lat/long part of this response?
Appreciate any thoughts.
When you use one of these prebuilt agents, you are basically creating a new agent of your own based on a Google-provided samplete/template. Click on the intent definitions and you’ll see what parameter names they map things to. You can also change these names, add parameters, remove parameters, edit the list of example utterances, etc. What you don’t get is example fulfillment code - your on your own to do something useful with the intents Google has provided in these samples.

About SenInvoice method from telegram bot api

so i want to use this sendinvoice command here
But i kinda confused about what start _parameter means and how to use array of labeled price .
can you give me some example especially on how u use / declare array of labeledprice ?
Start parameter is just unique string to use deep linking (when user open bot, bot pass to user his invoice)
according documentation
This is array with price and other partitions. Tax for example.

Resources