1

I'm building a slack bot. You feed my bot several info, including an email address, and it sends the data through an outgoing webhook.

The problem is that if I give my bot the required info, the http request returns this (exemple) :

{"name":"Alexandre","email":"<mailto:test@gmail.com|test@gmail.com>","test":"hello world"}

This sucks, because the server catching the hook (zapier) cannot interpret the mailto: with the brackets. This message formatting is something slack does automatically. Any ideas on how I can remove message formatting for URLs and emails ?

Thanks !

Francois
  • 21
  • 7

2 Answers2

0

I would suggest passing the argument parse as none, according to https://api.slack.com/docs/formatting.

0

I don't know if you've fixed this issue. I just encountered the same problem. I built my slackbot using Python and I created a method to get rid of the "mailto". This might not be the answer that you are looking for, but hopefully it gives some insight:

def unformat_message(param):
    while param.count('mailto') >= 1:
        mailto_position_at_param = param.find("<mailto")
        end_of_mailto_position_at_param = param.find("com>")
        taken_email_position = param.find("com|")
        if mailto_position_at_param != -1 and end_of_mailto_position_at_param != -1 and taken_email_position != -1:
          old_string = param[mailto_index:end_mailto_index+4]
          new_string = param[mailto_index+8:email_index+3]
          param = param.replace(old_string,new_string)
    return param
bohr
  • 631
  • 2
  • 9
  • 29