Post your best Lua script examples here

User avatar
By joefly888
#21190 I have searched all over the web for examples of using NODEMCU with twitter and I don't see any example. I am surprised as I would thing this is a natural fit. So leads me to think maybe for some reason it is not possible.

Can someone confirm if it is possible to use NODEMCU with twitter api. I believe it needs https, oAuth. I believe it is possible using ESP with arduino, but I am trying to keep it to ESP only with NODEMCU.

insight appreciated? Don't want to start this project if I am beating up the wrong tree.
User avatar
By tytower
#21353 Not many people answering these . I don't know nodeMCU but I assume you are talking about the board ? Are you coding in Lua or using ArduinoIDE . With your arduino experience probably Arduino IDE ,

OK so is there an example for the Arduino Ethernet to get to twitter . I have not used it but I am sure I have seen it mentioned Take that and convert it to ESP8266. I did so for email and thingspeak etc so have a look in the wiki above for those examples
User avatar
By devsaurus
#21425
joefly888 wrote:I have searched all over the web for examples of using NODEMCU with twitter and I don't see any example. I am surprised as I would thing this is a natural fit. So leads me to think maybe for some reason it is not possible.

If you can't find Lua examples for the twitter API then you could look into an indirect approach using MQTT. For this you'd need an MQTT broker and a server running mqttwarn. mqttwarn can forward the published messages to a lot of services, twitter being one of them.

This requires some infrastructure, for sure. But it's a flexible solution to your problem if the server(s) are already available.
User avatar
By joefly888
#21464 Ty, yeah with NodeMCU I am referring to the LUA firmware for ESP. I am aware that arduino is capable of hooking into Twitter, but figure I challenge myself to get it on ESP only setup.

Devsaurus,
through my research I believe ESP nodemcu hooking into twitter directly is not possible due to Oauth, probably a limitation of the memory of the ESP. I did find that thinkspeak has a App called THINGSTWEET that allows you do simple HTTP POST to send a twitter update. https://thingspeak.com/docs/thingtweet Works great!!

However, I could not get it to read a message using the same APP with post code change. It is not apparent if it is possible or not.

However I was able figure out a not so clean workaround. Using TWEETControl https://thingspeak.com/docs/tweetcontrol Thingspeak will monitor keyword of your choice on Twitter posts. Once picked up it can issues a HTTP Request, which I use to grab the twitter update message and post to my thinkspeak channel/field with the tEXT of message. Then my ESP periodically polls this channel for latest twitter message. Again, not a pretty workaround but was able to get ESP to read twitter. Problem with this is that I could not get it to work with PROTECTED private twitter accounts.

Sounds like MQTT also may have something similar. I have been meaning to get to learn MQTT, now I have a reason to. Devsaurus if you have a link to an example of MQTT using twitter that would be much appreciated...

Thanks..