How to integrate OemSMS with a 3rd party SMS gateway

 

Archive

Search

In this tutorial, we will show you how to integrate OemSMS plug-in with a 3rd party SMS gateway which has HTTP API integration feature. This process will take about 5 to 10 minutes depending on your PHP experience.

Before we begin, please be sure that your SMS gateway service supports HTTP API connection method. Please contact your gateway to get a copy of their SMS API gateway manual. We assume that you have already installed OemSMS plug-in into your Oempro application.

OemSMS distribution package contains a series of SMS gateway integration modules such as Clickatell.com. To make this integration process even easier, we will go ahead with Clickatell.com integration module and create new integration module for your SMS gateway.

Steps To Complete

  1. Getting required parameters of your SMS gateway API connection
  2. Develop integration module
  3. Register new integration module in OemSMS
  4. Test the integration

1. Getting required parameters of your SMS gateway API connection

Your SMS gateway will require some authentication information to be passed into their API. This can be username/password, API ID or similar information. Your SMS gateway API manual will describe this required information. OemSMS lets you to store up to 10 information regarding your API connection.

2. Develop integration module

In the first step, you learned the required information to be passed into your SMS gateway API. Now, it’s time to create a new connection module in OemSMS plug-in and link it to your SMS gateway API.

Open your PHP code editor (with a text editor such as textedit, textmate, notepad++, etc.) and go to your Oempro classes directory (oempro/system/classes).

You will see the list of all available classes for Oempro and OemSMS in this directory. Files starting with ‘plg0007_’ belongs to OemSMS plug-in:

As you can see above, OemSMS comes with several SMS gateway API integration modules including 360SMS, Clickatell, SMSGui, TextAnyWhere, Yakoon, ZniSMS.

To create your own API connection module, copy plg007_api_clickatell.php and create a new file which starts with plg007_api_xxxx.php (replace xxxx with a preferred name).

Now edit your new API connection file (plg007_api_xxxx.php). Scroll down to “SendSMS” function. This function sets required data to be passed into your SMS gateway API and also performs the connection.

Change the array above based on your SMS gateway API connection parameters. As mentioned above, OemSMS has capability to pass 10 extra information addition to username, password and API ID parameters. Therefore, you can customize the information that will be passed in.

Now, it’s time to remove Clickatell.com specific algorithm. Under the $ArrayParameters defintion, there is an algorithm block which performs some special information for Clickatell.com SMS gateway. Remove that part:

Now scroll above to the beginning of the file. You will see a variable definition block which defines the API connection URL:

Change the $_APIHost and $_APIPath to the correct values described by your SMS gateway API document.

That’s all. Your API connection module is ready to be used. The next step is to make this module “available” in OemSMS.

3. Register new integration module in OemSMS

You will need access to your Oempro database to complete this step. Open your MySQL browser (ex: phpMyAdmin) and browse “oemp_plg0007_api_list” database table. You will see a list of all available API connection methods in this table. Please don’t forget that every row in this table has also API connection class described as in step 2:

Now, add a new row to this table. Description of table fields are:

  • APIID: Leave emptry. It will be numbered automatically by MySQL.
  • Name: Name your SMS gateway
  • URL: Descriptive URL information of your SMS gateway
  • ModuleName: Enter the class file name you have set in step 2. For example, plg007_api_xxxx.php
  • ExtraValues: If your SMS gateway API requires more authentication information other than username, password and/or API ID, enter the number of additional fields required for this API.

Okay, once you create the new row, OemSMS will be able to use your new API connection method. Now, it’s time to set a connection preference in OemSMS through “Plug-Ins > OemSMS > Preferences > Add New SMS Account” button.

If you have any questions regarding the integration, do not hesitate to contact our support department via support [at] octeth [dot] com with your license key.

18th Jun 2008, Posted by Posted by Cem Hurturk under Filed under OemSms Comments

Leave a Reply