MissCallOTP   0.0.1

Publisher:
master@mainapi.net

API Documentation


Metoda pengiriman one time password (OTP) menggunakan miss call. Kode OTP disisipkan pada 4 atau 6 digit terakhir dari nomor telepon yang diterima sebagai miss call.

To make a call to MissCallOTP API, send HTTP request using the following details:

Base URL https://api.mainapi.net/misscallotp/0.0.1
Endpoint /messages
Header
  • (Optional) X-MainAPI-Username: <given username>
  • (Optional) X-MainAPI-Password: <given password>
  • (Optional) X-MainAPI-Senderid: <registered masking>
  • Accept: application/json
  • Content-Type: application/x-www-form-urlencoded
  • Authorization: Bearer <access token>
Body
  • msisdn=<phone number>
  • content=<message to send>
  Please login to try this API.

MissCall OTP SDK

MisscallOTP

Misscall OTP API is our API that provides the delivery service of OTP or One Time Password, through Misscall. You can use this API to provide OTP authentication method through Misscall to your users. Your user will receive a Misscall with OTP in the last Number, he/she then enter this OTP on your application to authenticate through our OTP validation. The OTP generation is following the rule of RFC 6238 algorithm. The OTP has validity period that you can set, i.e. how long before the OTP expires, so your user should authenticate the OTP within the validity period.

Getting started

Configure Repository Gradle

Configure repository gradle by following this:

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://dl.bintray.com/mainapi/SDK"
        }
    }
}

Dependency

Include the dependency in module gradle :

dependencies {
    implementation 'net.mainapi.sdk:core:1.0.0@aar'
    implementation 'net.mainapi.sdk:misscallotp:0.0.1@aar'
}

Installation

Define base URL, Key, and Secret using MainApiConfig, in your Application class in the onCreate() method.

@Override
public void onCreate() {
    super.onCreate();
    MainApiConfig.initDefault(new MainApiConfig
        .Builder()
        .with(getApplicationContext())
        .setBaseUrl("https://api.mainapi.net/")
        .setKeyAndSecret("YOUR_KEY", "YOUR_SECRET")
        .build());
}

Note: Key and Secret are obtained from MainAPI website in user account information on individual application page .

Usage

Send OTP Key

Use this to send OTP key via Misscall. To include the Phone Number on your content, use {{PHONE_NUMBER}}, see request example below:

MisscallOTP misscallOtp = new MisscallOTP(Activity.this);
Request.MisscallOTP otp = new Request().new MisscallOTP();
otp.setDuration(120);
otp.setLength(4);
otp.setMaxAttempt(3);
otp.setUser("Your Phone Number is {{PHONE_NUMBER}}");

misscallOtp.sendMisscallOTP("{{UNIQUE_ID}}", otp, new MisscallOTPCallbacks() {
    @Override
    public void onSuccess(@NonNull MisscallOTP otp) {
        Log.d("This Prefix Number from Our Misscall", otp.getPrefix());
    }

    @Override
    public void onFailure(@NonNull Throwable t) {

    }

    @Override
    public void onError(@NonNull JSONObject jsonError) {

    }
});

Note: As you can see above, UNIQUE_ID is a path parameter called otpID, it is used as an identification ID, it should be filled with UUID. You can generate UUID from Core Module inside Helper

Verify OTP Key

In order to verify OTP key validity, you must use the same otpID parameter that was used to send the OTP key.
Fill otpstr with generated OTP key that need to be verified
See request example below:

MisscallOTtp misscallOtp = new MisscallOtp(Activity.this);
Request.VerifyMisscallOTP verificationOTP = new Request().new VerifyMisscallOTP();
verificationOTP.sePassword(otpStr);

misscallOtp.verifyMiscallOTP({{OTP_ID}}, verificationOTP, new VerifyMisscallOPTCallbacks() {
    @Override
    public void onSuccess(@NonNull Boolean result) {
        
    }

    @Override
    public void onFailure(@NonNull Throwable t) {

    }

    @Override
    public void onError(@NonNull JSONObject jsonError) {

    }
});

Note: You can use our Background Process sample to get Misscall Phone Number inside Core Module with Class Name Service Receiver. If Verification Success, it will not return anything. You can get a Boolean from Callback to check Verification. You must remove recent Call History after Verify OTP. In Core Module you can use function removeContactsLogFromPhoneLogs to delete Our Miscall Phone Number


  Please login to use this API.

0

Free 5 Calls
Free 5 calls a day

17500

100 Calls
100 calls as you grow

150000

1000 Calls
1000 calls as you grow

625000

5000 Calls
5000 calls as you grow

1000000

10000 Calls
10000 calls as you grow