Slack Integration for WHMCS

From Deploymentcode
Jump to: navigation, search

Screenshots & Demo Video

Demo Video

Click on fullscreen for better viewing


You can order this module here

It is useful when you always know what happens in your system. With the Slack for WHMCS module you dont need to refresh the page every 15 minutes to see that there is a ticket waiting for reply. Now you get instantly notified if something happens on your system.
You can choose on which events you get alerts, also you can post messages to different and multiple channels or persons.

That is the most mature Slack Module for WHMCS. It does not only look nice, it also has some cool features!

Unlike other modules, this module does not post the message directly to slack. It does maintain a message queue. So you ask why that is important?
Because if you send messages directly to Slack, there will be a small delay at the page load time for the customer. Your WHMCS Installation will wait until Slack processed your request.
Much worser it is if the slack service is not reachable from your server. Then your clients will have a long page load time delay until the request time outs.

With this module you get your own sending API. You can send messages from your own scripts to the slack channels and also can integrate external services with your own, easy to use, HTTP based API.
The HTTP based API can be useful if you want to integrate an external monitoring service (like Zabbix or Nagios) into slack.


  • Get notifications for more than 20 events.
  • Enable / disable notifications individually.
  • Highly customizable message text.
  • Notifications can be posted to multiple channels or persons.
  • HTTP Based API for your own messaging service.
  • Easy PHP function to send slack messages. Function is globally available in your WHMCS installation.
  • WHMCS v6 and v7 support.
  • PHP 5 and PHP 7 support.


This steps will explain the install process. The installation should not take longer than 15 minutes.

Install the WHMCS Module

1. Extract the module archive which you downloaded from the client area.
2. Upload the module to your WHMCS installation.
3. Go to the WHMCS Admin backend, click on "Setup" -> "Addon Modules" and activate the module.
4. Click on "Configure" and enter your license key.
5. At "Access Control" select 'Full Administrator'.
Slack module 5.png

Create a Slack Webhook

1. Install the 'Incoming WebHooks' App from the Slack App Directory
2. Select at Post to Channel any channel you wish. It doesnt matter what you select because the module will override the setting.
3. Scroll down to the end of the page and Copy the Webhook URL. You dont need to change anything at the settings.
Slack module 6.png

Setup the WHMCS Module

Go to your WHMCS Admin Area and click Addons => Slack for WHMCS.
Now you see 2 boxes which tell you the next 2 steps.
Slack module 7.png

Setup a new Cronjob on your Server (Optional)

We recommend using the message queuing feature. But if you are unable to setup a new cronjob, activate the "Send without Queue" option at the module configuration.

Add the following cronjob on your server. This will send out the messages from the queue:

*/1 * * * * php -q /var/www/html/modules/addons/slackforwhmcs/SlackCronjob.php

If you want to send messages faster, you can do the following cronjob:

*/1 * * * * php -q /var/www/html/modules/addons/slackforwhmcs/SlackCronjob.php; sleep 20; php -q /var/www/html/modules/addons/slackforwhmcs/SlackCronjob.php; sleep 20; php -q /var/www/html/modules/addons/slackforwhmcs/SlackCronjob.php

Replace /var/www/html with your document root.
Slack module 8.png

If you are unable to setup a new cronjob, activate the "Send without Queue" option at the module configuration. With that option activated, messages will be sent directly and without cronjob.
Note: If slack is unreachable, there can be a delay at page load time if you are using the "Send without Queue" feature instead of the message queue feature.


If you dont receive messages from WHMCS, there is probably something setted up wrong. Please review the installation steps.
Errors are also logged to the WHMCS Activity Log. Navigate to "Utilities" => "Logs" => "Activity Log" to check the logs.

API & PHP Function

The module does provide 2 ways for adding Slack Messages from your own system:
PHP Function: You can either use the internal function, which is globally available in your installation or you use the HTTP based API.
HTTP Based API: With the HTTP based API you can also integrate external services - e.g. your servers could send you messages using curl / bash. An other good use case is to integrate slack into your server monitoring.

The "Receiver" should have the following format: "@channel@YourBotName":
@channel: This is the channel where the message post to. It can also be a person, just replace the @ with #.
@YourBotName: That name will be displayed in slack. You can set any Botname, it does not need to match any predefined value.

PHP Function

If you want to add messages to slack from your own modules or hooks, you can use the module function. The function is globally available.

slackforwhmcs_putMessageIntoQueue ($Message, $Receiver) // $Receiver = e.g. "#channel@Botname"


You can also send messages over the HTTP based API. That can be used to let external services post messages to your channels or to a specific person.
Here an example for a script

curl -X POST -F "receiver=$Receiver" -F "msg=$Message" -F "apikey=YourSecretKey" https://your-domain/modules/addons/slackforwhmcs/API.php --silent

Then you can send messages using this command:

./send_slack "@channel@$(hostname)" "My CPU temperatur is too high. Can you please check me urgently?"

Style your messages

You can either send row messages without styling or you make use of the slack attachment options. The module does the hard work for you and all attachment options from slack are supported.

To add attachments, you need to add some values to your message. See here an example for a message:

// define attachment message
$message = "%color%: #36a64f
%pretext% Optional text that appears above the attachment block
%text% Lorem Ipsum la lorem
%author_name% Bobby Tables
%title% Slack API Documentation

// send the message:
slackforwhmcs_putMessageIntoQueue ($message, '#whmcs@Custom Notification')

As you see, the array key is wrapped with an "%" sign. After the array key, you add the value. The value can also contains multiple lines.
You do not need to define the "fallback" paramenter. The module sets the "fallback" parameter automatically. It does copy the content of the "text" parameter into the "fallback" parameter.

It is even possible to add "fields" into the attachment.
For adding fields, you use the following code:

%FIELD1_NAME% Priority
%FIELD2_NAME% Customer
%FIELD2_VAL% Hello World

You can use up to 16 fields. Just increase the number for every field.

Here you can find all informations about Attachments

Technical Details

Name Slack for WHMCS
Compatible WHMCS v6, v7
Compatible PHP PHP 5, PHP 7
Licensing One license covers one WHMCS Installation
Code encryption ionCube
Orderlink Click