Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Integrate Wegus infotech SMS Gateway API in PHP/Cakephp 2.x

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 705
    Comment on it

    Wegus infotech SMS Gateway

    If you want to send bulk sms to your users through API, then you can send it using dedicated SMS gateway via HTTP Protocol. The HTTP API can be used to send various type of SMS messages including Long text messages or Short text messages. I am writing this blog which will help you to understand the use of sms gateway through HTTP API for template messaging. Using template messaging, messages can be sent on DND numbers.

    Note: HTTP url will do 300 request per second at a time.

    API Parameters

     

    S.no Parameter Name Parameter Value Description
    1 Username Test User User Name of the Account
    2 Password Test password password of the Account
    3 Senderid Senderid Senderid
    4 dest_mobileno Mobile Number Destination Mobile Number
    5 tempid Template id Template id
    6 F1,F2,etc Dynamic values Message to be sent
    7 Responseid Submission id SMS submitted return value

     

    Username: username

    At the time of registration on Wegus Infotech, user is free to choose his/her username but it should be unique. User parameter can not be more than 30 characters long and it should contain alphabets and numbers only without blank or special characters.

     

    Password: password

    At the time of registration user is free to choose his password. Password can not be more than 30 characters long and it should contain alphabets and numbers only without blank or special characters.

     

    Senderid: senderid

    Senderid refers to the Alphanumeric Identity of the Sender. For India an alphanumeric sender-id (of maximum 8 characters) is accepted. The sender Id registration is subject to the TRAI regulations. Please read the details on the TRAI website. WEGUS has the authority to reject any
    Sender Id (s) without prior intimation to the user to respect and adhere the DOT / TRAI mandate.

     

    Mobile Number: dest_mobileno

    This parameter indicates destination mobile number to which sms will be sent. It must include country code appended before the mobile number. If there is any error in the parameter value then the message will not be sent to the respected destination mobile number. The mobile number should contain only number and no symbol like '+' or '-' etc.

     

    Template ID: tempid

    This parameter  refers to a template id which is a specific number assigned to a particular template. This template id is unique for any particular template. You need to contact Wegus Infotech for creating your demo template message. Template refers to the message here which will be provided by you. For example: Template for Registration should look like:

     

    "Dear Amuk Saxena, thank you for registering with us. Your email id is amukmca@gmail.com and password is abcd. Please login to www.yourdomain.com/login."

     

    FIELD BOX:-F1, F2,etc.

    This parameter refers to the field boxes added in the template. Each field box will hold only 30 characters which represent dynamic values. For example:

     

    "Dear (F1), thank you for registering with us. Your email id is (F2) and password is (F3). Please login to www.yourdomain.com/login."

     

    Here F1, F2, and F3 denotes dynamic values to be passed to the API

     

    Responseid: response

    The default parameter is Y. This filed returns the schedule id with date of SMS submission.

     

    Message

     

    Below API is used for template messaging. With template messaging, messages can be sent to DND registered numbers.

     

    http://123.63.33.43//blank/sms/user/urlsmstemp.php?username=XXXX&pass=XXXX&senderid=XX
    XX&dest_mobileno=XXXXXXXXXX&tempid=XX&F1=XXXX&F2=XXXX&F3=XXXX&response=Y

     

    http://123.63.33.43/blank/sms/user/urlsmstemp.php?username=wegus&pass=wegus@123&senderid=I
    WEGUS&dest_mobileno=9986982227&tempid=36890&F1=XXXX&F2=XXXX&F3=XXXX&response=Y

     

     

    Check Balance

    Information to get SMS credit balance, following URL, along with required parameters, need to be accessed:

     

    http://123.63.33.43/blank/sms/user/balance_check.php?username=XXXX&pass=XXXX

     

    Change Password

     

    If you need to change the password, following URL is given below:

     

    http://123.63.33.43/blank/sms/user/change_password.php?username=XXXX&oldpassword=XXXX&newpassword=XXXX

     

    username This will contain the username of the user
    old password This will contain the password of the user
    new password This will contain the new password that has to be changed with old password.

     

    Reports

    After each request is made, response ID is generated. The same request can be posted for collecting the DLR's.The URL for collecting the DLR's:

     

    http://123.63.33.43/blank/sms/user/response.php?Scheduleid=2126-2010_12_23

     

    List of Return Value When HTTP Request is made:

     

    Authentication Failed If username and password does not match
    account deactivated If the account of user is inactive
    No Privilege If user does not have http url submission privilege/Right
    invalid account type If user is reseller
    Invalid senderid If sender id does not match
    Insufficient balance/Account
    Expired
    If balance is less than submitted sms volume OR if user account Expired
    Sorry unable to process If there is problem in processing the transaction.
    91XXXXXXXXXX DELIVRD If message is delivered successfully.
    91XXXXXXXXXX EXPIRED If message is expired.
    91XXXXXXXXXX UNDELIV If message is undelivered.
    91XXXXXXXXXX PENDING If message delivery report is pending.

     

     

    Now lets have a look on the following code which will be used to send sms using Cakephp:

    Create function for sending sms, using curl you need to send request to the API:

     

    protected function send_sms($senderId=null,$mobileno=null,$templateId=null, $data=array()){
    
    $url = "http://123.63.33.43/blank/sms/user/urlsmstemp.php?username=SanjayO&pass=123456&senderid=XXX&dest_mobileno=xxxxxxxxxx&tempid=xxxx&F1=Amuk%20&F2=Thanks%20for%20registering%20with%20us&F3=amukmca@gmail.com&F4=password&F5=abcd&response=Y";
                
                // create a new cURL resource
                $ch = curl_init();
    
                // set URL and other appropriate options
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_HEADER, 0);
    
                // grab URL and pass it to the browser
                $output=curl_exec($ch);
                
                // close cURL resource, and free up system resources
                curl_close($ch);
                
                return $output;
            }

     

     

    For more details of pricing you can go to Wegus Infotech

     

    Thanks for reading.

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: