Flow Custom Function to remove text from @email.com

Flow Custom Function to remove text from @email.com

I am using Flow to automatically send a slack notification when a new row is added to a google sheet.

One of the fields in the sheet is email address but I don't want to send through the whole email address to the slack notification. Ideally just the text before @.

I believe I have to create a custom function with prefix but I don't seem to be able to get the code to work. 

Can anyone help?