Rss to Twitter with Image

Hey guys,
I have been able to setup Rss posts to twitter where I share new posts on my RSS to twitter.N8n is working very well with items like the post title and post links. However, my posts also have images and so far I have failed to embed an image from my rss to my twitter. Please help me.

Hi @Collin_Mutambo,

welcome to the community.
In order to use media within a Tweet it needs to be uploaded via a separate endpoint to Twitter. Unfortunately this seems to be not implemented in the current n8n Twitter node. It might be worth to propose this as a feature request.
Same applies for the other way round, if you like to get an image from a Tweet.

Thanks a lot @ixidion but it is actually already possible to post a tweet with an image. You just first have to download the image.

Here an example workflow:

2 Likes

Jan,
Thanks for the reply. Looks like the image woulld have to be taken from a direct URL. When the image is part of the post items in an RSS feed, it becomes a bit tricky.

Then you need to transform the Feed-XML to JSON and afterwards you can get the Image-URL easily. XML-Node is your friend then.

1 Like

Hello,

Is it possible that you share your workflow please ?

How would I do that? Any workflow? Tried many times but failed

Hi @jan I haven’t had any luck with this. Looks like the rss feed image link just won’t get you a twitter image preview. Somehow this has failed for me. I get a the text post well from title and description in the rss feed, but image just posts a link on Twitter.

Did you check out the workflow above?

There it shows what you have to do. You have to download the image first with the HTTP Request node and add it as an attachment. If you say you get a link, it sounds to me like you are not doing as described. Because Twitter would like that never get a link it could display.

I tried this workflow. It doesnt work with my rss feed https://www.hot100.ug:1201/telegram/channel/radiosimba. I tried to extract the image link for the posts even using Feed-XML to json with no luck ? I added the rss feed to the XML node to try and transform to json. I get the error “ERROR: No json property “https://www.hot100.ug:1201/telegram/channel/radiosimba” does not exists on item!”

@jan Any pointers ? I got stuck.

Hey @Collin_Mutambo!

Are you receiving XML data from your RSS Feed? I tried to make a call to the link you shared but looks like it doesn’t work.

Can you share what data gets returned?

The RSS link had frozen and I restarted the feed. Its available now. However, when I insert the url of my rss feed in the Xml to Json node, I get the following error;

ERROR: No json property " https://www.hot100.ug:1201/telegram/channel/radiosimba" does not exists on item!

Error: No json property " https://www.hot100.ug:1201/telegram/channel/radiosimba" does not exists on item!
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Xml.node.js:226:27)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:490:37)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:370:62
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:15
    at /usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:61:11
    at new Promise (<anonymous>)
    at new PCancelable (/usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:31:19)
    at WorkflowExecute.processRunExecutionData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:297:16)
    at WorkflowExecute.runPartialWorkflow (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:134:21)
    at WorkflowRunnerProcess.runWorkflow (/usr/local/lib/node_modules/n8n/dist/src/WorkflowRunnerProcess.js:52:41)

Thanks! I am now getting a response.

The XML node accepts an XML data. The node won’t make the API call. It simply converts the data. You will have to use the HTTP Request node, with the Response Format set to ‘String’.

You can also use the RSS Feed Read node that gives you a JSON object that you can use.

Great. Thanks for the help. However, the json objects I am getting do not give me a direct image link, for example something like http://example.com/imagefile.jp but gives me a telegram post link (since my rss feed is sourced from my telegram channel). I am assuming a workflows like this;

I’ve created a workflow that might help. This workflow uses the RSS Read node to get information from your RSS URL. Next, I am using the HTML Extract node to extract the image source. I found out that not all the posts have an image. So I am using an IF node to check if image is present or not. If there is an image (false branch of the IF node), we make an HTTP Request to download the image. The next step you will have to take is to add the Twitter node and as suggested earlier, select the Attachments option.

Hope this helps!

Looking good. I get the following error in the IF node

Problem executing workflow

There was a problem executing the workflow:
"compareOperationFunctions[compareData.operation] is not a function"

Secondly, each post has its own image. Should I have a seperate workflow for each --Image and Text part of the post ?

OK, I changed the IF node operation to NOT CONTAINS and that corrected. But that leaves the twitter node with the error;

There was a problem executing the workflow:
“No binary data set. So file can not be written!”

Hey Colin,

Are you connecting the Twitter node with the right output of the IF node? If there are any nodes in between the IF node and the Twitter node, is the binary data still accessible by the Twitter node?

This is the workflow I have. The text part works perfect. I connected two arrows from rss feed with one for the text posts and the other for the image section. I get the error There was a problem executing the workflow:
"No binary data set. So file can not be written!"