Node Red and telegram bot error - node.js

Firstly I want to say I am a novice to programming. But I want to learn. I do know logic and want to make things for myself using Node Red for IoT.
I was trying to figure out how do send messages to and from telegram through node red. So that once I can do that I can connect other devices that can listen to my messaged from telegram and be controlled via node red and vice-versa.
Here's what I have already done so far.
1. Installed both of the following modules in Node red
TelegramBot and Redbot(chatbot) via NPM and for this example I am using Redbot to send my message.
2. Setup a telegram bot successfully and got my API key for the bot
3. Got my API key and ChatID (which was really a Pita BTW)
4 I followed guide - https://www.npmjs.com/package/node-red-contrib-chatbot to setup my Node Red Flow. the basic flow which looks like this. NodeRed Flow
But my problem is when I send anything from my Telegram bot, NodeRed pick up something as I see the "Debug tab" updating. But it only says
"msg : string [44]Unable to find context().global in Node-RED"
When I click the error it takes me back to the instance of Telegram I setup already.
I know I am doing something wrong here but what is that I am just not sure. Can someone help. I am sure I am missing something very simple.

There is an open issue for this problem on the package's github page:
https://github.com/guidone/node-red-contrib-chatbot/issues/28
And a what looks like a pull request that will fix it:
https://github.com/guidone/node-red-contrib-chatbot/pull/29

Related

Discord bot that sends messages recieved from webhook

I am trying to make something that will send a notification to my phone via discord when a webhook is called. The notification should have a body of text, and could be something like a python error, or just some plain simple text like "hi there".
I built a discord bot that uses an overridden python BaseHTTPRequestHandler, running in its own thread, which sends the server messages via client.loop.create_task(self.get_channel_by_name(name).send(message)). However, it is pretty slow (takes a few seconds to half a minute to go from webhook to server message, when it really should be almost instantaneous)
I'm thinking I have taken the wrong roundabout method for building my webhook discord server, but I have no idea the right way to go about this, and though I would ask the community. Any thoughts on how to go from requesting a specific file like "http://localhost:8000/post/category/channel/encoded-message", to the specified message in my discord server in a specific channel in a given category? Thanks for any advice!
I figured it out after a bit of googling. Here[https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types] is the discord api for creating bots using webhooks. The trick is you go to the channel of the server you want to send messages to, and in the settings, add a webhook in the intergration tab. No need to mess around with the discord python package. I managed to start sending messages using python requests library, and nothing else.
import requests
requests.post(f'https://discord.com/api/webhooks/{webhook.id}/{webhook.token}', data={'content':message})

send typing notification in MSBOT framework in node.js

I have developed a bot in Bot framework. Once user responds to the bot and bot is processing it, i need to show the typing indicator to the user in the meanwhile for every 2 seconds . It should be working across all conversations of the chat.
Easy as pie. Node.js bots send a typing indicator to the user by executing session.SendTyping();
If you want to see what this looks like in the framework, you can find the code here
Also, Microsoft has a documentation page that talks specifically about this.

Gupshup Flow Bot

Gupshup integrated bot on Viber not working. May be it is because I am using russian language? There is not a Welcome Message or a start button here. And when user trying to write something then bot sends one message only and this is my message about error or unknown commands. I have tried to Deploy and it doesn't help me. What is wrong?
P.S. Trying to edit the bot, but can not doing it because website freezes on
"Trying to resurrect IDE Server... Please Wait!"
Try to use a different browser. It works for me.

Skype Echo Bot for NodeJS: Messages Not Appearing in Skype App

I am following this Echo Bot Tutorial, and have gone through all of the basic steps regarding setup and registration. I am following the steps (near the bottom) regarding local testing, and have been using ngrok successfully.
I was able to add my Skype Bot as a contact, and I also have the latest version of the Skype app (Mac). When I send a message to the bot via the Skype app, I see the message appear in the debug notes in my terminal window. So I know that the messages I type are coming through.
I also see this:
skype-sdk.MessagingServiceClientV2 Sending message to 8:username with content Hey 8:username. Thank you for your message: "test".
However, I do not see any kind of reply in my Skype application. My expectation is that the bot would echo back my message to me.
My questions are:
1) When testing locally using the ngrok method described in the tutorial, should I be able to see activity from the Skype bot (in terms of messages to me)?
2) I am guessing this may be some an authentication issue? How can I best troubleshoot things, and get the Skype bot to actually respond in the Skype app?
I feel like I am incredibly close to getting this working, in that the messages I send are coming through... but the messages I expect from the Skype bot are not coming through. Any help or ideas greatly appreciated!
Found the fix, and posting it here should anyone else run into the same issue.
During the setup process, when I was using the Application Registration Portal, I selected the wrong string as my Application Secret.
Originally, I clicked on Generate New Key Pair, which resulted in a new entry appearing in the admin labeled Private Key. I used this string as my App Secret.
However, it appears that what I should have done was click on Generate New Password and used *that string instead**. Just gave it a try, and my bot is now responding back to me locally (in the Skype app), when testing with ngrok.
I think this particular distinction could have been made clearer in the documentation, as I lost a great deal of time due to this one oversight. Oh well, at least I can start developing now...

Getting onStartChattingMessage to fire in a Kik bot

I have been playing around with the Kik bot framework using Node and have a bot to chat with. I am using the onTextMessage event successfully, but have yet to get the onStartChattingMessage to fire. The docs are not very detailed, any idea when this gets invoked? I thought it would be when I start a new chat with the bot but that doesn't seem to be it. Or I am just holding it wrong. Code is on GitHub at https://github.com/jcapka/otherword/blob/master/server.js
Per https://dev.kik.com/#/docs/messaging#start-chatting this only happen
Under normal circumstances, you will receive this message once
when user that starts chatting with you for the first time.
If you are trying to get it to work but using the original username you have already chatted.
You'd have to make a new account to be able to get the first-time experience and have that StartChattingmessage
As an example I went and messaged your bot and I got this response `

Resources