C# SEND From Database

By
C# Code Example - Sending SMS from Database

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class Program
{
    private static readonly HttpClient client = new HttpClient();

    public static async Task SendSMS(string senderId, string recipient, string messageText)
    {
        string apiUrl = "https://rest.sendmode.com/v2/send";
        string apiKey = "YOUR_ACCESS_KEY";

        var message = new
        {
            messagetext = messageText,
            senderid = senderId,
            recipients = new[] { recipient }
        };

        var jsonMessage = JsonConvert.SerializeObject(message);
        var content = new StringContent($"message={jsonMessage}", Encoding.UTF8, "application/x-www-form-urlencoded");

        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Add("Authorization", apiKey);

        HttpResponseMessage response = await client.PostAsync(apiUrl, content);
        string responseBody = await response.Content.ReadAsStringAsync();
        Console.WriteLine($"SMS sent to {recipient}: {responseBody}");
    }

    public static async Task Main(string[] args)
    {
        string connectionString = "YourConnectionStringHere";
        string storedProcedureName = "YourStoredProcedureName";

        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            using (SqlCommand command = new SqlCommand(storedProcedureName, connection))
            {
                command.CommandType = CommandType.StoredProcedure;

                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string mobileNumber = reader["MobileNumber"].ToString();
                        string firstName = reader["FirstName"].ToString();
                        string message = $"Hi {firstName}, your personalized message content here.";

                        await SendSMS("YourSenderID", mobileNumber, message);
                    }
                }
            }
        }
    }
}

Read more

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')

Read more

HTTP SEND PYTHON

By
PYTHON Code Example - Sending SMS

import requests

def send_sms(username, password, sender_id, recipient, message):
    url = 'https://api.sendmode.com/httppost.aspx'
    params = {
        'username': username,
        'password': password,
        'senderid': sender_id,
        'numto': recipient,
        'data1': message
    }
    response = requests.get(url, params=params)
    return response.text

# Example usage
response = send_sms('your_username', 'your_password', 'your_senderid', 'recipient_number', 'your_message_content')
print(response)

Read more

HTTP Opt OUT Link

By
http://api.sendmode.com/optoutmember.aspx?type=optout&username=xxxxx&password=yyyyyy_
&mobilenumber=0871234567&optoutreason=Doent%20want%20messages&returnedresponse=TEST STOP

Read more

HTTP Opt In Link

By
•    http://api.sendmode.com/importmember.aspx?type=import&username=USERNAME&password=PASSWORD_
            &mobilenumber=353871234567&optinconsent=HAS BOUGHT FROM SHOP&resturnedresponse=OPTIN

Read more

HTTP Check HLR Link

By
https://api.sendmode.com/performhlr.aspx?type=hlr&username=xxx&password=yyy&mobilenumber=353871234567&customerid=12345

Read more