Announcement

Collapse
No announcement yet.

IFTTT to trigger Node Red flows?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • will40
    replied
    well that was simple...thanks for the tip about Node Red function nodes. I did not know that.

    The simple filter node works great.

    Leave a comment:


  • ksum
    replied
    Replace your Function node with the Filter node. It will show on the editor field as rbe. See the image below. I thought this is delivered with Node-RED but it appears that may not be the case. I have it showing when I search for RBE in the Manage Pallette menu. node-red-node-rbe You should be able to use the default values.

    Function nodes use more resources over other nodes. While one or two do not hurt things much, it is better practice to use standard nodes when you can, even if from a contrib. I think this one will do exactly what you need and was the one I was trying to point you towards.

    Click image for larger version

Name:	image.png
Views:	47
Size:	48.3 KB
ID:	1631295

    Leave a comment:


  • will40
    replied
    ksum here is a working version. I chose a user twitter test feed with very frequent posts so I could apply changes and see the test results quickly. It's not the most elegant flow but works for any twitter feeds that I wish to keep a close eye on. Thanks again for your assistance and contribs on this.

    PHP Code:
    [
        {
            
    "id""e13b35838490bc02",
            
    "type""change",
            
    "z""e85ae3689f64c329",
            
    "name""",
            
    "rules": [
                {
                    
    "t""move",
                    
    "p""payload",
                    
    "pt""msg",
                    
    "to""incoming",
                    
    "tot""msg"
                
    },
                {
                    
    "t""set",
                    
    "p""payload.status",
                    
    "pt""msg",
                    
    "to""incoming",
                    
    "tot""msg"
                
    },
                {
                    
    "t""set",
                    
    "p""topic",
                    
    "pt""msg",
                    
    "to""update",
                    
    "tot""str"
                
    }
            ],
            
    "action""",
            
    "property""",
            
    "from""",
            
    "to""",
            
    "reg"false,
            
    "x"1000,
            
    "y"300,
            
    "wires": [
                [
                    
    "0265afc7b9c8811f"
                
    ]
            ]
        },
        {
            
    "id""0265afc7b9c8811f",
            
    "type""hs-device",
            
    "z""e85ae3689f64c329",
            
    "name""DailyMailUK HS4 Tweet Device",
            
    "device""7508",
            
    "server""234f285be78e0c76",
            
    "feature"0,
            
    "reportonstartup"false,
            
    "x"1170,
            
    "y"480,
            
    "wires": [
                []
            ]
        },
        {
            
    "id""afa658c0bff49c4a",
            
    "type""inject",
            
    "z""e85ae3689f64c329",
            
    "name""Inject Every 1 min",
            
    "props": [
                {
                    
    "p""payload.status",
                    
    "v""on",
                    
    "vt""str"
                
    }
            ],
            
    "repeat""60",
            
    "crontab""",
            
    "once"false,
            
    "onceDelay"0.1,
            
    "topic""",
            
    "x"150,
            
    "y"200,
            
    "wires": [
                [
                    
    "d2bdb1d4ac2d588b"
                
    ]
            ]
        },
        {
            
    "id""d2bdb1d4ac2d588b",
            
    "type""http request",
            
    "z""e85ae3689f64c329",
            
    "name""https://twstalker.com/DailyMailUK",
            
    "method""GET",
            
    "ret""txt",
            
    "paytoqs""ignore",
            
    "url""https://twstalker.com/DailyMailUK",
            
    "tls""",
            
    "persist"false,
            
    "proxy""",
            
    "insecureHTTPParser"false,
            
    "authType""",
            
    "senderr"false,
            
    "headers": [],
            
    "x"240,
            
    "y"400,
            
    "wires": [
                [
                    
    "866fae2c6fa6ddbf"
                
    ]
            ]
        },
        {
            
    "id""866fae2c6fa6ddbf",
            
    "type""html",
            
    "z""e85ae3689f64c329",
            
    "name""",
            
    "property""payload",
            
    "outproperty""payload",
            
    "tag""div.activity-descp p",
            
    "ret""text",
            
    "as""single",
            
    "x"430,
            
    "y"260,
            
    "wires": [
                [
                    
    "08eae2efca67adcc"
                
    ]
            ],
            
    "outputLabels": [
                
    "msg.payload"
            
    ]
        },
        {
            
    "id""fa295889bbad5015",
            
    "type""debug",
            
    "z""e85ae3689f64c329",
            
    "name""TwStalker DailyMailUK Tweet",
            
    "active"true,
            
    "tosidebar"true,
            
    "console"false,
            
    "tostatus"false,
            
    "complete""payload",
            
    "targetType""msg",
            
    "statusVal""",
            
    "statusType""auto",
            
    "x"1180,
            
    "y"200,
            
    "wires": []
        },
        {
            
    "id""08eae2efca67adcc",
            
    "type""change",
            
    "z""e85ae3689f64c329",
            
    "name""",
            
    "rules": [
                {
                    
    "t""set",
                    
    "p""payload",
                    
    "pt""msg",
                    
    "to""payload[0]",
                    
    "tot""msg"
                
    }
            ],
            
    "action""",
            
    "property""",
            
    "from""",
            
    "to""",
            
    "reg"false,
            
    "x"620,
            
    "y"120,
            
    "wires": [
                [
                    
    "766bc6d40b292465"
                
    ]
            ]
        },
        {
            
    "id""6f850f7e7d71541e",
            
    "type""play audio",
            
    "z""e85ae3689f64c329",
            
    "name""",
            
    "voice""7",
            
    "x"1130,
            
    "y"100,
            
    "wires": []
        },
        {
            
    "id""0007d6f4e856433f",
            
    "type""comment",
            
    "z""e85ae3689f64c329",
            
    "name""TWStalker Web Twitter Scrape",
            
    "info""",
            
    "x"170,
            
    "y"100,
            
    "wires": []
        },
        {
            
    "id""ef2650df05927672",
            
    "type""string",
            
    "z""e85ae3689f64c329",
            
    "name""",
            
    "methods": [
                {
                    
    "name""delRightMost",
                    
    "params": [
                        {
                            
    "type""str",
                            
    "value""trib"
                        
    }
                    ]
                }
            ],
            
    "prop""payload",
            
    "propout""payload",
            
    "object""msg",
            
    "objectout""msg",
            
    "x"870,
            
    "y"120,
            
    "wires": [
                [
                    
    "e13b35838490bc02",
                    
    "6f850f7e7d71541e",
                    
    "fa295889bbad5015"
                
    ]
            ]
        },
        {
            
    "id""766bc6d40b292465",
            
    "type""function",
            
    "z""e85ae3689f64c329",
            
    "name""RBE Filter",
            
    "func""// block unless value changes\n\nvar new_input = msg.payload;\nvar last_output = context.get("last_output");\n\nif (typeof last_output == 'undefined') {\n    context.set("last_output", new_input);\n    return msg; // forward initial value\n    // * return null to ignore the initial value * //\n}\n\n// otherwise last_output is defined, so did it change?\nif (new_input == last_output) {\n    return null;\n}\nelse {\n    context.set("last_output", new_input);\n    return msg;\n}",
            
    "outputs"1,
            
    "noerr"0,
            
    "initialize""",
            
    "finalize""",
            
    "libs": [],
            
    "x"730,
            
    "y"260,
            
    "wires": [
                [
                    
    "ef2650df05927672"
                
    ]
            ]
        },
        {
            
    "id""234f285be78e0c76",
            
    "type""hs-server",
            
    "name""",
            
    "host""10.168.1.21",
            
    "port""8083"
        
    }
    ]
    ​ 

    Leave a comment:


  • ksum
    replied
    You are most welcome, will40 Happy to help and would love to see the final version of possible.

    Leave a comment:


  • will40
    replied
    Karl once again you bailed me out. It appears that the report by exception node is doing the trick. If my msg payload doesn't change the remainder of the flow is ignored.

    Still testing but looks like a winner.

    Thank you!

    Leave a comment:


  • ksum
    replied
    Look at the RBE node, which I believe is now called the Filter node. It only passes the message if the data has changed. I'm away from a computer today and tomorrow. As I recall you can configure it to Kim at a specific property if the message..

    If I can get to computer that can access my Node-Red before you figure it out, I'll post an example.

    Leave a comment:


  • will40
    replied
    In my continuing efforts to create a flow to scrape a users' twitter feed I have finally got it working. At this time I have to run an inject mode at a certain interval to poll a twitter front end for the specific users' post since a conventional twitter monitor does not exist except for IFTTT.

    I am able to run the flow successfully every 10 minutes but what I would like to do is apply a filter so I am not receiving the same tweet msg every 10 mins.

    I am writing the tweet to a single line text file to try. I have it overwriting itself on each interval flow.

    What I am stumped on is how to filter and command the flow to stop or exit if the text file contains the same previous msg.

    I appreciate somebody nudging me in the right direction. Thanks

    Leave a comment:


  • will40
    replied
    Ok maybe I will save you some time and head scratching on this developer account business...I have read up on this Twitter API dev to obtain user's tweets for a few hours now.

    It appears that the free developer account credentials are good. I found a python script online to validate our dev credentials and it worked for me so I know my free tier account is active. It allows me to post a tweet and to get user info using v1 or v2 of the Twitter API.

    It also allows searching for a Twitter user using API v1.1 but neither version allow getting tweets from a user. At least not with the free tier.

    I believe I have exhausted trying to use Twitter's API's for getting a user's tweet. Time for me to move on using alternative methods....

    Leave a comment:


  • ksum
    replied
    Originally posted by will40 View Post
    After I read this is seems the dev accounts are approved pretty quick?

    Also if I read this correctly I am approved in order to access the page.

    HTML Code:
    https://developer.twitter.com/en/support/twitter-api/developer-account1
    That is what I understand and I am waiting for approval. I (think) I requested it Monday.

    Leave a comment:


  • will40
    replied
    After I read this it seems the dev accounts are approved pretty quick?

    Also if I read this correctly I am approved in order to access the page.

    HTML Code:
    https://developer.twitter.com/en/support/twitter-api/developer-account1

    Leave a comment:


  • will40
    replied
    That would be great that you trying this along side me, thanks. Yes that Youtube video was perfect. I followed it to the tee, twice in fact as I thought I did something wrong the first time so I removed the node and started over.

    I do believe the node's credentials has something to do with not acknowledging my developer account. I do not see anyway of confirming if it was ever approved but I applied for it over a month ago and started messing around with it then.

    I was able to create a project, generate an app, tokens and secret keys so I just assumed it was approved. I do not recall seeing any email anytime after after I applied from Twitter on this and I don't see a way of currently checking status in my account.

    Regarding the contrib poster's modified version I copied over as instructed in his video, I do see a difference in the Twitter Node credentials from his video to his final revised copy of files from his github. The Twitter credentials in his revised copy are now looking for the following:

    Consumer Token
    Consumer Token Secret Key
    Authentication Token
    Authentication Token Secret Key
    Bearer Token

    I regenerated my existing token and keys in my dev account and I filled in all five tokens/keys but still a no go.

    Are you able to see a restriction in your dev account that indicates you are not yet approved? This may be my issue the whole time and perhaps I was never approved.




    Leave a comment:


  • ksum
    replied
    The video for the last Twitter contrib shows some manual update process after installing. It also shows how to use the node.

    I have heard the approval for some of the access takes a couple days to a couple weeks. I have the first mentioned contrib installed and will check back with it on occasion to see if I get access. I just checked and do not yet. There are multiple authentications available and the contrib uses a mixture. What we are looking for is a V1 method and requires rights.

    Leave a comment:


  • will40
    replied
    I give up on this twitter node. I have tried multiple ways. I still get errors from Twitter stating I do not have the correct tier and I get node reference errors in my node-red log once I set up any queries in the Twitter In Node. Node Red server then crashes and won't let me run it unless I manually remove the twitter node module.

    I have retried this three times and no go.

    This contrib is from Oct 2022 and from what I have read on the web in the past few months Twitter's API has changed a lot. I can only assume at this point is that there are changes that need to be made to the node code. Well above my capabilities. I am down a few other rabbit holes at the same time

    I really do appreciate your time and suggestions to try on this. Great support in this group. I will keep searching the web for code that was written in the past month or two.

    Leave a comment:


  • will40
    replied
    Thanks Karl!

    I am digging into this other Twitter contrib now.

    Leave a comment:


  • ksum
    replied
    There is another Twiter contrib for Node-RED which is not available via the installer and may get you what you need. I do not think you need the paid version of the API. This Stream Tweets in real-time article from the developer.twitter.com site doesn't mention the need. It also links to a node.js stream sample which might prove helpful.

    If you do decide to use an Inject, you could limit it to hours you wish to receive notifications. Meaning not get them when you are sleeping, or even have a Hold device to keep them at bay while out on that anniversary date. Frankly, this may be a good idea regardless of how you set it up.

    There is also a Pushover plugin for HomeSeer if you wanted to go that route. I have no knowledge but saw a thread on it while looking at unread threads earlier today.

    Leave a comment:

Working...
X