Python SEND

By
 PYTHON Code Example - Sending SMS
 
import requests

def send_sms(sender_id, recipient, message_text):
    api_url = 'https://rest.sendmode.com/v2/send'
    api_key = 'YOUR_ACCESS_KEY'

    message = {
        'messagetext': message_text,
        'senderid': sender_id,
        'recipients': [recipient]
    }

    headers = {
        'Authorization': api_key,
        'Content-Type': 'application/x-www-form-urlencoded'
    }

    response = requests.post(api_url, data={'message': json.dumps(message)}, headers=headers)

    if response.status_code == 200:
        print('SMS sent successfully')
    else:
        print(f'Failed to send SMS: {response.status_code} - {response.text}')

# Example usage
send_sms('your_senderid', 'recipient_number', 'your_message_content')