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

Latest commit

 

History

History
33 lines (24 loc) · 1.37 KB

channels-set-topic.md

File metadata and controls

33 lines (24 loc) · 1.37 KB

channels.setTopic

This method is used to change the topic of a channel. The calling user must be a member of the channel.

Official documentation https://api.slack.com/methods/channels.setTopic
Payload class ChannelsSetTopicPayload
PayloadResponse class ChannelsSetTopicPayloadResponse

Usage

$payload = new ChannelsSetTopicPayload();
$payload->setChannelId('C1234567');
$payload->setTopic('This is the new topic of this channel');

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

if ($response->isOk()) {
    // topic was set successfully!
} 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();
}