WAS Slackbot Integration from WAS Landing Page errors when following the instructions

110 Views Asked by At

"https://watson-personal-assistant.github.io/developer/further-topics/slackbot-integration/"

I am not able to make it work by following the steps on WAS Slack Bot Integration (above link).

  1. My slack setting should be ok as I tried use the same ID and API token to connect to another program successfully.

  2. I installed Python 3.7 initially, but downgrading to 3.6.2 as document suggested

  3. "python3 bot.py" results as following - with exception stack

    Forests-MacBook-Pro:simple_WA_slackbot fmlin$ python3 bot.py
    Not On Bluemix...
    Environment Variables Loaded Successfully
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/slackclient/server.py", line 179, in connect_slack_websocket
        http_proxy_auth=proxy_auth)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 494, in create_connection
        websock.connect(url, **options)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 217, in connect
        options.pop('socket', None))
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_http.py", line 126, in connect
        sock = _ssl_socket(sock, options.sslopt, hostname)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_http.py", line 253, in _ssl_socket
        sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_http.py", line 232, in _wrap_sni_socket
        server_hostname=hostname,
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
        _context=self, _session=session)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
        self.do_handshake()
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
        self._sslobj.do_handshake()
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
    

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/slackclient/client.py", line 52, in rtm_connect
    self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/slackclient/server.py", line 147, in rtm_connect
    self.connect_slack_websocket(self.ws_url)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/slackclient/server.py", line 186, in connect_slack_websocket
    raise SlackConnectionError(message=str(e))
slackclient.server.SlackConnectionError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
Connection failed. Invalid Slack token or bot ID?
Forests-MacBook-Pro:simple_WA_slackbot fmlin$ 
2

There are 2 best solutions below

0
On

Make sure you used the right Bot ID?

Did you set the user environment variable BOT_ID in the .env file?

Did you properly create the bot in slack using the instructions in the instructions https://github.com/Watson-Personal-Assistant/simple_WA_slackbot

Getting Your Slack Key

Go to https://YOUR_SLACK.slack.com/apps/manage
In the Search App Directory field at the top, type Bots
Click on Bots
Click on the Add Configuration button
Give your bot a unique username (Save this info)
Save the API Token
You will use these variables when creating your .env file as instructed in the below steps
1
On

Try running the /Applications/Python 3.6.2/Install Certificates.command program to install the root certificates needed to validate SSL connections, as it looks like your Python installation's SSL certificate verification is failing.

See more information about this program here.