Luscious SMS Plugin Designer
Luscious SMS Plugin Designer Beta 0.1
Luscious SMS JavaScript plug-in manual
Develop your own JavaScript-Plugin for Luscious SMS
The power of WebKit: The sending of messages with Luscious SMS is supplied by a WebView. WebView is based on the WebKit / KHTML Engine and is also used by Safari. The controlling of of the actions on providers websites - which are loaded in the WebView - is managed by the JavaScript-Plugin.
The development of a plugin is easier than it seems. But it would be an asset if you have knowledge of HTML and JavaScript.
Step by step instruction
You find the installed respectively pre-installed Plugins under "~/Library/Application Support/Lucsious SMS/Plugins". Open the Plugin folder. Here you find all installed Plugins.
A Plugin consists of two files, a plugin-icon (.tiff extension; attention with two t) and a JavaScript file (.js extension). duplicate the files "ch.treeinspired.tree-sms.js" and "ch.treeinspired.tree-sms.tiff".
Plugin Icon
Open the duplicated plugin-icon with a image editor and insert your plugin-icon. Keep the size of the image. Save the image as a .tiff file.
Make sure not to violate any copyrights
JavaScript-Plugin
Open the duplicated JavaScript file. In the following Below the functions in the JavaScript files are explained. You may modify them according your needs.
LS_Plugin_APIVersion ()
As in the future the Plugin-architecture will be extended, it is necessary that the software only displays the Plugins in the Plugin Manager which supports it. Based on the return-value can the software decide if the plugin is supported in the application or not. The current plugin API-version is 1.0.
LS_Plugin_Country ()
If the plugin is used only for a specific country, remove the comment out - tag, so that the function is being used. If the plugin is used worldwide, remove the comment out - tag at "Worldwide".
LS_Plugin_UID ()
This has to be a unique key which does not exist a second time. preferably use your domain name and the plugin name as sub-domain. For example "com.myDomain.myPlugin". This value my not be changed any more (e.g. at a plugin update).
LS_Plugin_Name ()
This is the plugin name, which is visible for the user in the software.
LS_Plugin_Version ()
Version of the plugins. If you change anything in the plugin, you always have to increment the value of the latest version (e.g. "1.0", "1.1", "2.0", "2.1", "2.2", "2.3", "3.0", ....).
LS_Plugin_Autor ()
If you open a window for writing a new message, the return-value is display in the lower left corner of the window.
LS_Pref_AllowedNumberPrefix ()
If your plugin only supports certain country codes or country codes- provider codes, return the according value here. Separate multiple values by "," without any spaces (e.g. "+41" or "+49,+4176,+4179"). If your plugin supports all country codes, the return value is "Any".
LS_Pref_RepresentedStringForUserID ()
At certain providers, the user id is equal to the e-mail address or the user name or the mobile phone number. Return the according user id value. This value is being displayed in the account management of the software.
LS_SMS_SMSSupported ()
Will be used in a later version of the software. Leave the return value "Yes".
LS_SMS_SMSMaxCharacters ()
Specify the maximal possible amount of characters per SMS.
LS_Action_MainAction (url, message, recipient, username, password, mode, extraParameters)
Parameter description:
url = The current loaded site in WebView. On first load of the WebView is the "url" blank.
message = Message text with maximum length of "LS_SMSMaxCharacters ()" characters. Long SMS or messages with multiple recipients will separate processed in the script. That means the script will per executing only send one SMS with one recipient.
recipient = The number of the recipient in international format (e.g. "+41763888435")
username = Contains the user id which is entered specified in account management in Luscious SMS.
password = Contains the password which is entered specified in account management in Luscious SMS.
mode = Currently without function.
extraParameters = Currently without function.
Return value description:
A return value finish the sending process. Return only a value when the message successfully sent or when error occurred.
The following return values are possible:
return ("100") = Message successfully submitted to carrier.
return ("101") = Username or password incorrect.
return ("102") = Passwort incorrect.
return ("103") = Username incorrect.
return ("104") = Account not activated.
return ("105") = Mobilephone number not deposited.
return ("106") = Mobilephone number not validated.
return ("200") = The target number is invalid.
return ("201") = The sender identification are doesn't have the right format.
return ("300") = Error by authentication (e.g. credits empty, key incorrect, account incorrect)
return ("301") = Credits empty.
return ("302") = Unknown error.
return ("400") = Error by data transfer to Carrier. Please try again later.
return ("600") = Day limit obtain.
return ("700") = Month limit obtain.
return ("800") = IP address locked.
return ("900") = Target number blocked in customer center.
return ("1000") = Message to long.
return ("1001") = No message text indicated.
return ("1100") = Target number are not allow.
return ("1200") = Suspicion on spam , delivering blocked.
return ("1600") = No target number indicated.
Process which must be executing in all steps in the script:
Check if the message was sent, if the login failed and similar processes. Use if / else if to check if processes occurred. For a example take a look to existing plugins.
Description of the sending process
1. The user writes messages with two recipients and message text which stretched over two SMS.
2. Luscious SMS execute the function LS_Action_MainAction (url, message, recipient, username, password, mode, extraParameters) with matches parameters. The JavaScript starts the process with window.status = "progress:start";. window.status = "message:Login"; is the information (in this example "Login") for the user to know what's going on in the hidden WebView. What information you want to give to the user about the process is your choice. For this are no rules defined.
The plug-in must now open the first page, typically the home-page or login page (e.g. window.location.href = "http://www.treeinspired.ch/neu/index.php";).
3. After complete loading of site, the WebView execute again the LS_Action_MainAction(...) function with all parameters. In parameter "url" is now the URL from the currently loaded site in the webview.
4. Change the process status in Luscious SMS
(e.g. window.status = "message:Authentication";).
Fill out the HTML input fields with username and password and submit the form.
5. Change the process status in Luscious SMS.
Load now the desired page / pages. Fill out again forms or submit forms (e.g the form for the message and recipient).
6. If the message was successfuly sent return return ("100");.
The process is now finish done. Luscious SMS starts the whole process again for the remaining three messages.
Finish
Save and close the JavaScript file. Rename the plug-in icon and the plug-in JavaScript. Use as name the plugin identifier (e.g. com.myDomain.myPlugin.js / com.myDomain.myPlugin.tiff). You are free to share you great plugin with other users. Upload it in your account (it's free to create a new account) on www.treeinspired.ch.
Thank you.
Philippe Regenass
AIM: eselmac
E-mail: dev@treeinspired.ch
SMS Gateway API for third-party developer
SMS is powerful way to inform customer, coworker and friends. If you want expand you application you can useing the follogin API to send SMS over ours Gateway (Account on TREEINSPIRED.com) presupposed.Create Account
If you are using the API for your self or one specificated mobilenumber, create Account here on TREEINSPIRED and validate your existing mobile phone in account. If you want submit custom sender-number for every message, contact us dev@treeinspired.ch.
Submit SMS
Form POST-URL: http://www.treeinspired.ch/inc/luscious4mobile.php
Username (POST-Variable): u
Password (POST-Variable): p
Target Mobilephone-Number (POST-Variable): nr
Message-Variable POST-Variable: msg
Sender-Number (POST-Variable): See top information about custom sender-numbers
Contact
Philippe Regenass
AIM: eselmac
E-mail: dev@treeinspired.ch

