0

In botkit I setup message_received or any other handler. When I receive message its text property should contain actual message written by user. Unfortunately when this message contains e.g. email address I get this message slack-formatted. Example:

user enters: Hey, send an email to foo@bar.com

botkit gives me: Hey, send an email to <mailto:foo@bar.com|foo@bar.com>

Is there a way to get it in raw form, or should I do this unwrapping by hand?

Michal Ostruszka
  • 2,089
  • 2
  • 20
  • 23
  • Not a heavy botkit user, but I believe this is coming straight from Slack and botkit doesn't do any further processing on it. And I am not aware of any ways to tell Slack that you wish to receive links in a raw format. I think your best bet is to unwrap this by hand. – Wilhelm Klopp Jul 27 '16 at 20:01

1 Answers1

1

Do something like :

var matches = response.text.match(/\|.*>/)
log.info("Matches : " + matches)
if (matches) {
    mail = matches[0].substring(1, matches[0].length - 1)
    log.info("Mail : " + mail)
}
Dam
  • 231
  • 2
  • 17