I’m sending emails to Notion, as page content and Notion’s API only allows 2,000 characters to be included in a rich text object. So I need to break the email content down into an array of strings, where each string is the next 2,000 characters from the email.
I know that I can use slice() to get characters from a string but I’m not sure how to loop through each block of 2,000 characters and store those as an array.
I need to be able to format each block of content as:
Thanks for this, I was hoping to avoid Regex because it can be a little bit unpredictable but if there’s no way to do this with Make’s other functions then it looks like that should work for me.
As mentioned previously, you can use the substring function, and repeater alongside either a Text Aggregerator or Create JSON module to get the JSON format that you are seeking.
Thanks for sharing this Blueprint, that works great.
In the end, I realised that splitting the text into 2,000 character chunks isn’t a great idea because it would mean that some paragraphs would be split into two separate blocks, when they’re added to the Notion page.
So instead, I’m assuming that my paragraphs will be less than 2,000 characters and creating 1 block per paragraph.