how to get the response from the user in whatsapp api

Viewed 30

I'm new to Whatsapp Api and currently i want to know how can i get the response from the user using the request or other tools in python. What i manage to achieve is to send messages but i don't know how to get the reply that user sent. if you can guide me in this problem, it would be great. I cant use third party to do this integration like twilio and others

below is code used for sending message

import json
import requests

token=""
phone=""
version="v15.0"
sender_phone=""
message="something"
url = f'https://graph.facebook.com/{version}/{phone}/messages'
header = {'Content-Type': 'application/json', 'Authorization': f'Bearer {token}'}

data = {
            "messaging_product": "whatsapp",
            "to": sender_phone,
            "type": "text",
            "text":{
                "body": message
            }
            }
data = json.dumps(data)
response = requests.post(url=url,headers=header, data=data)
print(response.text)

Thank you

0 Answers
Related