Page tree
Skip to end of metadata
Go to start of metadata

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:

<?php
// define attachment message
$message = "%color%: #36a64f
%pretext% Optional text that appears above the attachment block
%text% Lorem Ipsum la lorem
%author_name% Bobby Tables
%author_link% http://flickr.com/bobby/
%author_icon% http://flickr.com/icons/bobby.jpg
%title% Slack API Documentation
%title_link% https://api.slack.com/";

// 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
%FIELD1_VAL% High
%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




  • No labels