telegram-bot

Telegram bot: example json, inline_keyboard

…衆ロ難τιáo~ 提交于 2019-12-03 21:36:00
Example json for show inline_keyboard in telegram bot https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating enter image description here { "chat_id": "123456", "text": "Hi", "reply_markup": { "inline_keyboard": [[ { "text": "A", "callback_data": "A1" }, { "text": "B", "callback_data": "C1" }] ] } } I just had a hard time trying to get it to work on my API and I've found the problem. You need to JSON.stringify() the contents of reply_markup that converts the keyboard object and contents into a string first. Here's an example. bot.onCommand = function (chat, from, message_id,

Iinline keyboard. I made a button, but what to do with the callback_data?

南楼画角 提交于 2019-12-03 21:28:29
Need help with inline keyboard. I made a button, but what to do with the callback? I understand I need to somehow get a callback_data and issue a new message. <?php $access_token = 'xxx'; $api = 'https://api.telegram.org/bot' . $access_token; $output = json_decode(file_get_contents('php://input'), TRUE); $chat_id = $output['message']['chat']['id']; $first_name = $output['message']['chat']['first_name']; $message = $output['message']['text']; $callback_query = $output['callback_query']; $data = $callback_query['data']; $message_id = ['callback_query']['message']['message_id']; switch($message)

Setting up a Telegram bot without a server

依然范特西╮ 提交于 2019-12-03 17:22:04
I'm not well versed with web techniques and would like to know if there's a way - an idea would be to use setWebhook - to make a telegram bot do simple stuff (like simply repeat the same message over and over again whenever someone sends it a message) without setting up a server . I think there might be no way around it because I need to parse the JSON object to get the chat_id to be able to send messages... but I'm hoping someone here might know a way. e.g. https://api.telegram.org/bot<token>/setWebHook?url=https://api.telegram.org/bot<token>/sendMessage?text=Hello%26chat_id=<somehow get the

Anyway for setting Telegram Webhook without setting up https connection

只谈情不闲聊 提交于 2019-12-03 16:11:31
I want to setup Telegram Webhook but I don't have https URL, I don't want to deal with ssl certificates either. Can I solve this problem by using https URL or without setting https certificate up? Telegram webhook desc: https://core.telegram.org/bots/api#setwebhook https is mandatory but it doesn't mean you MUST set it up completely. You can use more more simple ways, let me explain: You can connect your localhost server on your own PC or mac or linux machine, to telegram severs without setting any SSL Certificates. With using "ngrok.com Secure tunnels" you will have a https address that is

Upload self-signed ssl certificate to telegram

不羁的心 提交于 2019-12-03 15:20:02
问题 I'm making telegram bot using webhook on php. The problem is that the webhook doesn't set correctly and idk whats the matter. my setwebhook code : $ch = curl_init(API_URL); try { $cert = new \CURLFile(SSL_KEY); apiRequest('setWebhook', array('url' => WEBHOOK_URL , 'certificate' => $cert)); echo "webhook set"; } catch (Exception $e) { echo "error"; } 回答1: You can set the webhook via the terminal rather than in your code like so: curl -F "url=https://your_domain.com/where-the-script-will-be/bot

Can i get a phone number by user id via Telegram Bot API?

时间秒杀一切 提交于 2019-12-03 11:34:29
I'm using Telegram Bot API for sending instant messages to users. I've installed nuget package . This package is recommend by telegram developers . I've created a telegram bot and successfully got access to it by using code. When I send messsage to bot, bot gets some info about sender. I need the phone numbers of users to identify them in our system and send the information back to them. My question is Can i get a user phone number by telegramUserId ? I'm doing it for user convenience. If i could to get a user phone number I should't have to ask for it from the user. now my command like this:

Calling Telegram API to create a feedreader bot [closed]

南楼画角 提交于 2019-12-03 10:01:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I have seen New API for bots are enabled to create custome bots,I have seen some sources such as this and this I have also read about @fatherbot which is about registering bots,I also searched about some examples about telegram bots such as this one,I know how write codes in php

How to hide ReplyKeyboardMarkup after user click in Telegram Bot API

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 07:00:32
I am using Node.js telegram-bot-api . Idea: Show a custom keyboard with one button - "Share my phone number". When user clicks this button, contact should be sent and button should be removed from screen. Here is a code I am using right now: bot.sendMessage({ text: 'Please give us your phone number', reply_markup: JSON.stringify({ keyboard: [ [{ text: 'Share my phone number', request_contact: true }] ], resize_keyboard: true, one_time_keyboard: true }) }); Problems: When user clicks "Share my phone number" button, it shares his contact but button is visible even after that. When I am not using

How to send an Embedded Image along with text in a Message via Telegram Bot API

喜夏-厌秋 提交于 2019-12-03 06:11:29
Using Telegram Bot API, I'm aware that it is possible to send an image via https://core.telegram.org/bots/api#sendphoto However, how can I embed a remote image into a formatted message? The message I am looking to send, can be compared to a news article with a title in bold, an image, and a longer text with links. I figured out how to create bold text and links with markdown, but I'm failing at inserting images. How can we do that? barzin.A you must set ParseMode in HTML and set your Image Url in A tag like this: <a href="' + image + '">‍</a> ‍ -> never show in message You can use zero-width

How we should send query to Telegram bot API?

≡放荡痞女 提交于 2019-12-03 05:59:01
问题 After creating a telegram bot and gain bot token, I want to send a request to the bot API. This link says we must send the HTTP request like this: https://api.telegram.org/bot<token>/METHOD_NAME and brings example for easiest method "getme" which has not any input parameters. Imagine I want to send some messages. I should use the sendMessage method which has two Required input parameters: chat_ID and text. Now my Questions begins: How can I write this sendMessage method in above request