Skip links

Programmable APIs for Smart Communication

To empower business communication, integrate, deliver and scale with ease using mobtexting APIs. Integrate API with your website, CRM & E-Commerce application now and automate your customer interactions.

— Integrations

Easy API Integrations with Your Existing Tools To Automate Business Communications

mobtexting integrates with websites, any third-party CRMs, ERPs, popular help desk software, e-commerce platforms, and marketing tools to unify your customer information in one place. Zero or Minimal coding is required. mobtexting supports integration with 20+ popular tools out there.

Powerful Capabilities Via Simple APIs

APIs give you flexibility, simplify design, administration & use. It provides opportunities for innovation.

				
					<?php
                $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);
				
			
				
					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



<receiver android:name=".receivers.SmsReceiver">
    <intent-filter>
      <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>

				
			
				
					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)
				
			
				
					curl -X POST \
         {endpoint}sms/send/xml \
         -H 'Authorization: Bearer 425b8dec5d6b618fa9c08xxxx' \
         -H 'Cache-Control: no-cache' \
         -H 'Content-Type: application/xml' \
         -d '<?xml version="1.0" encoding="UTF-8"?>
         <data>

         <root>
         <dlr_url><![CDATA[http://domain.com/status]]&gt;</dlr_url>
         <message><![CDATA[global message]]&gt;</message>
         <sender>Name</sender>
         <service>T</service>
         <time>2018-07-05 10:30AM</time>
         <type>N</type>
         <flash>0</flash>
         </root>

         <nodes>
         <node>
         <message><![CDATA[this message will be used insted of root]]&gt;</message>
         <sender>Name</sender>
         <to>9190199556xx</to>
         <custom>9190199556xx</custom>
         <custom1>9190199556xx</custom1>
         </node>
         <node>
         <custom>34</custom>
         <to>9188671356xx</to>
         <sender>Name</sender>
         </node>
         </nodes>

         </data>'

				
			
				
					curl -X POST \
         {endpoint}sms/send/xml \
         -H 'Authorization: Bearer 425b8dec5d6b618fa9c08xxxx' \
         -H 'Cache-Control: no-cache' \
         -H 'Content-Type: application/xml' \
         -d '<?xml version="1.0" encoding="UTF-8"?>
         <data>

         <root>
         <dlr_url><![CDATA[http://domain.com/status]]&gt;</dlr_url>
         <message><![CDATA[global message]]&gt;</message>
         <sender>Name</sender>
         <service>T</service>
         <time>2018-07-05 10:30AM</time>
         <type>N</type>
         <flash>0</flash>
         </root>

         <nodes>
         <node>
         <message><![CDATA[this message will be used insted of root]]&gt;</message>
         <sender>Name</sender>
         <to>9190199556xx</to>
         <custom>9190199556xx</custom>
         <custom1>9190199556xx</custom1>
         </node>
         <node>
         <custom>34</custom>
         <to>9188671356xx</to>
         <sender>Name</sender>
         </node>
         </nodes>

         </data>'

				
			

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.

Add Robust Messaging Capabilities To Your Applications

Send messages over SMS, Push, chat apps, and more in a user-centric way over a simple unified API.
This website uses cookies to improve your web experience.