Usage
Assumptions
The Windows Service and Database have been installed. Refer to the Windows Service Installation Guide for installation instructions.
Database Structure
The following explains the database and its tables and stored procedures, installed as part of the Windows Service installation instructions.
User Table
Column | Description |
---|---|
UserID | Auto number. The user needs to exist on the SMS Gateway. |
Username | The Username of the user on the SMS Gateway |
Password | The Password of the user on the SMS Gateway |
Credits | The number of SMSes remaining on the account |
Active | If set to False the service will not monitor the account for any changes or send your messages |
SendStartHour | This depicts when the service should start monitoring this account to send. If set to 5 then any time after 5:00 will be included. |
SendEndHour | This depicts when the service should stop monitoring this account to send. If set to 17 then any time before 17:59 will be included. |
GetRepliesInterval | Value in minutes. How often the system will check the gateway for new replies. If set to “0” it won’t perform this operation. |
GetDRInterval | Value in minutes. How often the system will check the gateway for new DRs (Delivery Receipts). If set to “0” it won’t perform this operation. |
GetSCInterval | Value in minutes. How often the system will check the gateway for new incoming shortcode (premium number) entries. If set to “0” it won’t perform this operation. |
ProcessQueueInterval | Value in seconds. How often the system will check the QUEUE table for new data to send for UserID X. If set to “0” it won’t perform this operation. |
MaxRepliesID | Internal value – do not touch |
MaxDRID | Internal value – do not touch |
MaxSCID | Internal value – do not touch |
LastProcessReplies | A date depicting when last the service checked for replies. Internal value – do not touch |
LastProcessDR | A date depicting when last the service checked for DRs. Internal value – do not touch. |
LastProcessSC | A date depicting when last the service checked for shortcodes. Internal value – do not touch. |
LastProcessQueue | A date depicting when last the service checked for data to send. Internal value – do not touch. |
Post Paid Customers
Credits will always return a value of 1000000 on Post Paid accounts as no credit deduction occurs on this account type.
Queue Table
This table defines when and what should be sent.
Column | Description |
---|---|
ID | Auto number. Used by the service. |
UserID | Used by the service to determine if the data needs to be sent based on the rules for this user. |
Type | “SMS”. |
SenderID | This is where the SMS will originate from. This may or may not be allowed depending on the settings on the SMS Gateway, country/network restrictions, etc. Default = “Repliable” |
NumTo | Where the SMS will be sent. |
Data1 | Message Text |
Data2 | |
Flash | False |
SendDatetime | This is the time you want the message to be sent. The message is only sent to the SMS Gateway once this field is greater than the current time. |
Priority | The higher the priority the quicker the service will process this message. |
Retrycount | Internal value. Starts at “-1”. If it has failed after 3 attempts it gets removed and inserted into the SENT table with status “RETRYCOUNT EXCEEDED”. |
CostCentre | This can be used to do reporting on which business units sent messages |
CustomerID | This value is purely for integration with your software. You can write data to the field, which you can then use later to query. E.g: If you have an application writing its own unique IDSs (GUIDs) you will easily be able to tie the data back to your system. |
The following fields must be populated for data to be sent successfully
a. UserID
b. Numto
c. Data1
Sent Table
The SENT table contains the exact same structure as the QUEUE table, with the following exceptions:
Column | Description |
---|---|
SubmittedDatetime | When the SMS was submitted to the SMS Gateway |
StatusDatetime | When the status was altered from the SMS Gateway |
Status | The status of the message. For successfully submitted messages this can be “DELIVRD”, “UNDELIV”, ”EXPIRED”, ”UNKNOWN” |
Reply Table
This table contains all the incoming messages.
Column | Description |
---|---|
ReplyID | Determined by the SMS Gateway. Internal use. |
ID | The corresponding ID in the SENT table (matches to an outgoing message). |
UserID | The user that sent the message. |
ReceivedData | The incoming data. |
ReceivedDatetime | When the reply was received. |
OptOut * | If the message contains keywords indicating that the client wishes to opt-out then this field is set to 1 (True), else 0 (False). |
CustomerID * | A user defined value that can be used for matching. Any status updates or replies relating to this message will be marked with the same CustomerID. |
Fields can only be used in the most recent version of the Windows Service. Please contact support for more information
Shortcode Table
This table contains all the incoming messages from shortcodes (premium numbers).
Column | Description |
---|---|
ID | Determined by the SMS Gateway. Internal use. |
UserID | The user that sent the message. |
Shortcode | The shortcode number, e.g: 31234. |
Keyword | If the short code operates from a keyword then it will be displayed, otherwise blank. |
NumFrom | The number the message originated from. |
Data | The incoming data. |
Received | When the reply was received. |
Example 1
Careful configuration of the USERS table will let the service control how messages are being sent. The example below shows such a situation.
Two user accounts with the same Username can be inserted into the USERS tables, resulting in Userid 1 and 2 . The Userid record can be configured so that Userid 1 is restricted to sending between 8:00 and 17:59, and Userid 2 from 0:00 to 23:59. This allows, for example, to write important messages to Userid 2, which will be sent at any time of the day, and bulk messages to Userid 1, restricting them to business hours only.
Due to the architecture of the system, new columns can be added to any table for customisation. This will allow the storage of more data against each outgoing message and is useful for specific business requirements. When making these customisations, ensure that the stored procedures that refer to these tables are also updated so that data from the QUEUE will be added to the SENT tables, etc.
Example 2
The system monitors the QUEUE table based on the USERS table.
The system collects the data from the QUEUE table and, once submitted to the gateway, removes it and inserts the data into the SENT table.
The status in the SENT table will be “SUBMITTED”. If there was an issue with the data it will still submit it, remove it from the QUEUE and insert into the SENT table. The status could vary from “data1 invalid” to “number invalid” depending on whether the data was correct.
Updated about 5 years ago