def send_whatsapp(mediaURL, paramsArray, lang, uid, phoneNumber): import requests if lang == "en": campaignName = "Main Campaign English" userName = "Farmer" elif lang == "hi": campaignName = "Main Campaign Hindi" userName = "किसान" else: campaignName = "Main Campaign Hindi" userName = "किसान" paramsArray[0] = userName #campaignName = 'Main Campaign 4' url = 'https://backend.aisensy.com/campaign/t1/api' split_name_phone = paramsArray[1].split(",") try: phoneNumber = split_name_phone[1] except: phoneNumber = '6366026267' phoneNumber = phoneNumber.replace(" ","") if "+91" not in phoneNumber: phoneNumber = "+91" + phoneNumber if uid == "XSzwRsmzu4OeCm8UvllGn7xsnOk1": phoneNumber = "+919819984575" if uid == "TCXcp5VIsfhHZrh0nm2VsgBtcGy2": phoneNumber = "7893726963" # main_obj = {'apiKey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzODk3MDRlMDYyYTQ3NzIwZWMzYjc2NCIsIm5hbWUiOiJGYXJtb25hdXQgVGVjaG5vbG9naWVzIFB2dC4gTHRkLiIsImFwcE5hbWUiOiJBaVNlbnN5IiwiY2xpZW50SWQiOiI2Mzg5NzA0ZTA2MmE0NzcyMGVjM2I3NWYiLCJhY3RpdmVQbGFuIjoiQkFTSUNfVFJJQUwiLCJpYXQiOjE2Njk5NTE1NjZ9.sm6bFj27KhdOPL7t_aAbLIJW7Il4pMSnLIQ7unVzenM', # 'campaignName': 'Sample New', # 'destination': '9958983308', # 'userName': 'Nepal Singh', # 'media': {'url': 'https://farmonaut.page.link/EKYC', 'filename': 'Analysis.png'}, # 'templateParams': ['Nepal Singh', 'Nepal Singh, 9229766654', 'N, E', 'W, SE', 'https://farmonaut.page.link/RRMb']} myobj = { "apiKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzODk3MDRlMDYyYTQ3NzIwZWMzYjc2NCIsIm5hbWUiOiJGYXJtb25hdXQgVGVjaG5vbG9naWVzIFB2dC4gTHRkLiIsImFwcE5hbWUiOiJBaVNlbnN5IiwiY2xpZW50SWQiOiI2Mzg5NzA0ZTA2MmE0NzcyMGVjM2I3NWYiLCJhY3RpdmVQbGFuIjoiQkFTSUNfVFJJQUwiLCJpYXQiOjE2Njk5NTE1NjZ9.sm6bFj27KhdOPL7t_aAbLIJW7Il4pMSnLIQ7unVzenM", "campaignName": campaignName, "destination": phoneNumber, "userName": userName, "media": { "url": mediaURL, "filename": "Analysis.png" }, "templateParams": paramsArray } print(myobj) x = requests.post(url, json = myobj)