How do you parse email?

(Michael Taylor) #1

Whenever I ask a user for an email address (in Slack) via the bot, this is what I get as a response: “<mailto:example@gmail.com|example@gmail.com>”. I don’t know how to clean this up so that I’m just saving "example@gmail.com".

(Ryan McGuinness) #2

Hi Michael,

If you use a ‘Bot-Ask a question’, with ‘text’ as the question type and ‘email address’ as the validation.

Then to parse the value, you need to use the 'text (string) - slice text) and use ‘:’ as your start text and ‘|’ as your end text. it should look like the this.

If you need anything else, please let us know :slight_smile:
Ryan.

(Michael Taylor) #3

Hey Ryan - that’s actually what I did but the output wasn’t the clean,
parsed email.

(Kellsey Shaw) #4

Hi Michael,

Slack uses formatting on the messages, which is why you are getting the email back in this format.

I think you might have missed the second point Ryan made.

“Then to parse the value, you need to use the 'text (string) - slice text) and use ‘:’ as your start text and ‘|’ as your end text. it should look like the this.”

This will get you just the email address without the formatting :thumbsup: