How to send SMS using API

May 20, 2014
admin
1. Basic Information
Screen Magic API provides an open HTTP based API for integrating SMS capabilities into any
application.
1.1. Screen Magic API version 1.0
Screen Magic API version 1.0 is designed to enable a user to send single message using HTTP
GET formats and bulk messages using HTTP Post. APIs provide single authentication for multiple
target numbers for a single message.

1.2. Guidelines for Sending Messages
Following Guidelines must be followed while using APIs for sending messages.

1.2.1. Receiver Mobile number
The country code of the receiver’s Mobile number is 91. No special characters like ‘+’, ‘-’, ‘(‘, ‘)’ or anything similar are allowed in the Mobile number string, A valid Mobile number can look like 9869123456, 09869123456 or 19869123456
1.2.2. Message Text

The message text’s maximum length is 724 characters. Our API will discard any message with more than 724 characters. If the length of message exceeds the default length of a single SMS, then the message is broken down into multiple SMSes. Messages should be URLENCODED see section 1.2.3 for more details.

1.2.3. Encoding the Message

The message text should be encoded. The message should be UrlEncoded(also known as percent encoding) string of UTF-8 characters. For more information on URL encoding please see this http://en.wikipedia.org/wiki/Percent-encoding. For e.g., message before encoding: “hey Amit! Come here soon!! ” message after encoding hey%20Amit%21%20Come%20here%20soon%21%21%20”

2. Sending Message
2.1. Sending Single Message Using Get Request.
User can send a text, Unicode text message using the API. To send a message to a mobile number using API, The following will be the request using HTTP GET for XXX sender with (username=yyyyy). The parameters can be sent any order.

URL Syntax:
https://sms-magic.in/smapi/get?userid=aaaa&accountid=cccc&to=91xxxxxxxxxx&senderid=dddd
&hashkey=xxxx&msg=Welcome+to+Screenmagic

2.1.1. Parameters
Parameter Name Values Required,Description
Userid Credential provided by Screen Magic Yes The username is simple string
Accountid Account number provided by Screen Magic Yes Account Number must be in numeric format
Senderid Sender’s Id provided by Screen Magic Yes Sender is numeric or alphanumeric string
To Mobile number of receiver Yes The receiver number should be numeric format and start with 91
Msg URLEncodeded String of UTF-8 characters Yes It can be alphanumeric and special characters. UTF-8 characters
Hashkey Encrypted Hashkey Yes How to generate:use standard md5 encryption technique. Generate md5 hash of concatenation of userid, password, accountid, senderid, mobilenumber and msg
2.1.2. Success Response
Success | 919812345678 | 728014710863298817-313604584004701606
The response of any request is a string of pipe separated tokens. The first token tells that the request was successfully submitted. Then second token is the Mobile number of the receiver. The third token is the unique identifier that is generated for each Mobile number.
2.1.3. Error Response
Error | <Error Code> | <Error Message>
The response of any request is a string of pipe separated tokens. The first token tells that the request was Error. Then second token is the Error Code. The third token is Error Message.
2.2. Sending Bulk Messages Using POST request
We have enabled sending bulk SMS’s in one request to server. Considering the load on the server and network latency issues, single request can send maximum 100 SMS. Credit limit will be checked before sending SMS and number of messages will be sent as per available credit limit in your account

URL Syntax:
https://sms-magic.in//smapi/post

You need to compose SMSes using following xml

<?xml version="1.0"?>
<m:Library xmlns:m="http://screen-magic.com" xmlns="http://www.defns.com">
<userid>[userid]</userid>
<senderid>[senderid]</senderid>
<accountid>[accountid]</accountid>
<hashkey>[hashkey]</hashkey>
<message mobilenumber="91xxxxxxxxxx" > <![CDATA[message text 1]]> </message>
<message mobilenumber="91xxxxxxxxxx" > <![CDATA[message text 2]]> </message>
</m:Library>
2.2.1. Parameters
Parameter Name Values Required Description
Userid Credential provided by Screen Magic Yes The username is simple string
Accountid Account number provided by Screen Magic Yes Account Number must be in numeric format
Senderid Sender’s Id provided by Screen Magic Yes,Sender is numeric or alphanumeric string
text XML String Yes Send XML string described in 2.2 as post parameter with Key as “Text”.
Hashkey Encrypted Hashkey Yes How to generate: Use standard md5 encryption technique. Generate md5 hash of concatenation of userid, password, accounted and senderid
2.3. Response
It will be XML string with following format:

 

<?xml version="1.0"?>
<m:Library xmlns:m="http://screen-magic.com" xmlns="http://www.defns.com">
<response> response text </response>
<response> response text </response>
<response> response text </response>
</m:Library>

 

Response element will contain response message described as per 2.1.2 and 2.1.3. XML should contain response corresponding to every message sent.

Tags:

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>