Personal tools
Namespaces

Variants
Actions

SMS Center For WHMCS

From ModulesGarden Wiki
(Difference between revisions)
Jump to: navigation, search
(SMS Center And WHMCS API Integration)
(SMS Center And WHMCS API Integration)
Line 775: Line 775:
 
''(Relid)'' for ''(adminid)'' is an ''' 'array' '''<br/>
 
''(Relid)'' for ''(adminid)'' is an ''' 'array' '''<br/>
 
<br/>
 
<br/>
4. Standard usage example of sending an SMS with specified message to a user with given ID:<br/>
+
4. A typical example usage for sending an SMS with a specified message to the user with a given ID:<br/>
 
   
 
   
 
  localAPI('sendsms', array('userid' => $_POST['userid'], 'message' => $_POST['message']), 'admin');
 
  localAPI('sendsms', array('userid' => $_POST['userid'], 'message' => $_POST['message']), 'admin');

Revision as of 10:46, 11 May 2017

Contents

About SMS Center For WHMCS

SMS Center For WHMCS is a module created to send text messages to your clients and administrators.

You will be able to choose from ten different SMS gateways, define SMS templates in various languages and manage bulk text messaging.
The module will allow you to verify new clients and orders as well as enable SMS codes as a part of two-factor authentication while logging in to your system.
You will also get the access to SMS messages logs in order to verify the status of each sent text message.

  • Admin Area Features:
✔ Notify Both Your Clients And Administrators via SMS Message
✔ Define SMS Gateway To Be Used Per Country
✔ Use SMS Queue To Send SMS Within Defined Time Period
✔ Manage List Of Queued SMS
✔ Send Mass SMS Using Recipient Filtering
✔ Define SMS Template Counterpart For Each Email Template
✔ Define Mass SMS Template
✔ Define Default SMS Template Version For Each Language
✔ Define Notifications To Receive Per Administrator
✔ Choose Products To Notify Administrator When They Are Ordered
✔ Notify Chosen Administrator When:
✔ Selected Product is Ordered
✔ Specified Product Addon is Ordered
✔ Specified Domain is Ordered
✔ Ticket With Specified Priority is Opened
✔ Enable/Disable Administrator Notifications Per Admin
✔ Enable/Disable SMS Gateways
✔ Check Connection With SMS Gateways
✔ Enable/Disable SMS Templates
✔ View Clients And Orders Verification Status
✔ Manually Verify Client Status On Client Summary Page
✔ Send SMS From Client Summary Page
✔ SMS Templates - Merge Fields Support
✔ Characters Counter - Trace Length Of Your Messages
✔ Choose Client Custom Field To Be Used As Client Phone Number
✔ Set Custom Token Length And Characters Set
✔ Adjust Format Number To International Automatically
✔ View Logs
  • Client Area Features:
✔ Define SMS Notifications To Receive
✔ Request SMS Token To Resend
  • Security And Verification:
✔ Two-Factor Authentication Submodule - Use Second Layer Of Security:
✔ Client Area Login
✔ Admin Area Login
✔ Verify New Client Accounts With SMS Token
✔ Verify New Orders With SMS Token
  • Mass SMS Recipient Filtering:
✔ Client Account Filter:
✔ Account Statuses
✔ Account Custom Fields
✔ Account Languages
✔ Addon Filter:
✔ Purchased Addons
✔ Purchased Addon Statuses
✔ Domain Filter:
✔ Domain Statuses
✔ Product Filter:
✔ Purchased Products
✔ Purchased Product Statuses
✔ Purchased Product Servers
  • Supported Gateways:
✔ BearSMS
✔ BoxisSMS
✔ BulkSMS
✔ Clickatell
✔ Fastsms
✔ InfoBip
✔ MessageBird
✔ Nexmo
✔ SMSEagle
✔ SMSGlobal
✔ Twilio
  • General Info:
✔ Module API - Integrate Other SMS Gateways
✔ Integrated With Clients Profiler For WHMCS - Send SMS From Any WHMCS Place (read more)
✔ Multi-Language Support
✔ Supports PHP 5.4 Up To PHP 7
✔ Supports WHMCS Templates Five and Six
✔ Supports WHMCS V6 and V7

Installation

This tutorial will show you how to successfully install and configure SMS Center For WHMCS.

We will guide you step by step through the whole installation and configuration process.

Installation

1. Log in to your client area and download SMS Center For WHMCS.
SMSC 1.png
2. In the downloaded file you will find two packages that support different PHP versions.
As presented on the screen below, the first one is dedicated to PHP 7, while the second one is aimed at PHP 5.4 up to PHP 5.6.
It does not apply to open source versions.

Note: You can check current PHP version in your WHMCS. To do so proceed to 'Utilities' → 'System' → 'PHP Info'.

SMSC 2.png
3. Extract the downloaded file and choose the one with the right PHP version. Upload and extract the PHP file into the main WHMCS directory.

The content of PHP version files should look like this.

SMSC 2 2.png
4. When you install SMS Center For WHMCS for the first time you have to rename 'license_RENAME.php' file.

File is located in 'modules/addons/sms_center/license_RENAME.php'. Rename it from 'license_RENAME.php' to 'license.php'.

SMSC 3.png
5. In order to configure your license key, you have to edit the previously renamed 'license.php' file.

Enter your license key between quotation marks as presented on the following screen. You can find your license key in your client area → 'My Products'.

SMSC 4.png

Activate The Addon

5. Now, you have to activate the module in your WHMCS system.

Log in to your WHMCS admin area and proceed to 'Setup' 'Addon Modules'.
Afterwards, find 'SMS Center' and press 'Activate' button.

SMSC 5.png
6. In the next step you need to permit access to this module.

To do so, click on 'Configure' button, tick checkboxes to assign desired admin roles.
Choose a country code prefix that will be automatically added to the client's SMS number if it has not been specified. Press 'Save Changes'.

SMSC 6.png
7. Now, proceed to the addon → 'Integration Code' and follow integration instructions.

Remember that integration depends on the WHMCS version and template that you are using.
If your system used is WHMCS V6.x.x and template: 'Six', there is no need for you to do any integration.
However, if you are working with WHMCS V6.x.x template 'Five' or WHMCS V5 then you must insert the code snippets as it is explained on the screen below.

SMSC 8.png
8. The last thing you need to still do is setting up a cron job. It is advised to set the cron job with a 1 or 2 minutes interval.
/your_whmcs_dir/modules/addons/sms_center/crons/cron.php

Remember to replace your_whmcs_dir with a correct directory of your system.

9. You have just successfully installed SMS Center For WHMCS!

Configuration and Management

SMS Center For WHMCS is a module which allows you to send predefined text messages to your clients the same way emails are sent.

Configuration

Under 'Configuration' tab you will find 'Submodules', 'Administrators' and 'General' sections. Configure each of them to allow full usage of SMS Center For WHMCS module.

Press the first one 'Submodules' to configure and check connection with SMS gateways.

Submodules Configuration

Find here all possible gateways that can be used in our module.

You can use a recommended 'FastSMS' gateway:

SMSC 9 1.png
Or choose form other acceptable gateways:
SMSC 9 2.png
Press 'Configuration' next to a gateway you wish to use.
SMSC 9.png
Configuration of each gateway may vary depending on its requirements.

As an example we will configure SMSEagle gateway.
Apart from connection details, you may here define which countries the gateway shall be used in.
In case you are going to activate more than one gateway, you must point one of them as default.

SMSC 10.png
You can check whether configuration is correct through pressing 'Check Connection'.
SMSC 11.png
If connection is successful, we can proceed.

Activate the gateway, press 'Enable' next to it.

SMSC 12.png
As mentioned before, you may activate more than one gateway.

All you need to remember is to set one gateway as default, assignment of countries to a gateway is not obligatory.
If a gateway has no countries assigned, but is set as default, then text messaged will be sent via this gateway and localization requirements are not fulfilled with any other gateway.
If active gateway is not set as default and there are no countries assigned to it, such gateway will simply be not used.

SMSC 12 1.png

Administrators Configuration

This section contains a list of all staff administrators.

You have the possibility here to decide who of them will receive SMS notifications and which notifications exactly.
Follow the steps described below to configure staff notifications properly.

Press 'Administrators' under 'Configuration' tab.

SMSC 22.png
In order to enable SMS notifications for administrators individually, firstly set configuration for them.

1. Fill in the administrator's phone number, where text messages with notifications will be sent.
2. Choose which of the available admin messages shall be sent to that administrator.
3. Choose products to notify when they are ordered.
4. Select Ticket priority, you will be informed when a new ticket with selected priority is opened. Save changes.

SMSC 23.png
Press 'Enable Notifications.'

Repeat these steps for every administrator you wish to receive admin notifications.

SMSC 24.png

General Settings

In 'General' section there are specific SMS configuration possibilities. Configure those you wish to activate and 'Save' the changes once ready!

By default, 'SMS Center' for client area is enabled, you may disable it here.
Note for WHMCS V5: You must insert integration code snippets to properly use SMS Center in your client area.
If you disable it once codes are inserted, the button will still be visible in your client area but you will not be able to access it.

SMSC 24 1.png

Order SMS Activation

Enable 'Order SMS Activation' to allow activating orders once placed.

Once an order is placed a client will receive a text message with a token, which must be then used to finish the order.
You may define here how many times a client will be allowed to ask the token to sent again within one hour.
Note, this option does not support orders upgrades!

SMSC 24 2.png
If the above option is enabled, a client when placing an order before being able to complete it must enter a valid token that was sent via SMS.
Only then the order can be completed.

Depending on the settings, you may allow clients to ask for resending the token.
The client only needs to press 'Resend Token' button and they will receive another text message.

SMSC 37.png
If provided token is correct, the order's verification status is changed to 'Confirmed'.
SMSC 37 1.png

Client SMS Activation

Enable 'Client SMS Activation' and every newly activated client will receive a token, which must be used to end up the activation process.

Declare time intervals for sending tokens here and allowed number of attempts to resend the token.

SMSC 24 4.png
With the above option enabled, the process of a new client's activation is a little bit different. Start with filling out the client's details.
SMSC 36.png
When added, the client's verification status will be 'Unconfirmed'.
SMSC 36 1.png
To verify activation the new client needs to log in to their client area page and type in a token received via SMS.

If allowed by administrator, client may request sending the token again by pressing 'Resend Token' button.

SMSC 36 2.png

As an administrator you can also verify client's account manually.
To do so, go to your client's profile and click the 'Verify' button:

SMSC 36 4.png
Client's status has now changed to 'Confirmed'.
SMSC 36 3.png
Please be advised that whenever the client changes their phone number - the status will revert to 'Unconfirmed' and the verification process will have to be repeated.

SMS Queuing

Enable this option to allow text messages queues.

Declare time intervals between attempts to send text messages and the number of messages that can be sent in one attempt.
Finally, choose time period when text messages can be sent to clients. Detailed information on this function is described here.

SMSC 24 3.png

Token Configuration

In this section you can also change default token settings by defining own token length and available characters set.

Please note that allowed set of characters used for generating a token may contain chars from the following range only:

1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
SMSC 24 6.png

Custom Fields

Finally, select which of the existing client custom fields should be used to provide the client phone number to send messages.
SMSC 24 5.png

Management

Templates

'Templates' tab contains the list of message templates. Each email template in your system has its text message counterpart.

Any of these messages can be enabled/disabled through marking/unmarking checkbox next to them and pressing 'Save'.
Note: Titles of the messages templates can be translated in the module language file.

SMSC 13.png
Module comes with default message templates, but you can edit each of them.

Press 'Edit' to do so.

SMSC 13 1.png
The first field is a default message of the template. Our module allows you to define messages for selected languages.

In order to prepare a message in an additional language, select desired language from a dropdown menu and press 'Add' as shown on the following screen.

SMSC 14.png
As you can see on the screen below, a new field for chosen language appeared.

You can remove any additional language through pressing 'x' icon next to it.
Note: Language of a message sent is based on client's language, if message for client's language is not defined, default message will be sent.

SMSC 15.png
Module template supports merge fields which can be easily injected into messages.

Simply, click on the wanted merge field, it will be injected into currently edited version of the message.

SMSC 16.png

SMS Queue

In this section you will find a list of all text messages waiting for a cron run to be sent.

Specific details on messages that can be sent in one attempt are specified in 'General' section.
If SMS Queues are enabled every single message before being sent is placed on this list. With every cron run a previously set up number of messages is sent.
If message sending fails (because the number is incorrect, there are problems with gate, no funds etc.) such SMS stays on the list for the next attempt.
After three failed attempts its status is changed to 'Aborted'.

Actions:

1. Send - send message manually.
2. Reload - use when status has changed to 'Aborted' to bring it back to the queue.
3. Delete - remove message form the list.

SMSC 16 1.png
Select multiple entries and remove them in bulk to save the time.
SMSC 16 2.png

Mass SMS

Sending mass text messaged to your clients is a convenient tool that allows preparing ready made messages that will be delivered to group of clients according to specified configuration.

Mass SMS Templates

Firstly, move to 'Mass SMS' → 'Templates', there create templates for mass texting.

Press 'Create New Template' to begin.

SMSC 44.png
You are moved to template creation site.

Enter your template name, choose a group it will belong to and type in the message text. Use available for the group merge fields.
Do not forget to save the changes.

SMSC 45.png
All created templates are available to edit or remove when no longer used.
SMSC 46.png

Mass SMS Configuration

Now, that you have created the templates move to 'Mass SMS', there configure the recipient group. Use filtering fields to set it up as you need.

Select the type of filtering, you can choose from:

  • 'General' filtering
  • filtering according to 'Addons', 'Domains' or 'Products'.

Each filter type configuration differs slightly, but there are some general settings available for each type. These are:

  • Custom Fields - enable available custom fields;
    'Marketing SMS' is a default addon custom field, if you enable it, clients will receive marketing notifications
  • Client Group - select which of your client groups will receive the text message
  • Client Status - you may choose clients to receive messages depending on their status in your system
  • Language - select default language for the messages.

All the above sections are available for 'General' client filter.

SMSC 40.png
Every other filter includes these options as well, but there are also some additional filters to choose form for each of the types:

Client Filter - Addon

  • select purchased addon
  • select addon status
SMSC 41.png
Client Filter - Domain
  • select domain status
SMSC 42.png
Client Filter - Product
  • select products from purchased ones
  • select product status
  • select assigned server

Press 'Compose Message' to continue sending mass messages.

SMSC 43.png
When you have your filter ready, you will be moved to the next step where you may create a new text message or upload one of your previously prepared templates.
Choose it from dropdown menu and press 'Load'. When message is ready, press 'Next'.
SMSC 47.png
You can see now how the final SMS looks like and see the list of clients that will receive the message.

If everything is correct, press 'Send Message'.

SMSC 48.png

Logs

Messages sent to your clients are logged under 'Logs' tab.

As you can see on the following screen, here you can find detailed information about each message sent automatically to a client after certain actions.

SMSC 17.png

Client's Summary Page

From the clients' summary page you can send text messages to clients using only a simple box.

Type in the message text into the text field like on the screen below and press 'Send'.

SMSC 25.png

Client Area

After placing integration code, a new position appears in the client area navigation menu.

Through pressing it your client will be moved to configuration of SMS notification.

SMSC 18.png
In this place your client can choose which notifications to receive.

Note! Provide SMS Number in the client's profile. Otherwise SMS Notifications will be unavailable for that client.

SMSC 19.png

SMS Center Two-Factor Authentication

SMS center For WHMCS consists of two parts, the actual SMS Center addon and the authentication addon.

Two-Factor Authentication adds an extra layer of protection while logging in.
Once enabled and configured, each time they sign in they will be asked to enter both username and password as well as the second factor like a security code.
In order to activate it proceed to 'Setup' 'Staff Management' 'Two-Factor Authentication'.
Afterwards, find 'SMS Center Two-Factor Authentication,' and press 'Activate' button.

SMSC 20.png
In the next step you need to configure the addon settings.

To do so, fill out the data:

  • Enable for Clients - choose this option if you wish all clients to authenticate while logging in their account.
  • Enable for Staff - choose this option if you wish all administrators to authenticate while logging in their account.
  • Activation Code Valid For - decide how long a received code shall be valid, in minutes. Used once before the first log in.
  • SMS Code Valid For - decide how long a received via SMS code shall be valid, in minutes. Used every time to log in after the first authentication.
  • Code Length - specify of how many characters a code will be composed.
  • Allowed Characters - define which characters can used to generate the codes. Please note that some of special characters may cause unpredictable errors.
    Keep that in min when selecting chars like: ", &, >, < or similar.
SMSC 21.png

Security Settings

Clients

If you have activated 'SMS Two-Factor Authentication' addon, your clients will be allowed now to decide if they wish to use such security opportunity.

Here is how to enable such functionality:
1. Log in to your client area, proceed to 'Account Details' 'Security Settings'.
There is a button, which once pressed enables two factors authentication configuration for the client.

SMSC 26.png
2. Press 'Get Started' button to proceed with the process.
SMSC 27.png
3. Provide phone number to proceed with SMS Two-Factors Authentication. Press 'Activate.'

This step will be skipped if the client entered a valid SMS number in the profile before!

SMSC 28.png
4. A client should receive now an authentication code via SMS.
Type in the code in the field and press 'Activate'.
Remember that the code is valid only temporarily, according to the addon settings!
SMSC 29.png
5. Two-Factor Authentication is now complete.
SMSC 30.png
6. The second factor is now required to log in. Wait for the SMS with verification code and enter it in the field. Press 'Login'.
If you have any problems with receiving/entering the verification code, you can use your backup code.
Remember to note and keep your new backup code in a secure place!
SMSC 31.png

Administrators

If 'SMS Two-Factor Authentication' addon has been activated and enabled for staff, as an administrator you can decide if you wish to use such security opportunity.

Here is how to enable such functionality:
1. Proceed to 'My Account.' Find 'Two-Factor Authentication' and enable it to start the Two-Factor Authentication process.

SMSC 32.png
2. Press 'Get Started' button to proceed with the process.
SMSC 33.png
3. You will receive now an authentication code via SMS.
Type in the code in the field and press 'Activate.'
Remember that the code is valid only temporarily, according to the addon settings!
SMSC 34.png
4. If entered code is correct, you will see a proper information.
There will also be a backup code which must be copied and saved securely to log in with in case of some issues.
SMSC 35.png
5. The second factor is now required to log in. Wait for the SMS with verification code and enter it in the field. Press 'Login.'
If you have any problems with receiving/entering the verification code, you can use your backup code.
Remember to note and keep your new backup code in a secure place!
SMSC 35 1.png

SMS Center And WHMCS API Integration

Underneath you can find a short instruction on how to integrate your SMS Center For WHMCS with the WHMCS API.
1. Function name: 'sendsms'

2. Required parameters:

  • (phonenumber) OR (userid) OR (adminid)
    AND
  • (messagename) with (relid) - ID of relation, for example invoice or service OR (message) - text of the message


3. Where:
(Relid) for (userid) is an 'integer'
(Relid) for (adminid) is an 'array'

4. A typical example usage for sending an SMS with a specified message to the user with a given ID:

localAPI('sendsms', array('userid' => $_POST['userid'], 'message' => $_POST['message']), 'admin');

5. Example of usage for admin 'array' with parameters:

array('admin' => 1,'phonenumber' => $number, 'messagename' => 'Service Unsuspension Successful',
'relid' => array('client' => $params['params']['userid'], 'service' => $params['params']['serviceid']))

In case you add phonenumber in the message, you must specify if it is admin's number by entering: 'admin' => 1, like in the example above.
If this is user's number, then you no not need to add that.

6. Since 2.2.0 version of SMS Center there is also support for the new 'force' parameter. If set to 'true' it allows skipping the queue for sending SMS immediately.
Example of usage this parameter:

localAPI('sendsms', array('userid' => $_POST['userid'], 'message' => $_POST['message'], 'force'=> true), 'admin');

Additional Information

1. SMS Center For WHMCS has been integrated with our Clients Profiler For WHMCS module.
Find more information about the integration on Clients Profiler For WHMCS Wiki.
2. SMS Center For WHMCS messages are divided into four categories:
Messages sent automatically to clients after actions (activity is logged in the addon 'Logs' tab)
Messages sent automatically to administrators after actions (activity is logged in WHMCS 'Module Log' )
Messages sent manually from client's profile (activity is logged in WHMCS 'Module Log' )
Messages sent manually from Client Profile Viewer For WHMCS widget (activity is logged in WHMCS 'Module Log' ).

Tips

1. You may customize the text of 'Two-Factor Authentication' verification message delivered to a user.

Default message: 'Your account activation token is: erkhq34j329'
Change the message content in the addon language file.

Common Problems

1. When you have problems with connection, check whether your SELinux or firewall does not block ports.
2. The module is not compatible with Multibrand For WHMCS: there are no contradictions to use the two products together,
however, they are not integrated which means that a client may for example choose from (SMS) templates for every brand (text messages are not branded).
3. The module is not compatible with Resellers Center For WHMCS functionality.
Navigation
WHMCS Modules
WHMCS Widgets
Translations
cPanel Modules
General
FAQ
Community
SMS Center For WHMCS