Reputation: 35
I want to integrate my telegram bot with my dialogflow. but I don't know how to get the payload data like telegram ID, name, etc. in dialogflow docs they never explain this.
Upvotes: 0
Views: 247
Reputation: 35
after I contact dialogflow Support, we can use originalRequest
like this
const agent = new WebhookClient({ request, response });
let payload = agent.originalRequest;
let firstname = payload.payload.data.from.first_name;
this is example of the payload
let payload = {
"source":"telegram",
"payload":
{"data":
{"message_id":51,
"from":
{"username":"thisistelegramusername",
"id":123455678,
"first_name":"firstname",
"last_name":"lastname",
"language_code":"en"
},"text":"halo",
"chat":
{"id":"123455678",
"type":"private"},
"date":1618373981}}}
Upvotes: 1