Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ protected function doSend(MessageInterface $message): SentMessage

return $sentMessage;
}

protected function getEndpoint(): ?string
{
return $this->host.($this->port ? ':'.$this->port : '');
}
}
3 changes: 2 additions & 1 deletion src/Symfony/Component/Notifier/Bridge/Zulip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ DSN example
-----------

```
ZULIP_DSN=zulip://EMAIL:TOKEN@default?channel=CHANNEL
ZULIP_DSN=zulip://EMAIL:TOKEN@URL?channel=CHANNEL
```

where:
- `EMAIL` is your Zulip email
- `TOKEN` is your Zulip token
- `URL` is your Zulip url
- `CHANNEL` is the channel

Resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ protected function doSend(MessageInterface $message): SentMessage
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, ZulipOptions::class));
}

$endpoint = sprintf('https://%s/api/v1/messages', $this->getEndpoint());

$options = ($opts = $message->getOptions()) ? $opts->toArray() : [];
$options['content'] = $message->getSubject();

Expand All @@ -80,6 +78,8 @@ protected function doSend(MessageInterface $message): SentMessage
$options['to'] = $message->getRecipientId();
}

$endpoint = sprintf('https://%s/api/v1/messages', $this->getEndpoint());

$response = $this->client->request('POST', $endpoint, [
'auth_basic' => $this->email.':'.$this->token,
'body' => $options,
Expand Down