Twitter crossposter
-
@jdaviescoates said in Twitter crossposter:
But this crossposted app does still have some nice features/ settings (e.g. whether or not to crosspost RTs etc) which I'd guess might be harder to replicate using N8N.
That's just a condition (IF) block to filter out RTs, etc. Easy Peazy
-
@jdaviescoates I may have spoken too soon.
n8 is working but Twitter Oauth is playing up.
Strange as it was working last night. -
@timconsidine perhaps you've hit some Twitter throttling or something? I'm pretty sure there are limits to how many calls you can do.
-
@jdaviescoates yes indeed there are.
But normally they give you a specific error message.
At least they did when I played with some PHP scripts.
The error coming back is that OAuth is not connected.
Even thought it was.
Even though I deleted and created new credentials and new connection.
I suspect a network error or a domain block.
Investigating. -
@jdaviescoates said in Twitter crossposter:
Yeah, I use the hosted version of that here:
https://crossposter.masto.donte.com.br/Yes this is cool, and I have used it before on a test basis.
I'm just trying to do same on self-hosted basis.
One of the links in original post is the source to that site
https://github.com/renatolond/mastodon-twitter-posterI'll have another bash at installing it this weekend, because as you say, it has some neat features.
-
@timconsidine I'm an idiot.
Or my browser is.
Blocks pop-ups without showing any indication of blocked pop-up. Twitter pop-up to authorise n8n app was not shown.
Switching browser showed it.
What a dumb schmuck I am ! -
@timconsidine the ongoing saga :
despite my idiocy earlier (cough, let's draw a veil over that), it seems there is a bug in n8n v0.139It seems to be a bug introduced in the latest version of n8n 0.139.1. Please downgrade to 0.138 or set the env variable N8N_USE_DEPRECATED_REQUEST_LIB=true
My Twitter node authenticates fine and posts static text, but fails to post the result of a workflow. Kinda useless in its current state. But there is a workaround, praise be to someone on high.
Just FYI in case any others are struggling as I have been.
I guess better post this and future in n9n forum, rather than here. -
@robi said in Twitter crossposter:
Why not set up an N8N workflow to take something from say RSS and post it to Twitter?
This has worked well, so thanks again.
Maybe not as full-featured as
moa
orrenatolond
But doing what I need and I think easier to maintain in future.Need to add x-post a mastodon image and to add a schedule for repeating running every x hours.
-
@timconsidine So this is after the config tweak?
Yes, images/videos would be a useful/required thing.
Why are there two twitter accounts?
-
@robi yes, I set the environment variable rather than downgrade.
And then it just sailed through.The 1st twitter account is more of an organisation account and the 2nd twitter account is an individual account.
I mostly wanted to test that I could auto-RT another account.
TheSet1
grabs the tweet id returned by Twitter on posting, and the 2nd account RT's that tweet id.
Not hugely useful but I wanted to prove it could be done.
TheWait
is just to provide an 'air gap' of sorts in case it all goes through too quickly for systems to cope.Images are now added.
Docs/forum sayHTTP Request
node needed for that.And as the RSS feed returns a list of toots, I needed to avoid duplicate posts. So I added an
IF
node which tests if a toot is older than xxx milliseconds (5 mins in my case), and only continues if it is newer. If none newer, the flow expires (no false tree set up).Now I just need to add a
cron
orscheduler
node.
But leaving it manual firing for now to test edge cases which different content might show errors on. -
@robi said in Twitter crossposter:
I'd like to connect Insta posting to Twitter posting and not necessarily from the same account(s)
I don't use Instagram but ironically just found one of my 'persons of interest' does, and mostly tweets links to Insta posts. So you have to follow them to see content. So I may look into this.
Brief research shows you can use Bibliogram to get an RSS feed of Instagram posts from an Insta account. Based on that, it seems at first glance that it is possible to use similar workflow to my Mastodon2Twitter to achieve that.
I tried briefly to self-host Bibliogram but installation failed, so as Instagram is low usage for me, I'm just using a hosted Bibliogram (https://bibliogram.snopyta.org/) to give me the RSS feed.
EDIT : just seen Bibliogram is a supported app on Yunohost. I don't have a Yunohost server .... yet !
-
@timconsidine Beautiful, nice find on bibliogram.
I was looking at other such services and Nitter showed up, with a bit more understanding of why it exists as described here:
https://nitter.1d4.us/aboutThis also means that if you replace your Twitter node with a Nitter node, you'll likely have a better experience posting to Twitter. (no rate limits of dev account required)
-
@robi said in Twitter crossposter:
if you replace your Twitter node with a Nitter node
oooo, didn't know I could do that !
I also noticed RSS-Bridge supports an Instagram feed, but haven't played with it yet.
-
@timconsidine I may be wrong as so far it seems as a read-only config, not sure if one can post to Twitter as well.
-
@robi I don't think you can post via Nitter, it is has no login, just read-only.
But your post made me think because as you say, the dev accounts have rate limits.
Limits are not so bad, but they're there, and for some use cases, could be a problem, e.g. analysis and "tweet intelligence".
My current n8n is great for posting, and I won't hit rate limits.
But for other use, a lot of tweet fetching might.
That's where Nitter can come into play. -
@timconsidine https://github.com/FriendsOfREDAXO/feeds might be good intermediary step so you get nice RSS feeds for N8N.
-
@timconsidine Hey, I'm trying to achieve a similar scenario but I'm not getting far, would you by any chance share your n8n workflow ?
-
@rmdes here is my n8n workflow for taking an RSS feed from a mastodon user and posting that to twitter
It can sure be made more sophisticated but it works in basic form
Main point is that it requires a Twitter OAuth login, which is usually (always?) obtained by having a Twitter API registration which gives you the credentials needed to be input in your n8n.
It is not your normal Twitter login.Getting a Twitter API account is not difficult but it's not entirely straight forward. They seem to randomly accept/reject for unclear reasons. But if you have one already or are patient to go through the process, you should be good to go.
Cam't seem to attach a file so you may have to copy/paste this into a .json file and then import that into your new n8n workflow.
{ "name": "mastodon2twitter", "nodes": [ { "parameters": {}, "name": "Start", "type": "n8n-nodes-base.start", "typeVersion": 1, "position": [ -10, 30 ] }, { "parameters": { "url": "https://mastodon.domain/users/username" }, "name": "RSS Feed Read", "type": "n8n-nodes-base.rssFeedRead", "typeVersion": 1, "position": [ 160, 30 ], "notesInFlow": false, "notes": "account username" }, { "parameters": { "values": { "string": [ { "name": "tweetString", "value": "={{$json[\"contentSnippet\"]}}" } ] }, "options": {} }, "name": "Set", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [ 320, 30 ], "notesInFlow": true, "notes": "compose tweetString" }, { "parameters": { "functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n// Loop over inputs \n\nvar date_run = new Date();\ncnt=0;\nfor (item of items) {\n var item_date = new Date(item.json.isoDate);\n if (date_run - item_date > 300000) {\n //delete items[cnt];\n item.json.tweetString = \"expired\";\n } \n cnt++;\n}\n\n//items.length = 1;\n\n// You can write logs to the browser console\n//console.log('Done!');\n\nreturn items;\n\n" }, "name": "Function", "type": "n8n-nodes-base.function", "typeVersion": 1, "position": [ 490, 30 ], "notesInFlow": true, "notes": "set tweet expired if >5m" }, { "parameters": { "conditions": { "string": [ { "value1": "={{$json[\"tweetString\"]}}", "operation": "notEqual", "value2": "expired" } ] }, "combineOperation": "any" }, "name": "IF", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [ 650, 40 ], "notesInFlow": true, "notes": "check not expired" }, { "parameters": { "url": "={{$json[\"enclosure\"][\"url\"]}}", "responseFormat": "file", "options": {} }, "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [ 910, -50 ] }, { "parameters": { "text": "={{$node[\"Set\"].json[\"tweetString\"]}}", "additionalFields": { "attachments": "data" } }, "name": "Twitter", "type": "n8n-nodes-base.twitter", "typeVersion": 1, "position": [ 1110, -50 ], "notesInFlow": false, "credentials": { "twitterOAuth1Api": "Twitter OAuth account" }, "notes": "twitter" }, { "parameters": { "triggerTimes": { "item": [ { "mode": "everyX", "value": 5, "unit": "minutes" } ] } }, "name": "Cron", "type": "n8n-nodes-base.cron", "typeVersion": 1, "position": [ -20, -130 ], "notesInFlow": true, "notes": "each 5m" } ], "connections": { "RSS Feed Read": { "main": [ [ { "node": "Set", "type": "main", "index": 0 } ] ] }, "Set": { "main": [ [ { "node": "Function", "type": "main", "index": 0 } ] ] }, "Function": { "main": [ [ { "node": "IF", "type": "main", "index": 0 } ] ] }, "IF": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Twitter_2", "type": "main", "index": 0 } ] ] }, "Cron": { "main": [ [ { "node": "RSS Feed Read", "type": "main", "index": 0 } ] ] } }, "active": true, "settings": { "saveExecutionProgress": true, "saveManualExecutions": true }, "id": 6 }
218 lines long so be sure to copy all, or send me DM to try to exchange the file