I am trying to extract the sender_email using the hangouts.py(rasa/rasa/core/channels/hangouts.py at main · RasaHQ/rasa · GitHub) extract_sender function but everytime I try to run it, it has no req parameter. How do i define the “req”.
Here is my code:
def _extract_sender_email(req: Request) -> Text:
if req.json["type"] == "MESSAGE":
return req.json["message"]["sender"]["email"]
return req.json["user"]["email"]
class ActionAuth(Action):
def name(self) -> Text:
return "action_test"
def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict[Text, Any]]:
email = _extract_sender_email(req)
print(email)