I have a Mattermost site running locally and exposed at localhost:8065. I have a Rasa instance running rasa run --debug locally as well, exposed as localhost:5005. I created an outgoing webhook in Mattermost according to your doc at: https://rasa.com/docs/rasa/user-guide/connectors/mattermost/#getting-credentials and set the Callback URL to http://localhost:5005/webhooks/mattermost/webhook.
Does that mean I need to edit the credentials.yml, mattermost section to look like:
2019-10-10 15:23:46 ERROR rasa.core.channels.mattermost - Exception when trying to handle message.'token'
2019-10-10 15:23:46 DEBUG rasa.core.channels.mattermost - 'token'
Traceback (most recent call last):
File "c:\programdata\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\mattermost.py", line 98, in webhook
self.url, self.team, self.user, self.pw, self.bot_channel
File "c:\programdata\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\mattermost.py", line 27, in __init__
super(MattermostBot, self).login(user, pw)
File "c:\programdata\anaconda3\envs\rasa\lib\site-packages\mattermostwrapper\wrapper.py", line 39, in login
self.token = p.headers["Token"] # Store the token for further requests
File "c:\programdata\anaconda3\envs\rasa\lib\site-packages\requests\structures.py", line 52, in __getitem__
return self._store[key.lower()][1]
KeyError: 'token'
and no response from the bot.So something is being sent to rasa (I’m trying to find the exact json) and rasa is choking on it.
So I can try to take a look at this, I wrote the mattermost wrapper that is used but I also haven’t updated it in a while so this could be related to Mattermost updates as well.
Give me a few days and I’ll test my wrapper code to ensure it isn’t the issue here either. I’m assuming you never have had this working yet?
Thank you. The logs appear to indicate that Rasa is receiving some input from the webhook, but is unable to interpret it. Any tips for debugging that I can do on my own?
Nothing immediately comes to mind I haven’t tested out the mattermost wrapper I wrote in a while so its very possible something has changed. I just need to get my server up again and test it.
Is there some more setup to do? I have setup a debug environment in Pycharm and with Postman I can call and trace a GET /webhooks/rest and a POST to /webhooks/rest/webhook. But a similar call to GET /webhooks/mattermost does not get to
So I tested my wrapper and it still works fine here is how I setup my bot and as you can see from the screenshot it works.
I just spun up the basic docker mattermost via:
docker run --name mattermost-preview -d --publish 8065:8065 mattermost/mattermost-preview - Now I have a instance running at whatever my ip/localhost:8065
Then I created the outgoing webhook (I’m also going to look into these new bot account options they have soon) with the following callback url, I just used my ip of my machine:
Ok. I configured my Rasa environment to match yours above and got the debugger working so I can trace through the mattermost connection. It turned out that I wasn’t invoking the debugger with the
--credentials switch. Now I can trace the code from the log:
2019-10-17 11:54:36 ERROR rasa.core.channels.mattermost - Exception when trying to handle message.'token'
2019-10-17 11:54:36 DEBUG rasa.core.channels.mattermost - 'token'
Traceback (most recent call last):
File "C:\Users\willic38\Documents\rasa\rasa\rasa\core\channels\mattermost.py", line 173, in message_with_trigger_word
self.webhook_url,
File "C:\Users\willic38\Documents\rasa\rasa\rasa\core\channels\mattermost.py", line 44, in __init__
super(MattermostBot, self).login(user, pw)
File "C:\ProgramData\Anaconda3\envs\rasa\lib\site-packages\mattermostwrapper\wrapper.py", line 39, in login
self.token = p.headers["Token"] # Store the token for further requests
File "C:\ProgramData\Anaconda3\envs\rasa\lib\site-packages\requests\structures.py", line 52, in __getitem__
return self._store[key.lower()][1]
KeyError: 'token'
It looks like it’s failing to login. The POST is returning a 401.
So this wasn’t all a total waste. I have figured out how to debug rasa in Pycharm and you can close this ticket.
I will try and follow up with an article with the important points for setting up the debug environment.
Hi charles
i have some issue when intergrate rasabot with mattermost. it alway return log is connection refuse. Can you help me This is my setting. i cannot understand why my bot cannot connect
oh. i’m sorry. Because of i see your example that it have no webhook_url so i commented out that line. But now everything it’s ok. i have some problem with the ip in docker. i spent many time on it with the support from my partners.
Thank you so much for reply
oh i just config the webhook url with the ip inside docker. in this case that cannot be the localhost and i have to go inside docker and find. finally it worked
i know im late to the party but im getting problems with this too.
rasax.community.api.blueprints.interface - Answered 404 with index.html. Request url '/': 'http://192.168.254.89:5002/webhooks/mattermost/webhook'
every time i @ bot i see this in my rasax debug window. dont know why and bot dont reply in mattermost.
in credential i have specified similar to the above guys config… username as email and password…
I also tried webhook url and token with bot but same thing…
In mattermost i get this error in server logs
{"level":"error","ts":1620312841.696581,"caller":"app/notification_email.go:106","msg":"Error while sending the email","user_email":"batja@localhost","error":"unable to connect to the SMTP server: dial tcp 127.0.0.1:10025: connect: connection refused","errorVerbose":"dial tcp 127.0.0.1:10025: connect: connection refused\nunable to connect to the SMTP server\ngithub.com/mattermost/mattermost-server/v5/services/mailservice.ConnectToSMTPServerAdvanced\n\tgithub.com/mattermost/mattermost-server/v5/services/mailservice/mail.go:142\ngithub.com/mattermost/mattermost-server/v5/services/mailservice.ConnectToSMTPServer\n\tgithub.com/mattermost/mattermost-server/v5/services/mailservice/mail.go:150\ngithub.com/mattermost/mattermost-server/v5/services/mailservice.sendMailUsingConfigAdvanced\n\tgithub.com/mattermost/mattermost-server/v5/services/mailservice/mail.go:265\ngithub.com/mattermost/mattermost-server/v5/services/mailservice.SendMailWithEmbeddedFilesUsingConfig\n\tgithub.com/mattermost/mattermost-server/v5/services/mailservice/mail.go:252\ngithub.com/mattermost/mattermost-server/v5/services/mailservice.SendMailUsingConfig\n\tgithub.com/mattermost/mattermost-server/v5/services/mailservice/mail.go:256\ngithub.com/mattermost/mattermost-server/v5/app.(*EmailService).sendMailWithCC\n\tgithub.com/mattermost/mattermost-server/v5/app/email.go:702\ngithub.com/mattermost/mattermost-server/v5/app.(*EmailService).sendMail\n\tgithub.com/mattermost/mattermost-server/v5/app/email.go:695\ngithub.com/mattermost/mattermost-server/v5/app.(*EmailService).sendNotificationMail\n\tgithub.com/mattermost/mattermost-server/v5/app/email.go:691\ngithub.com/mattermost/mattermost-server/v5/app.(*App).sendNotificationEmail.func1\n\tgithub.com/mattermost/mattermost-server/v5/app/notification_email.go:105\ngithub.com/mattermost/mattermost-server/v5/app.(*Server).Go.func1\n\tgithub.com/mattermost/mattermost-server/v5/app/server.go:973\nruntime.goexit\n\truntime/asm_amd64.s:1374"}
{"level":"error","ts":1620312841.7031543,"caller":"app/webhook.go:112","msg":"Event POST failed.","error":"invalid character '<' looking for beginning of value"}
I am having the behaviour that I am tying to use the Helpdesk Assistant, everything seems correctly configured, I get no error but is not sending anything to the channel.
Using a curl to test the POST to mattermost works.
Usin a curl to sent to mattemost webhook of rasa results in