Push SMS - Trusted By Enterprise Brands
Send text messages that delight your customers. Boost your mobile conversion rates. Recommend a product, promote a sale, send a reminder message, or make an announcement.
Why Do Businesses Need Push SMS Services?
Promotion
Helps to Increase your brand awareness, to send promotions, discounts, and offers with a single click
Recommendations
Don't miss the key revenue generation opportunities, send abandoned cart recommendations, and much more with push SMS services
Reminders
Reminder is the ultimate scheduling assistant, send appointments and event reminders, with campaign sms services
Announcement
Pre-schedule your text message announcements to send at a specific date & time. It is the fastest way to reach your target audience
Dynamic APIs to Empower SMS Communication
Integrate, deliver and scale with ease
'xxxxxxxx',
'to' => '91XXXXXXXXXX',
'service' => 'T',
'flash' => 0,
'sender' => 'XXXXXX',
'message' => $sms
];
$ch = curl_init('portal.mobtexting.com/api/v2/sms/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
$sms = 'message content';
$ch = curl_init();
$post = [
'access_token'=> 'xxxxxxxx',
'to' => '91XXXXXXXXXX',
'service' => 'T',
'flash' => 0,
'sender' => 'XXXXXX',
'message' => $sms
];
$ch = curl_init('portal.mobtexting.com/api/v2/sms/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
curl --request POST \
--url {endpoint}/send/json \
-H 'Authorization: Bearer 209eccd40ee3a2e14af7fe45b21xxx'
-H 'Content-Type: application/json' \
--data '{
"root": {
"type": "A",
"flash": 0,
"sender": "TXTSMS",
"message": "global message",
"service": "T",
"dlr_url": "http://www.domainname.com/dlr?status={status}",
"time": ""
},
"nodes": [
{
"to": "919019xxxx2",
"custom": "346576-446565-45657-XFTR",
"sender": "txtmes",
"message": "Message from & json api node 1"
},
{
"to": "9188xxxxxxxxxx",
"custom": "34"
}
]
}'
curl -X POST \
{endpoint}sms/send/xml \
-H 'Authorization: Bearer 425b8dec5d6b618fa9c08xxxx' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/xml' \
-d '
Name
T
N
0
Name
9190199556xx
9190199556xx
9190199556xx
34
9188671356xx
Name
'
use NotificationChannels\Mobtexting\MobtextingChannel;
use NotificationChannels\Mobtexting\MobtextingSmsMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [MobtextingChannel::class];
}
public function toMobtexting($notifiable)
{
return (new MobtextingSmsMessage())
->text("Your {$notifiable->service} account was approved!");
}
}
Usage (send SMS)
public class MainActivity extends AppCompatActivity implements MobtextingInterface{
private Mobtexting mobtexting;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//create instance of Mobtexting class
mobtexting=new Mobtexting(this);
//send the SMS
mobtexting.sendSMS("This is a test","7488******",this);
}
@Override
public void onResponse(ServerResponse serverResponse) {
Log.d("response",serverResponse.getStatus()+" "+serverResponse.getDescription()+" "+serverResponse.getSmsId());
}
@Override
public void onError(ModelError modelError) {
Log.d("response",modelError.getStatus()+" "+modelError.getDescription());
}
}
Usage (how to verify OTP)
Step 1. Generate six digit random OTP in MainActivity class.
public class MainActivity extends AppCompatActivity implements MobtextingInterface{
private Mobtexting mobtexting;
private String otp_sixdigit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Generate six digit OTP
otp_sixdigit=String.valueOf(generateSixDigitRandomNumber());
mobtexting=new Mobtexting(this);
mobtexting.sendSMS("This is a test "+otp_sixdigit,"7488792140",this);
}
//Generate 6 digit number
private int generateSixDigitRandomNumber(){
Random rnd = new Random();
int n = 100000 + rnd.nextInt(900000);
return n;
}
@Override
public void onResponse(ServerResponse serverResponse) {
Log.d("response",serverResponse.getStatus()+" "+serverResponse.getDescription()+" "+serverResponse.getSmsId());
//pass the 6 digit OTP to OTPActivity class
Intent intent=new Intent(getBaseContext(),OTPActivity.class);
intent.putExtra("otp",otp_sixdigit);
startActivity(intent);
}
@Override
public void onError(ModelError modelError) {
Log.d("response",modelError.getStatus()+" "+modelError.getDescription());
}
}
Step 2. After successful response, pass the generated OTP to OTPActivity class.
public class OTPActivity extends AppCompatActivity {
private EditText otpEditText;
private Button btnVerify;
private String otp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_otp);
otpEditText = (EditText) findViewById(R.id.otpEditText);
btnVerify = (Button) findViewById(R.id.btnVerify);
//receive the 6 digit generated OTP from previous activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
otp = extras.getString("otp");
}
//button click listener
btnVerify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//check the OTP verification
if ((otp != null) && (otp.equals(otpEditText.getText().toString().trim()))) {
Log.d("verified","OTP verified successfully.");
}else{
Log.d("verified","OTP verified not successfully");
}
}
});
}
}
Usage (Auto verififcation OTP)
Step 1. Create one Interface class like SmsListener
public interface SmsListener {
public void messageRceived(String messageText);
}
Step 2. Create one Broadcast receiver class like SmsReceiver
public class SmsReceiver extends BroadcastReceiver{
private static SmsListener smsListener;
@Override
public void onReceive(Context context, Intent intent) {
try {
Bundle data = intent.getExtras();
Object[] pdus = (Object[]) data.get("pdus");
for (int i = 0; i < pdus.length; i++) {
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) pdus[i]);
String sender = smsMessage.getDisplayOriginatingAddress();
if (sender != null) {
String messageBody = smsMessage.getMessageBody();
String msgLower = messageBody.toLowerCase();
smsListener.messageRceived(msgLower);
}
}
}catch (Exception e){
smsListener.messageRceived("something went wrong!");
}
}
public static void bindListener(SmsListener listener) {
smsListener = listener;
}
Step 3. Bind the interface to the OTPActivity class
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_otp);
otpEditText = (EditText) findViewById(R.id.otpEditText);
btnVerify = (Button) findViewById(R.id.btnVerify);
//receive the 6 digit generated OTP from previous activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
otp = extras.getString("otp");
}
//sms receiver to auto verification
SmsReceiver.bindListener(new SmsListener() {
@Override
public void messageRceived(String messageText) {
try {
String sixOTPDigit = extractDigits(messageText);
otpEditText.setText(sixOTPDigit);
}catch (Exception e){
Log.d("exception", "Something Went Wrong!");
}
}
});
//button click listener
btnVerify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//check the OTP verification
if ((otp != null) && (otp.equals(otpEditText.getText().toString().trim()))) {
Log.d("verified","OTP verified successfully.");
}else{
Log.d("verified","OTP verified not successfully");
}
}
});
}
/**
* extract digit from string
* @param in
* @return
*/
public static String extractDigits(final String in) {
final Pattern p = Pattern.compile( "(\\d{6})" );
final Matcher m = p.matcher( in );
if ( m.find() ) {
return m.group( 0 );
}
return "";
}
}
Step 4. register the broadcast receiver class in android manifest file xml
var mobtexting = require('mobtexting-nodejs')
var access_token = 'xxxxxxxxxxxxxxx'
var client = new mobtexting(access_token)
client.send(
to="1234567890",
from="MobTxt",
body="Hello from nodejs!",
service="P",
function(result) {
console.log(result)
}
);
import com.mobtexting.sms.Client;
public class Hello {
public static final String ACCESS_TOKEN = "xxxxxxxxxxxxxxxxxx";
public static void main(String[] args) {
Client client = new Client(ACCESS_TOKEN);
String to = "1234567890";
String from = "MobTxt";
String body = "Hello from Java!";
char service = 'P';
String response = client.send(to, from, body, service);
System.out.println(response);
}
}
Installation
You can install the package via pip :
pip install git+git://github.com/mobtexting/mobtexting-python.git --user
Send SMS Usage
from mobtexting.client import Client
access_token = 'xxxxxxxxxxxxxxxxxx'
client = Client(access_token)
response = client.send(
to="1234567890",
_from="MobTxt",
body="Hello from Python!",
service="P"
)
print response.json()
Verify Usage
from mobtexting.verify import Verify
access_token = 'xxxxxxxxxxxxxxxxxx'
verify = Verify(access_token)
Send
response = verify.send(
to="1234567890",
)
print response.json()
With optional paramaters
response = verify.send(
to="1234567890",
data = {
'length': 4,
'timeout': 600
}
)
print response.json()
Check
response = verify.check(
id='b51be650-fdb2-4633-b101-d450e8d9ec64', # id received while sending
token='123456' # token entered by user
)
print response.json()
Cancel
response = verify.cancel(
id='4e28e081-2900-4523-aed6-a21eb39c2ae6' # id received while sending
)
print response.json()
require "mobtexting_sms"
access_token = 'xxxxxxxxxxxxxxxxx'
client = MobtextingSms::Client.new(access_token)
response = client.send(
'1234567890', # to phone number
'MobTxt', # sender
'hello from ruby!', # message body
'P' # service
)
puts(response)
Verify Usage
Send
verify = MobtextingSms::Verify.new(access_token)
response = verify.send('1234567890') # to phone number
puts(response)
Check
verify = MobtextingSms::Verify.new(access_token)
response = verify.check(
'705f1cd4-93e0-492e-b6f8-ffdf9dac68f5', # id received while send
'123456' # token entered by user
)
puts(response)
Cancel
verify = MobtextingSms::Verify.new(access_token)
response = verify.cancel('705f1cd4-93e0-492e-b6f8-ffdf9dac68f5') # id received while send
puts(response)
package main
import "fmt"
import client "github.com/mobtexting/mobtexting-go"
func main() {
var to = "1234567890"
var from = "MobTxt"
var body = "hello from go"
var service = "P"
var access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
var response = client.Send(to, from, body, service, access_token)
fmt.Println(response)
}
Verify Usage
Send
var to = "1234567890"
var access_token = "xxxxxxxxxxxxxxxxx"
var response = client.VerifySend(to, access_token)
fmt.Println(response)
Check
var id = "b51be650-fdb2-4633-b101-d450e8d9ec64", // id received while sending
var token = "123456" // token entered by user
var access_token = "xxxxxxxxxxxxxxxxx"
var response = client.VerifyCheck(id, token, access_token)
fmt.Println(response)
Cancel
var id = "b51be650-fdb2-4633-b101-d450e8d9ec64", // id received while sending
var access_token = "xxxxxxxxxxxxxxxxx"
var response = client.VerifyCancel(id, access_token)
fmt.Println(response)
using System;
using MobtextingDotnet;
namespace Yourprojectnamespace
{
class message
{
static void Main(string[] args)
{
string access_token = "xxxxxxxxxxxxxxx";
Sendsms obj = new Sendsms(ACCESS_TOKEN: access_token);
string to = "9492xxxxxx";
string from = "mobsat";
string body = "hello from c# !";
char service = 'S';
obj.sendsms(to, from, body, service);
}
}
}
Resolve Issues Faster
Promptly respond to customer queries by automating common types of responses. Respond to inquiries about refunds, returns, product availability, and more through chat.
Trusted by 1000+ Businesses Across 4 Continents
Most innovative businesses build communication solutions using mobtexting’s platform & APIs. Get started today & engage your customers over their preferred channels across the world.