Show an additional (/) button in the input field? - telegram-bot

Could you please tell me how I could have an additional (/) button in the input field ? As shown here in this image:
https://core.telegram.org/file/811140659/1/RRJyulbtLBY/ea6163411c7eb4f4dc
I have written a bot using this library: https://github.com/python-telegram-bot/python-telegram-bot.
And found out that:
"Show an additional (/) button in the input field in all chats with bots. Tapping it types a '/' and shows the list of commands."
in this page: https://core.telegram.org/bots#commands.
Unfortunately my bot does not have that, using the Telegram app on my iphone.
I also have tried to provide the list of commands using Botfather, but still no yield.

If you have set the commands with Botfather, it should work. Alternatively, you can set the commands programmatically with the setMyCommands method - in python-telegram-bot, that's Bot.set_my_commands.

Related

How to send link with labels in whatsapp business API

I'm using WhatsApp Business API and can't find a way to put links with labels in messages.
Like Click here, in HTML. Couldn't find any reference about it in the docs: https://developers.facebook.com/docs/whatsapp/on-premises/guides/messages
How can I do that?
You can put the direct link in the body of the message, there is no option to format the link,
There are other options, you can create a button, there you can set a label and redirect link on click in the template and interactive message type.

Redirect to calling application when click the button

So I just chatted to one of line(one of social media) official accounts and they send me a message then when I clicked the button "Call us" it redirected me to my default calling application on my phone and filled out their number. Does anyone know how to do the same thing ?
That is probably an example of tel protocol.
You basically make an HTML link just like any other link, but rather than the href containing an http:// link, the link format looks like this:
tel:1-123-456-7890
When the user clicks it, their operating system sends this number to their default app for handling tel protocols, which is usually a phone app.
Here's an article useful for explaining this protocol, as well as some handy information about using it in CSS:
https://css-tricks.com/the-current-state-of-telephone-links/

Telegram send message with clickable bot command

I'm writing a bot in telegram (using c#).
I want the bot to send message to a user with a list of clickable links. When user presses such a link, the client should post this command back to the bot. It should look like this (example from #pollbot):
I tried:
sendMesage method with parse_mode=HTML and tg:\ links. Problem:
telegram renders them as unsafe and navigates away from the chat. Or shows no link.
/sendMessage?chat_id=xxxxxxxx&parse_mode=HTML&text=CommandText
etc...
sendMessage with markdown - same result or no link
/sendMessage?chat_id=xxxxxxxxx&parse_mode=markdown&text=[\CommandText](\Command)
inline keyboard works OK, but I need a link, not a button
Any advice on how to implement this is higly appreciated.
Words starting with a "/" in a text are automatically made clickable as a link. You can just use sendMessage without a parse_mode and send the text /newpoll.

Auto login to website using script or bookmark

I've been trying to figure this out using various different methods. I'm trying to create a script/bookmark or some type of quick action to open a browser tab or window with a specific URL, and automatically log me in using my credentials. I'm not all that concerned about security for this at the moment.
At first I figured I'd try to use a javascript bookmark to do this, but nothing I found in my research worked. Next I tried to create a bash script, but I couldn't figure out how to send the credentials in via the terminal. Most recently, I literally copied the source code of a site, created a local file and tried to hack together something where I could prefill the form data with credentials and use JS to submit the form, and I've gotten close with this, but for some reason when I use the JS submit function, it errors out and says that the username and password are invalid. But when i turn off the submit function and manually click "log in" on my local html page, it works as expected. I want this to be a one click process, so the idea of using onload/submit or something to that affect is really important to me.
The site I'm testing with has a Rails backend and my next attempt might be trying to use POST to do what I'm thinking, but that's currently outside of my level of knowledge on the subject.
Anyone answering: i do not want to use a password manager to accomplish this.
My requirement is that i will either be able to a) run a script or b) use a 1-click option to do this per website. Ideally i'd be able to set this up in a sort of programmatic way to do this with multiple sites, but I'd be happy with 1 at the moment.
i know similar questions have been answered before, but I haven't been able to use information from those posts (the ones I've seen anyway) to figure out a good way to do this.
Create a bookmark for the current page you have opened.
Edit the bookmark
Change the value for the URL to something like this.
(javascript:(function(){CODE_GOES_HERE_FROM_BELLOW})();
find the field for username and password on the page.
Given example for hotmail
var inputs = document.getElementsByTagName('input'); for(var i=0;i<inputs.length;i++){if(inputs[i].name === 'passwd'){inputs[i].value = 'YOUR_PASSWORD'}else if(inputs[i].name === 'loginfmt'){inputs[i].value = 'YOUR_USERNAME'}}; document.getElementById(document.getElementsByTagName('form')[0].id).submit();
OR
try out casperjs.
The proposed solution didn't work for me and rather than spending tons of time installing a testing framework that I'll never use other than for this purpose, I decided to try to do this another way.
First, I found out that the reason my JS wasn't working before is because the site did not allow a JS submit to be done, or atleast that's what it seemed to be when I got this error: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience"
The javascript I was using was in fact working, just not submitting. I used the following code to fill the fields (using "Class Name" elements on the page since there was no name or ID):
document.getElementsByClassName('username')[0].setAttribute('value', 'user');
document.getElementsByClassName('password')[0].setAttribute('value', 'password');
As I mentioned, the problem was when I tried to use JQuery to submit the form: document.getElementsByClassName('loginForm')[0].submit();
Which is when the above error cropped up. I can't really say for sure whether this is the root of the cause, but the page does submit, but I get an invalid username/password error when I do
I haven't figured out a great way to get around this just yet, but my short-term, "hacky" solution was to use Applescript to send a return keystroke to the browser to submit the form. I'd ideally like to figure out how to get the submission to work using JQuery, but I'm not sure how to get around it.

Telegram Bot api custom keyboard additional data values

Is there any way to pass additional data values from custom keyboard layout buttons?
I need to pass a value like ID that they are hidden from user:
{"Button1",{"id":1}} ...
You cannot do it with custom keyboards, but it is possible with callback_data param of InlineKeyboard
When user will press inline button with callback_data specified message received by bot will be type of CallbackQuery with data param containing your data from the button.
That's not currently possible. It would be a great addition to the API, though, in order to separate the text you see from the value you send back to the bot.