I need some help. I have a python code that sends a whatsapp template message to confirm a particular routine. The code runs well locally or run via a dockerfile (via localhost) but fails to run once I loaded at its azure web app container. I get an 401 "unauthorized" error message. That is odd since I'm using the same key (locally stored in a .env and on the credentials module at azure web apps). It's unclear to me what the issue is. I push the same code to the Azure Repo via Git. The code is exactly the same as the one in my VS code. I looked all over the meta documentation without being able to find any issues that singles out additional settings for Azure Web app services. Error message: 2024-09-16T01:13:44.2660099Z ERROR:root:Request failed due to: 401 Client Error: Unauthorized for url: https://graph.facebook.com/v20.0/42XXXXXXXX04/messages {added XXXs manually for security reasons). Here is my code (I'm using the sample hello world for reference. My code uses its own custom template, which works fine. This default template also fails at azure web app): def get_text_message_input_template(recipient_number): return json.dumps( { "messaging_product": "whatsapp", "to": recipient_number, "type": "template", "template": { "name": "hello_world", "language": {"code": "en_US"} } } ) def send_message_whatsapp(data): current_function = inspect.currentframe().f_code.co_name logging.info(current_function) auth = f'Bearer {connection_keys.meta_access_token}' headers = { "Authorization": auth, "Content-Type": "application/json" } url = f"https://graph.facebook.com/{connection_keys.meta_version}/{connection_keys.meta_phone_number_id}/messages" try: response = requests.post( url, data=data, headers=headers, timeout=10 ) # 10 seconds timeout as an example response.raise_for_status() # Raises an HTTPError if the HTTP request returned an unsuccessful status code except requests.Timeout: logging.error("Timeout occurred while sending message") print(f'Error Whatsapp {e}') return jsonify({"status": "error", "message": "Request timed out"}), 408 except ( requests.RequestException ) as e: # This will catch any general request exception logging.error(f"Request failed due to: {e}") print(f'Error Whatsapp {e}') return jsonify({"status": "error", "message": "Failed to send message"}), 500 else: # Process the response as normal log_http_response(response) return response Continue reading...