I'm trying to create a simple bot for Telegram, I have settled the webhook correctly.
My problem is that I'm not able to get updates using file_get_contents("php://input"). I obtain the JSON object only if I use file_get_contents($mywebsite."/getUpdates"); and in that way I'm able to obtain the info of the chat.
Anyway I can send messages only if I reload my web page and not directly from the Telegram app.
How can I fix this problem?
Related
I wonder if there is a possibility to pass GET query string to a telegram bot backend using Webhook.
For example, when i share a link to my bot, e.g. t.me/mybot?param=value
Is there any way i can access a param=>value pair when receive webhook requests from Telegram on my backend whe the user enters a channel or type any commands?
P.S. looking for conceptual answers not an actual code. Thanks!
I've searched both SO and Google and couldn't find what I need. I'm trying to see if it is possible to send a message to a Telegram bot (which I'm not it's owner/writer) and receive the response. The bot that I'm trying to communicate with through my PHP script will get a text message and in return sends back a proper file regarding the initial request. I want my web server be able to send that request and save the returning file in a specific folder on my server.
Is this possible at all?
What I've been seeing all over is sending messages to users as a Telegram bot. In here I want to do it the other way, sending a message to a bot as a user.
Many thanks
Is it possible to create a PHP script which allows me to receive telegram messages out of group chat. I am following a group channel on Telegram with my personal account. The messages I receive needs to be processed by PHP. I know it is possible to create a bot, but can a bot do this? Is it able to join a channel/group and read all new messages?
I cannot find an answer to do so.
For example I'm in telegram.me/thisgroup. All the messages needs to be received by PHP and in the end stored in a database. The database part is not hard, but receiving it is.
Does somebody know how to?
Thanks!
It's possible by using bot API.
By default bots can't recive all messages. but you can change this setting.
here is the document about this: https://core.telegram.org/bots#privacy-mode
Create bot.
Change Privacy Mode of the Bot.
Add bot to group
Setup webhook to recive messages or use getUpdates method.
Store messages to your database.
I am trying to develop a web site which will send push notifications to all users currently watching it. I found some tutorials on how to send pushes to myself using GCM for Chrome and they are working fine,
(https://github.com/gauntface/simple-push-demo)
but I cannot understand how to send pushes to every user who is currently on my site and allowed to receive them. As far as I understand I need to collect their browser IDs when they subscribe
navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
serviceWorkerRegistration.pushManager.subscribe({ userVisibleOnly: true })
.then(onPushSubscription)
but I cannot find how to get and store them (perhaps in MySQL DB with PHP code) and after that how to send a push to everyone (probably to iterate over all browsers IDs in my DB and send pushes to everyone separately with cURL requests). On my site I have code which uses ServiceWorkers and handles users subscription but everything is working for me only. Noone who is else on a site does not receive any notifications. Any help would be appreciated.
I am currently working on my project like Parental control. I am trying to find a way , that if there is any procedure or way to send a notification from an android phone to a website whenever the android phone sends/receives an SMS and dials/receives a call. On website , a database will be maintained for these notifications.
You could send a get request or post request to a website.
Sending POST data in Android
Android - Sending HTTPS Get Request
Just some examples. You will probably be looking for a restful api. I haven't read this, but it looks viable:
http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html
I think you want to maintain database, based on mobile even. You can create API call, that will send data to database while any activity happened on mobile. That api will store notification on DB.
On web you can create AJAX call that will check in DB, if any new notification come or not, if new record found you can show it on website.
This is what I think the best way to do so...