Slack ngrok multiple entries for one message sent, delay in response, missing response

rasa-core
(Ashhad) #1

I have integrated my chatbot with slack. When I send simple messages like “hi” the response come quick and smooth.

But when some actions are involved, things get a little weird. For example, in the following bot where I am looking for restaurants, when the bot tries to make an api call to zomato, to get the restaurants suitable to my criteria, it never gives the response back to slack.

This image may add clarity

If you see this image, for a single message of mine in slack, slack is hitting my ngrok endpoint multiple times.

Also, after I wait for a while, ngrok shows that the requests have been handled but I never get the response.

This image shows the same - I wait for long, ngrok is finished with responding yet no response in slack.

Here is the code for app

from rasa_core.channels.slack import SlackInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
import yaml
from rasa_core.utils import EndpointConfig

nlu_interpreter = RasaNLUInterpreter('./models/current/nlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/current/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint)

input_channel = SlackInput('xoxb-609656943046-599490439985-37Q7nhNcH2plLlkrSSWKGDom' #your bot user authentication token
                           )
agent.handle_channels([input_channel], 5004, serve_forever=True)

The bot is working fine on command line. Any help would be appreciated.

(Ella Rohm-Ensing) #2

Hey @ashhadulislam. I don’t think the multiple hits on ngrok are much to worry about, since the ngrok is hooked up to your core server, both your slack endpoint and your actions endpoint hit on the core server, so you’ll see more requests if you’re running a custom action.

What does your action server look like when this happens? Have you tried running the action server in debug mode?

(Tuanvuvo) #3

I have same problem when typing one message in slack and get three back. No in telegram

(Ella Rohm-Ensing) #4

Yes @tuanvuvo I believe that the issue is that slack has a timeout mechanism that will re-try if it doesn’t receive a message in time. So if your action takes too long, it can post multiple times or it may not post at all. We’re looking into fixing that at the moment. Relevant github issue here: https://github.com/RasaHQ/rasa/issues/3569

1 Like
(Tuanvuvo) #5

Thanks @erohmensing