raffmartinez/php-slack-wrapper

Simple PHP Slack Wrapper for quick integration.

0.1.0 2020-06-11 03:37 UTC

This package is auto-updated.

Last update: 2025-03-12 14:48:29 UTC


README

Simple PHP Slack wrapper for quick integration

Usage:

Initialize with legacy token (classic bot)

$legacyApiKey = 'xoxp-123456789-1234567890';
$slack = new \RaffMartinez\Slack\Slack($legacyApiKey);

Get channel list

$channelList = $slack->getChannelList();

Post message

$slack->postMessage($channelList[0], \RaffMartinez\Slack\Message::simpleMessage('Hello', 'MyBot'));
$ts = $slack->getLastMessageTs();

Reply to message

$slack->postMessage($channelList[0], \RaffMartinez\Slack\Message::responseMessage('Hello', 'MyBot', $ts));

Get user list

$allUsers = $slack->getUserList();