PHP code example of wrapi / slack

1. Go to this page and download the library: Download wrapi/slack 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/ */

    

wrapi / slack example snippets


$slack = new wrapi\slack\slack(SLACK_API_TOKEN);

// Now you are ready to make API calls to Slack.

$slack->chat->postMessage(array(
    "channel" => "#general",
    "text" => "Hello World!"
  )
)

$emojis = $slack->emoji->list();

$channels = $slack->channels->list(array("exclude_archived" => 1));

$myGroup = $slack->groups->info(array("channel" => "G1234567890"));

$slack->reactions->add(array(
    "name" => "thumbsup",
    "file" => "F1234567890",
    "file_comment" => "Fc1234567890",
    "channel" => "G1234567890",
    "timestamp" => "1234567890.123456"
  )
);

$user = $slack->users->info(array("user" => "U1234567890"));

$response = $slack->chat->postMessage(array(
    "channel" => "#general",
    "text" => "Hello <@u12345678|world>!",
    "username" => "Wrapi Bot",
    "as_user" => false,
    "parse" => "full",
    "link_names" => 1,
    "unfurl_links" => true,
    "unfurl_media" => false
  )
)