Can't send message from my bot to myself -- chat not found - telegram

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.

Related

Sending message from telegram messenger bot to e-mail

I just need that my telegram bot would sent a message to my e-mail. For example, my bot has a form that user need to fill out, and I just want to get results from bot to be appeared in my e-mail. The form of the bot was developed in ManyBot. I have found several results on passing e-mail message into telegram

Read messages from Telegram via URL

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.

push notifications not appearing as popups at the bottom right corner of the screen for web app

I am working on push notifications by using Google's firebase for a web app(desktop). I have implemented the code given by Google to generate a token on the client's computer by using my credentials of firebase.
The issue is that when I send the request by using ARC client of chrome, I receive the notification popup. But when I try to send the request by using CURL in PHP, I get a success message and the messaged gets displayed on my localhost/index.html (used to generate token and to manage push notification [provided by Google firebase]). Here is the message that gets displayed.
Received message:
{
"from": "565634123456",
"collapse_key": "do_not_collapse",
"notification": {
"title": "Test title",
"body": "Test content",
"icon": "firebase-logo.png",
"click_action": "http://localhost/index.html"
}
}
I wanted a notification popup to appear and not the successful message to be displayed on my index.html. Can anyone please guide here?

Sending Facebook messenger bot message between pages

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);
}

MS Bot: receive file via Skype connector

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.

Resources