Mastering String Splitting for Notion API: A Guide for Make.com Users

Have you ever faced the challenge of sending emails to Notion, where the API only allows 2,000 characters to be included in a rich text object? If so, you're not alone. This is a common issue that many Make.com users face. The solution is to break the email content down into an array of strings, where each string is the next 2,000 characters from the email.

One way to do this is by using the slice() function to get characters from a string. However, the challenge lies in looping through each block of 2,000 characters and storing those as an array. The goal is to format each block of content in a specific way so that it can be added to the Notion page using the Append A Page Content module.

Step-by-Step Solution

One solution to this problem is to use regex to get several bundles. To get the last characters, you have to get the length of the string and substring the last characters which were not inside the regex bundles.

However, if you're not comfortable with regex, there's another solution. You can use the iterator to fill an array and the array aggregator to join them again. This method might be a bit more complex, but it's a viable alternative if you want to avoid regex.

Troubleshooting Tips

If you're still having trouble, remember that you can use the substring function, and repeater alongside either a Text Aggregator or Create JSON module to get the JSON format that you are seeking. However, using regex as suggested previously will be a lot cleaner and easier.

Conclusion

In conclusion, splitting the text into 2,000 character chunks isn’t always the best 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, it's better to assume that your paragraphs will be less than 2,000 characters and create one block per paragraph. This way, you can ensure that your content is properly formatted and ready to be added to your Notion page.

You do have further questions?

Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.