How do I escape the value of an email subject when using a web hook?

I have a Make scenario that allows me to send an email to a Make custom mailhook which then sends the contents of my email to an Obsidian.md webhook.

My make scenario saves the email sent to a specified folder and names my note with the name of the email’s subject line like so: emailed/{{1.subject}}.md

This works most of the time but if the subject contains a hyphen or an emoji, this will cause my scenario fail and will require me to delete the failed attempt and turn my scenario back on.

How do I escape the value of the {{1.subject}} that is sent to my webhook?

Hi. You can try using the “replace” function for common cases and remove special characters, emojis, hyphens, etc., or create a regular expression for it. Do you have an example of a subject line with these special characters and what you want the final result to be?


Thanks, Helio!
Wemakefuture
If you have questions reach out :wink:

1 Like

Any subject line with a “-“ will cause my scenario to crash and require manual deletion of the failed scenario. It looks like emoji will do it too but - are way more common.

Would you mind linking to documentation of the replace functionality? I’m very new to Make.

replace can be found on this page about half way down. You’ll have to replace each instance that is causing you issues:

https://www.make.com/en/help/functions/string-functions

replace({{1.subject}};-;EMPTYSTRING)

Empty string is actually a variable you have to use (or you could use “_” since that shouldn’t mess with your filename):

image

If you have multiple things you want to replace, you will need to nest the replace function (I’d probably start with “:”, “.”, “(” and “)” if you know those are giving you a headache).

replace(replace({{1.subject}};-;EMPTYSTRING);:;EMPTYSTRING)

Hope that helps…

Thank you so much. I would’ve never figured this out on my own.