Going to post the solution i found:
Implemented a custom input channel in a file called custom_telegram.py
the same folder that the credentials.yml
is, with the content:
from rasa.core.channels import TelegramInput
from typing import Text
class TelegramInputChannel(TelegramInput):
def get_metadata(self, request):
metadata=request.json
return metadata
Then, edited my credentials.yml
using:
custom_telegram.TelegramInputChannel:
access_token: "token provided by father bot"
verify: "bot_username"
webhook_url: "https://address/webhooks/telegram/webhook"
After that, it was possible to access in actions file:
telegram_username = tracker.latest_message["metadata"]["from"]["username"] #user that sent the message
telegram_chat_type = tracker.latest_message["metadata"]["chat"]["type"]
if telegram_chat_type == 'group':
is_group = True
return [
SlotSet("is_in_telegram_group", is_group),
]