Hey @KhalidBentaleb, sure, have a look! I simplified it a bit as we have quite some code specific to our use case just to generate the right message for our customer support team.
I am using the slack client 1.3 (slackclient~=1.3) as I had issues with version 2. link_names is set to 1 so as to have the mention with @customersupport work (only works with groups, not individual users).
class ActionHandoverToSupport(Action):
def name(self):
return "action_handover_to_support"
def run(
self,
dispatcher,
tracker,
domain,
reason: Text = None,
):
events = []
text = f"@customersupport Help needed for user {tracker.sender_id}"
response = client_slack.api_call(
"chat.postMessage", channel=SLACK_SUPPORT_CHANNEL, text=text, link_names=1
)
if response.get("ok"):
dispatcher.utter_message(template="utter_handover_to_support")
events.append(ConversationPaused())
else:
dispatcher.utter_message(
template="utter_technical_issue",
extra_message="I could not send a message to my humans 😢",
)
return events
Hope that helps!! Nicolas