How can I receive messages from Telegram from URL ?
I can send message, if I make request on url:
https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s
I just need to enter "bot api token", "chat ID" and "text". I need something similar but I need to read messages in chat.
Related
I have created Telegram bot from BotFather and it gave me an API key. Now when I am trying to open this URL
https://api.telegram.org/bot<MYAPIKEY>/sendMessage?chat_id=#<MYTELEGRAMUSERNAME>&text=Hello
it responds me
{
"ok": false,
"error_code": 400,
"description": "Bad Request: chat not found"
}
How to fix? What I forgot to do?
I was trying to open my bot's page in telegram and type there something (it didn't respond anything).
I want my computer to send Telegram notifications to me.
i want to delete service message sent by bot after 60 sec.
bot already admin of the group, and i use php for it
when i send
https://api.telegram.org/bottoken/sendMessage?chat_id=chatid&text=hello this is bot
it returns nothing as it sent from bot
but return parameters like message id, text when a user send a message in a group but nothing when bot sends any message
any way to delete the service message after 60 sec or something like rose bot or groupbutler in php command
The JSON response to your request will contain the JSON serialized message resulting from your request. Citing the docs:
On success, the sent Message is returned.
My apps needs a VOIP call functionality and I use webRTC to achieve it. In webRTC how the reciever knows about the incoming call?
All my users will register in Django and flutter as a frontend. If I use FCM how can specify the exact user to send notifcation. Some articles suggest to use UID, email and such things if I have been authenticated with the firebase I might know about the UID but I use my own server How to make this possible?
In case if we use email to send a notification i.e., will firebase send the notification to the particular user?
Use firebase cloud messaging. If you are using Django or whatever server for the backend you just have to get the user's fcm token while user registers from the app. And in your database store the user's email with that token. So whenever you want to send a notification to a specific user you can trigger by their respective fcm token.
Use below code to get user's token in flutterfire.
FirebaseMessaging messaging = FirebaseMessaging.instance;
// use the returned token to send messages to users from your custom server
String token = await messaging.getToken(
vapidKey: "BGpdLRs......",
);
And to send a notification to that user via your Django backend make a post request like below.
Use a service api.
URL: https://fcm.googleapis.com/fcm/send
Method Type: POST
Headers:
Content-Type: application/json
Authorization: key=your api key
Body/Payload:
{
"notification": {
"title": "Your Title",
"text": "Your Text",
},
"data": {
"keyname": "any value" // Any data you want to send for your call initialization
},
"to" : "Token you got"
}
Given 2 facebook pages A and B, with a shared app and bot, I need to be able to forward all messages that the bot receives on page A to page B, in such a way that all moderators on page B can view the messages.
Is this possible? I think the issue lies around where to send messages to on page B. They have to be sent as the bot, and trying to send the message to the page results in a 400 Bad Request. I'm guessing you cant have a message where the sender and recipient is the same.
Your bot can send a message to another Facebook user. The B user must go to the A bot and send a message first. When that message comes to the A bot a number will be associated with the user. The number is unique and not related to other Facebook ids. With that number, the bot can messages the user directly.
There is an example in my demo bot. The bot send a message to my personal account. You can see it live here under the 'Contact' and 'Send a message' links.
Here is some nodejs snippets. The long number is my personal account id for my demo bot.
sendTextMessage(1073962542672604, messageText); // send a message to Matthew directly
...
function sendTextMessage(recipientId, messageText) {
var messageData = {
"recipient": {
"id": recipientId
},
"message": {
"text": messageText,
"metadata": "DEVELOPER_DEFINED_METADATA"
}
};
callSendAPI(messageData);
}
Does someone know how to accept file received by MS bot via skype connector?
On bot side it looks like URL to files, but I need instruction how to authorize to access them:
Attachment: {
"contentType": "application/octet-stream",
"contentUrl": "https://df-apis.skype.com/v2/attachments/0-weu-d1-8ce3f64a740658ec8f227311edacc258/views/original",
"thumbnailUrl": "https://df-apis.skype.com/v2/attachments/0-weu-d1-8ce3f64a740658ec8f227311edacc258/views/thumbnail"
}
The Skype attachment URLs are secured by JwtToken, you should set the JwtToken of your bot as the authorization header for the GET request your bot initiates to fetch the image. See the following for some sample code.