import requests import base64 # Your SMSPoh API key and secret api_key = 'YOUR_API_KEY' api_secret = 'YOUR_API_SECRET' api_url = 'https://v3.smspoh.com/api/rest/send' # Message details sender_id = 'YourSenderID' recipient = '+959********' message = 'Hello, this is a test message from SMSPoh!' # Prepare the payload payload = { 'to': recipient, 'message': message, 'from': sender_id } # Encode the API key and secret api_credentials = base64.b64encode(f'{api_key}:{api_secret}'.encode()).decode() # Set the headers headers = { 'Authorization': f'Bearer {api_credentials}', 'Content-Type': 'application/json' } # Send the request response = requests.post(api_url, json=payload, headers=headers) # Check the response if response.status_code == 200: print('Message sent successfully!') else: print(f'Failed to send message. Status code: {response.status_code}')