RonB1985's avatar
Level 18

SMS Message API

Does anyone know if there is a way that I can use my own phone number (dutch number) to send an SMS message without extra costs? I have found some API's but they do not offer the function to use my own number or it costs an x amount per message. I know I can use https://messages.google.com/ for example, but I want to implement something on my own website.

0 likes
5 replies
LaryAI's avatar
Level 58

Sending SMS messages using your own phone number without incurring extra costs is challenging due to the infrastructure and agreements required with telecom providers. However, there are a few approaches you might consider:

  1. Email-to-SMS Gateways: Some carriers offer email-to-SMS gateways, where you can send an email to a specific address, and it will be delivered as an SMS to the recipient. This method is often free but requires knowing the recipient's carrier and their specific gateway address.

  2. Using a SIM Card with a GSM Modem: You can use a GSM modem with a SIM card from your phone plan. This setup allows you to send SMS messages programmatically using your own number. However, this might still incur costs depending on your mobile plan.

  3. Third-Party Services: While you mentioned wanting to avoid costs, using services like Twilio, Nexmo, or Plivo is the most straightforward way to send SMS messages programmatically. These services often allow you to set up a virtual number, but using your own number might not be possible without additional costs.

  4. Custom Android/iOS App: You could develop a custom app that runs on your phone and uses its SMS capabilities to send messages. This would require the phone to be connected to the internet and might still incur costs depending on your mobile plan.

Here's a basic example of how you might use a GSM modem with a Python script to send an SMS:

import serial

def send_sms(phone_number, message):
    # Configure the serial port
    ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
    ser.write(b'AT\r')
    ser.write(b'AT+CMGF=1\r')  # Set SMS mode to text
    ser.write(f'AT+CMGS="{phone_number}"\r'.encode())
    ser.write(f'{message}\x1A'.encode())  # \x1A is the ASCII code for Ctrl+Z

    response = ser.read_all()
    ser.close()
    return response

# Example usage
response = send_sms('+31612345678', 'Hello from my GSM modem!')
print(response)

Note: This example assumes you have a GSM modem connected to your computer and the necessary drivers installed. The serial port (/dev/ttyUSB0) and baud rate (9600) might need to be adjusted based on your setup.

Keep in mind that any solution involving your own number will depend heavily on your mobile carrier's policies and the capabilities of your mobile plan.

Snapey's avatar

Using a modem is the only way to use your own number, and this won't do what you want either because I assume you want replies to come back to you. You can't send from one sim and have the replies come to another.

This example assumes you have a GSM modem connected to your computer and the necessary drivers installed. The serial port (/dev/ttyUSB0) and baud rate (9600) might need to be adjusted based on your setup.

This is not normally an option because the modem would need to be directly attached to the web server and would require you running the server also rather than being able to use a proper hosting service.

The only real solution is a third party like amazon or Vonage for which you will pay per message About 0.04 Euros per message. https://www.vonage.co.uk/communications-apis/sms/pricing/

JussiMannisto's avatar

You won't find a free option because every SMS costs money.

I don't know what you mean by using you own number to send messages. If you mean using a custom sender id so that replies get routed to your phone, many SMS gateway providers offer that. But whether that works or not depends on the recipient's telecom operator and the laws of their country.

RonB1985's avatar
Level 18

Thanks for the replies, just to clarify, I work at a servicedesk and we send passwords to end-users via SMS, we do not need to receive replies, but the outgoing number should be our own at least. I just want to integrate this on our website so my employees can easily send passwords via SMS. Perhaps email-to-sms is a way to go, I will explore this option as well. Thanks again, I'll keep looking!

Please or to participate in this conversation.