app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import requests url = "https://gate.whapi.cloud/messages/text" payload = { "to": "", # Enter the recipient's number in international format "body": "Hello! This is a test message." # Text of message } api_token = "" headers = { "accept": "application/json", "content-type": "application/json", "authorization": f"Bearer {api_token}" # Use the token from the .env file } response = requests.post(url,json=payload,headers=headers) print(response.status_code) print(response.text) |
app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import requests url = "https://gate.whapi.cloud/messages/image" payload = { "to": "", "media": "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg", "caption": "An example image" } headers = { "accept": "application/json", "content-type": "application/json", "authorization": "Bearer Your_Token" } response = requests.post(url, json=payload, headers=headers) print(response.text) |