Skip to content
This repository was archived by the owner on Jul 5, 2022. It is now read-only.
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

@walva

Description

@walva

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
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions