You are here

public function ApiClient::channelsCreate in Rocket.Chat 8

Same name and namespace in other branches
  1. 8.2 modules/rocket_chat_api/src/RocketChat/ApiClient.php \Drupal\rocket_chat_api\RocketChat\ApiClient::channelsCreate()

Create a new Channel.

Parameters

string $name: The new channel name.

array $members: The list of the users of this channel.

Return value

array Result array.

File

modules/rocket_chat_api/src/RocketChat/ApiClient.php, line 424

Class

ApiClient
Class ApiClient.

Namespace

Drupal\rocket_chat_api\RocketChat

Code

public function channelsCreate($name, array $members = []) {
  $options["name"] = $name;
  if (!empty($members)) {
    $options['members'] = $members;
  }
  return $this
    ->postToRocketChat('channels.create', [
    'json' => $options,
  ]);
}