Telegram to mastodon text limit

Hello everyone, I’m very new to make and not skilled in programming.

I’m trying to fetch content from a public telegram channel and post it to a mastodon account.
I’m succeeded to make the two modules to work: the Watch Update Telegram receive the content and sends it to the Mastodon Create Status module.

The only problem is to trim or truncate the text since the Mastodon server I need has a character limit to 840.

I’ve tried to add a substring function in the “Status” field, like that:

{{substring(3.message.text; 0; 300)}}...

where the 3.message.text is the API variable from Telegram module available for posting the status on Mastodon.

Unfortunately it doesn’t return anything and I’m stuck to understand on how to use functions in Make.

Thanks for any help

I found it!
For people struggling with this:

I added a module of type “Tools” , configured it with a “set variable” (one cycle) in the variable value I added the Channel Post: text shortcut (this fix a previous mistake of mine, calling instead the text from the Message and not from the Channel Post) as following:

{{substring(3.channel_post.text; 0; 300)}}

then passed it to the Mastodon module

:slight_smile:

2 Likes

That could truncate text in the middle of words. You might want to wrap it with another function to remove the last word from the result, truncated or not.

{{replace(substring(3.channel_post.text; 0; 300); /\s.*?$/; emptystring)}}

3 Likes

Super!
Thank you samliew, I’m new to the community, but I guess I should accept your answer :slight_smile:

3 Likes