Twitter error response [403]: Tweet needs to be a bit shorter

Hey guys, is there an easy fix to this?

Error: Twitter error response [403]: Tweet needs to be a bit shorter.
    at Object.twitterApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Twitter/GenericFunctions.js:30:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is there a code I can add to the “Text” field to limit the characters?

I’m posting content from instagram (captured by RSS) and twitting it directly.

Thanks a lot!

Welcome to the community @EB_BR!

You can use any JavaScript function in n8n expression. So in this case using something like .slice(0, 280) would be the easiest.

Doing that an expression could look like this:

{{ $json["message"].slice(0, 280) }}
2 Likes

Jan I am new to n8n, running it using docker. Please where do I insert this in the twitter node ? I cant figure out this out. My tweets are coming from an RSS feed.

You would do that in the Expression you have set on the “Text” property on the Twitter-Node.

Thanks. However, I already have the following in my text expression, which is content and links picked from the rss feed link from my rss node. In the two images, the first one shows when I click the parameters of the “text” property. The second image shows the “text” property filled with a post item picked from my rss node. Can’t figure this one out.

I have the following when I click “text” property
{{$node[“RSS Feed Read”].json[“contentSnippet”]}} {{$node[“RSS Feed Read”].json[“link”]}}

In this case you have to set it to:

{{ ($node["RSS Feed Read"].json["contentSnippet"] + ' ' + $node["RSS Feed Read"].json["link"]).slice(0, 280) }}
1 Like

Excellent. Works like a beautiful charm. Thank you.

2 Likes

Sure, happy if it helped! Have fun!