Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Latest commit

 

History

History
32 lines (23 loc) · 1.26 KB

channels-leave.md

File metadata and controls

32 lines (23 loc) · 1.26 KB

channels.leave

This method is used to leave a channel.

Official documentation https://api.slack.com/methods/channels.leave
Payload class ChannelsLeavePayload
PayloadResponse class ChannelsLeavePayloadResponse

Usage

$payload = new ChannelsLeavePayload();
$payload->setChannelId('C1234567');

$apiClient = new ApiClient('your-slack-token-here');
$response  = $apiClient->send($payload);

if ($response->isOk()) {
    // the user belonging to the token has left the channel
} else {
    // something went wrong, but what?
    
    // simple error (Slack's error message)
    echo $response->getError();
    
    // explained error (Slack's explanation of the error, according to the documentation)
    echo $response->getErrorExplanation();
}