1. Go to this page and download the library: Download strimeapp/slackify library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
strimeapp / slackify example snippets
use Strime\Slackify\Webhooks\Webhook;
$webhook = new Webhook("https://hooks.slack.com/services/YOUR/WEBHOOK");
$webhook->sendMessage(array(
"message" => "My first message",
"username" => "Bobby",
"icon" => "http://upshout.net/wp-content/uploads/2016/03/unicorn-002.jpg",
"link" => "https://www.strime.io",
"link_text" => "Strime"
));
use Strime\Slackify\Webhooks\Webhook;
$webhook = new Webhook("https://hooks.slack.com/services/YOUR/WEBHOOK");
$webhook->setAttachments(
array(
array(
"fallback" => "A fallback text",
"text" => "The text of your attachment",
"color" => "#123456",
"fields" => array(
"title" => "My attachment",
"value" => "The value of my attachment",
"short" => FALSE
)
)
)
);
$webhook->sendMessage(array(
"message" => "My first message",
"username" => "Bobby",
"icon" => "http://upshout.net/wp-content/uploads/2016/03/unicorn-002.jpg",
"link" => "https://www.strime.io",
"link_text" => "Strime"
));
use Strime\Slackify\Api\Api;
// API request
$api_request = new Api("your-api-token-comes-here");
$api_request->test();
use Strime\Slackify\Api\Auth;
// Auth requests
$api_auth_request = new Auth("your-api-token-comes-here");
$api_auth_request->revoke("a-token-to-revoke", TRUE);
$api_auth_request->test("a-token-to-test");
use Strime\Slackify\Api\Bots;
// Bots requests
$api_bots_request = new Bots("your-api-token-comes-here");
$api_bots_request->info("B123456");
use Strime\Slackify\Api\Channels;
// Channels requests
$api_channels_request = new Channels("your-api-token-comes-here");
$api_channels_request->archive("C123456");
$api_channels_request->create("C123456");
$api_channels_request->history("C123456", "now", 0, 0, 100, 0);
$api_channels_request->info("C123456");
$api_channels_request->invite("C123456", "U56789");
$api_channels_request->join("C123456");
$api_channels_request->kick("C123456", "U56789");
$api_channels_request->leave("C123456");
$api_channels_request->list_channels(0);
$api_channels_request->mark("C123456", time());
$api_channels_request->rename("C123456", "New name");
$api_channels_request->replies("C123456", time());
$api_channels_request->setPurpose("C123456", "New purpose");
$api_channels_request->setTopic("C123456", "New topic");
$api_channels_request->unarchive("C123456");