Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unable to send sms on whatapp throguht route

bascially i am making a route in which i have connect my api of whatapp when i send a number in my json response thought software this route should send me a whatapp message on that number

@app.route('/v1.1/userRegistor', methods=['POST','GET'])
def get_user():
    data = request.get_json()
    numbers=data['numbers']
    api_url = ('https://app.simplywhatsapp.com/api/send.php?number=numbers&type=text&message=test%20message&instance_id=634CF8BECCB26&access_token=78495efca3672167f9ed88cb93acd2e1')
    r = requests.get(api_url)
    return r.json()

this is my request body:
{

"numbers":"923142985338"

}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You aren’t formatting your API request URL. The variables can’t be passed directly in the string, as they can’t be distinguished from words. You need to use a format string.

api_url = f'https://app.simplywhatsapp.com/api/send.php?number={numbers}&type={text}&message=test%20message&instance_id=634CF8BECCB26&access_token=78495efca3672167f9ed88cb93acd2e1'

Read more about it here: https://www.pythoncheatsheet.org/cheatsheet/string-formatting

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading