I have recently configured my bot for Slack integration.
It is working fine for general utter messages like “Hi” and sending a response back to Slack channel.
But when there is an action for custom action server, the bot does not send message to slack.
Observations -
Intent is recognized correctly.
Custom action is triggered successfully.
The reply can be seen on rasa run debug logs but does not get sent to slack channel.
2021-10-19 12:10:54 DEBUG rasa.core.processor - Action 'action_tell_about_xxxxx' ended with events '[BotUttered('Test Successful!', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {}, 1634625654.5356448), <rasa.shared.core.events.SlotSet object at 0x000002D841C3C6A0>]'.
2021-10-19 12:10:54 DEBUG rasa.core.processor - Current slot values:
cp_type: xxxxx
company: client_name
professional: None
session_started_metadata: {'out_channel': 'xxxxxxxxxx', 'thread_id': '1634625284.002900', 'users': ['U02HKBCESUV']}
2021-10-19 12:10:54 DEBUG rasa.core.lock_store - Deleted lock for conversation 'xxxxxxxxx'.
2021-10-19 12:10:55 WARNING rasa.core.channels.slack - Received retry #1 request from slack due to http_timeout.
I have already made the action as simple as possible
No, there are no error on the action server, because it get the request, it executes it properly and returns the response. The same can be seen in questions’ s log. [BotUttered('Test Successful!'
Earlier I thought it might be due to DB query execution so i replaced the code to just send a pass through response.
The only problem that i have observed while debugging is -
in rasa.core.channels.slack.py when normal requests (one not dependent on custom actions) does not have following flags set - “x-slack-retry-reason”=“1” and “x-slack-retry-num”=“http_timeout”.
That is why when it comes to below function it gets stuck to HTTPStatus.CREATED and that’s it.
async def process_message(
self,
request: Request,
on_new_message: Callable[[UserMessage], Awaitable[Any]],
text: Text,
sender_id: Optional[Text],
metadata: Optional[Dict],
) -> Any:
"""Slack retries to post messages up to 3 times based on
failure conditions defined here:
https://api.slack.com/events-api#failure_conditions
"""
retry_reason = request.headers.get(self.retry_reason_header)
retry_count = request.headers.get(self.retry_num_header)
logger.info(
f"Request Header - {request.headers}."
f"Request Body - {request.body}."
)
if retry_count and retry_reason in self.errors_ignore_retry:
logger.warning(
f"Received retry #{retry_count} request from slack"
f" due to {retry_reason}."
)
return response.text(
None, status=HTTPStatus.CREATED, headers={"X-Slack-No-Retry": 1}
)
I hope it answers your question.
Looking forward to your response.
Thanks @stephens !
I haven’t looked at the slack channel formatting in quite a while. What is the debug output show as the payload for a normal utterance. Is the format the same as you show above for your example: