Hi @Robert14! The problem is that your variable fb_access_token is not defined anywhere as mentioned in the error message. The problem is that you define the access token in the credentials file which is not available in the action server (as it is in the core server). You need to define this access token somewhere. My recommendation would be to add it as an environment variable.
import requests
fb_access_token = ("")
most_recent_state = tracker.current_state()
sender_id = most_recent_state['sender_id']
r = requests.get('https://graph.facebook.com/{}?fields=first_name,last_name&access_token={}'.format(sender_id, fb_access_token)).json()
first_name = r["first_name"]
last_name = r["last_name"]
dispatcher.utter_message("hola {} {},bienvenido a nombre de pizzeria seleccione los botones de abajo para interactuar con nosotros' ".format(first_name, last_name)) r = requests.get('https://graph.facebook.com/{}?fields=first_name,last_name&access_token={}'.format(sender_id, fb_access_token)).json()
Hi, I’m currently also looking for a way for the chatbot to get the username from the messenger. But I still can’t do it successfully. If yes, can you give me the source of this part? thank you very much