Agent.handle_message gives me none

agent.handle_message("hi") gives me a

None

result.

I loaded RasaNLUInterpreter and Agent correctly. For RasaNLUInterpreter import, i gave nlu path and for Agent.load() i gave model core path.

Hi! Can you post your whole code please, as well as the versions you are using? This is important information for debugging since things have change (notably the introduction of async)

I’ve just received the information you gave about wanting to integrate your bot with slack after successfully using rasa shell and rasa train. That’s great! This isn’t the way to do it. Have you looked at the instructions here? Slack

hi @erohmensing actually first i tried a custom one where i create an agent and the i handled a channel. Below is my code.

Rasa 1.1.7 Python 3.6.8 64bit Pip 3

from rasa.core.channels.slack import

from rasa.core.agent import Agent

from rasa.core.interpreter import RasaNLUInterpreter

import yaml

from rasa.utils.endpoints import EndpointConfig

nlu_interpreter = RasaNLUInterpreter('./models/20190730-143614/nlu')

action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")

agent = Agent.load('./models/20190730-143614/core', interpreter = nlu_interpreter, action_endpoint = action_endpoint)

input_channel = SlackInput('my_slack_key')

agent.handle_channels([input_channel], http_port=5004) In here i tried to add serve_forever=True parameter, but it is invalid for my version i guess.

This is my code and i used opened ngrok and from that i opened 5004 port. Then i provided my ngrok link to slack event subscriptions request url and i provided message.im bot event with app_mention.

Then i started my action server using rasa run actions and i ran my above custom code and then i tried to talk to my bot using slack. But no response. (i created a bot app in slack named sample bot)

my ngrok console shows me POST /webhooks/slack/webhook 200 OK status

image

Thas my whole story @erohmensing :slight_smile:

Can you just run the bot with rasa run --connector slack with the credentials in your credentials.yml instead of that custom code? This is the recommended way to do this. Then you have access to all the logs for better debugging (it’s possible that the bot is responding, but predicting action_listen)

@erohmensing okay, than can you please tell me where should i put this in slack

http://localhost:5005/webhooks/slack/webhook

Did you follow the instructions and set up a slack app? the webhook url goes in the Event Subscriptions tab – however the ngrok server is the url that will go in slack.

okay, I’ll check that :slight_smile: Thank you for the asnwer @erohmensing

Sure thing :slight_smile: