Slack\ApiClient::getDMById PHP Method

getDMById() public method

Gets a direct message channel by its ID.
public getDMById ( string $id ) : React\Promise\PromiseInterface
$id string A DM channel ID.
return React\Promise\PromiseInterface A promise for a DM object.
    public function getDMById($id)
    {
        return $this->getDMs()->then(function (array $dms) use($id) {
            foreach ($dms as $dm) {
                if ($dm->getId() === $id) {
                    return $dm;
                }
            }
            throw new ApiException('DM ' . $id . ' not found.');
        });
    }