This repository was archived by the owner on Jul 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
This repository was archived by the owner on Jul 5, 2022. It is now read-only.
Is it possible to put url in the message? #27
Copy link
Copy link
Open
Description
Hello everyone!
I'm struggling tonight by trying to put a link within the message. I try to follow this documentation
and it doesn't work. I thought that it was the HTTP method the problem so I changed GET to POST and I have the same result.
Regarding slack documentation, it shoud work like this.
Here is my code:
$identity = new \DZunke\SlackBundle\Slack\Messaging\Identity();
$identity->setUsername($sender->getFullName());
$identity->setIconUrl($avatar);
$this->slack->send(Actions::ACTION_POST_MESSAGE,
[
'identity' => $identity,
'channel' => "system",
'text' => "HEY <http://google.be|google>",
'icon_url' => $avatar,
'unfurl_links' => 0,
'parse' => 'full',
]);
With also this additional method:
public function send($action, array $parameter = [])
{
try {
if (isset($parameter["channel"]) AND $this->env != "prod") {
$parameter["channel"] = "#debug";
}
$this->originalSlackClient->send($action, $parameter);
} catch (\Exception $e) {
$context = $parameter;
if (isset($context['identity'])) unset($context['identity']);
$this->logger->error("Failed to send message to slack", $context);
}
}
`
And finally here is my configuration:
d_zunke_slack:
token: "ZZZ"
use_http_post: true
identities:
spartan: ~`
Could someone give me an example of message containing link in order to have an example?
Thank you in advance and thanks a lot for this bundle!
Metadata
Metadata
Assignees
Labels
No labels