SLACK <> Create New Channel <> Replace Spaces with Dashes

:us: Hello Community,

I’m an absolute beginner with Make.com and JavaScript, and I’m facing the issue of not knowing how to replace spaces with dashes in the channel name when creating a Slack channel.

The post and solution here (SLACK <> creating new channel <> Error: invalid_name_specials (200) - #5 by samliew) have already helped me a lot, but I would also like to insert a dash instead of removing spaces. So far, I’ve used the following:

{{replace(lower(1.identifier + 1.name); "/[^a-z0-9]+/g"; emptystring)}}

This works (the “1.identifier + 1.name” comes from our CRM), but it only removes the spaces.

What do I need to insert, where, and why to make this work? I would really appreciate any help!

Best regards



Hallo Community,

ich bin ein absoluter Beginner in make.com und JavaScript und stehe vor dem Problem, dass ich nicht weiß, wie man beim Erstellen eines Slack-Kanal im Channel-Namen die Leerzeichen durch einen Bindestrich ersetzt. Mir hat der Beitrag und die Lösung hier (SLACK <> creating new channel <> Error: invalid_name_specials (200) - #5 by samliew) schon sehr weitergeholfen, allerdings möchte ich zusätzlich noch anstatt Leerzeichen einen Bindestrich einfügen. Folgendes habe ich bis jetzt eingesetzt:

{{replace(lower(1.identifier + 1.name); “/[^a-z0-9]+/g”; emptystring)}}

Das funktioniert auch so (“1.identifier + 1.name” kommen aus unserem CRM), allerdings werden die Leerzeichen nur entfernt.

Was muss ich wie, wo und warum einfügen?! Über eine Hilfe wäre ich sehr dankbar!

Grüße

Hi @Boris1,

Welcome to the Make community! Could you try to communicate in English, so that everyone here has the opportunity to help you?

Could you also share the input bundles that you are processing?

As for the function that you shared, it seems like you have a combined input of an identifier and name, in which you replace any other character that is not a lowercase letter with an emptystring. An emptystring is a null value, so the result is… nothing. You can try to use - instead. Also, the regex should not be in quotes.

Cheers,
Henk
Certified Make Expert and Partner

Hi Henk,

Thank you for your reply. I have tested your suggestion, but unfortunately it still doesn’t work. I have now added the following:

{{replace(lower(1.identifier + 1.name); /[^a-z0-9]+/g; -)}}

In Slack, it now creates the folder with the following name:

mue2409289beautybabyftestfolder

But it should be created like this:

mue-2409289-beautybabyf-testordner

The input is the following:

MUE-2409290 BeautyBabyF testfolder
(MUE-2409290=1.identifier / BeautyBabyF testfolder=1.name)

Thanks for your help!

Cheers Boris

The regex works, but you should still place a space between the identifier and the name. Also, if you copy and paste a formula as regular text, then this forum might change the formatting. It is best to paste it in a code block by using backticks (`).

As for the solution:

{
        "identifier": "MUE-2409290",
        "name": "BeautyBabyF testfolder"
}

I used the input above in the following formula:

And the result is:

You can copy and paste this and replace the references to your modules:

{{replace(lower(28.identifier + space + 28.name); "/[^a-z0-9]+/g"; "-")}}

Does that work for you?

Cheers,
Henk

Hi Henk,

Thank you very much! That worked :+1:

One more question: Is it possible to use a router in such a way that it does not split one route into several, but that the router combines several routes into one again?

I should now repeat the path marked in red on the screenshot for approx. 10-11 routes.

Or is there another solution for this?

Cheers Boris

Great that it worked!

And unfortunately, no… It is a highly requested feature to merge routes again. Actually, it is the topmost requested feature: https://www.make.com/en/platform-ideas/p/flow-control-converger-merge

Cheers,
Henk

ok, too bad, thank you very much and have a nice evening!

Cheers Boris