Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"From" is not supported #34

Closed
chimit opened this issue Apr 1, 2020 · 8 comments
Closed

"From" is not supported #34

chimit opened this issue Apr 1, 2020 · 8 comments

Comments

@chimit
Copy link

chimit commented Apr 1, 2020

  • Slack Notification Channel Version: 2.0.2
  • Laravel Version: 6.15.1
  • PHP Version: 7.4
  • Database Driver & Version:

Description:

The method from is not supported.

Steps To Reproduce:

return (new SlackMessage)
    ->from('MyBot', ':robot_face:')
    ->to('#general')
    ->content('Hi!');
@driesvints
Copy link
Member

It is? Please give some more info here. What exactly isn't working for you?

@chimit
Copy link
Author

chimit commented Apr 2, 2020

Apparently, it's a legacy protocol. A from method simply doesn't work. Slack always displays an app username and avatar.

You cannot override the default channel (chosen by the user who installed your app), username, or icon when you're using Incoming Webhooks to post messages. Instead, these values will always inherit from the associated Slack app configuration.
https://api.slack.com/messaging/webhooks

@driesvints
Copy link
Member

When did they drop support for this? Can you link to any changelogs, blog posts, etc?

@chimit
Copy link
Author

chimit commented Apr 3, 2020

Hm... I'm not familiar with the Slack API, but if I follow instructions from the Slack log channel documentation and use the link from that page it throws me to the "Incoming WebHooks" app page. If I create hooks there everything works perfectly.

But the link on the Slack Notifications page throws me to the absolutely another page that asks me to create a new app. It gives me a webhook URL as well, but if I use it the from() method is ignored by Slack.

So if you use the existing "Incoming WebHooks" app you can use custom icons and names, but if you create your own app with webhooks you can't customize icons and names. So the link on this page is misleading.

Please, correct me if I'm wrong.

@driesvints
Copy link
Member

I'm currently using an incoming webhook in an app with the from method configured so I think there might be something we're missing here. If you can ever pinpoint the problem feel free to report back and we'll re-open.

@shino47
Copy link

shino47 commented Apr 12, 2020

Hm... I'm not familiar with the Slack API, but if I follow instructions from the Slack log channel documentation and use the link from that page it throws me to the "Incoming WebHooks" app page. If I create hooks there everything works perfectly.

But the link on the Slack Notifications page throws me to the absolutely another page that asks me to create a new app. It gives me a webhook URL as well, but if I use it the from() method is ignored by Slack.

So if you use the existing "Incoming WebHooks" app you can use custom icons and names, but if you create your own app with webhooks you can't customize icons and names. So the link on this page is misleading.

Please, correct me if I'm wrong.

@chimit you are right. There are two different ways to integrate Slack to your project: creating an app and integrating the existing Incoming WebHooks app. If you create an app, you can't use the from, to and image methods, but you still can customize the from name and image here:

https://api.slack.com/apps

Select your app, scroll down to Display Information and there is it.

Using the existing Incoming WebHooks is not recomended, as it uses a legacy custom integration, as @chimit pointed.

@chimit
Copy link
Author

chimit commented Apr 13, 2020

Thanks for the clarification, @shino47!

It is worth mentioning that customizing name and image in your own app is not as flexible as in legacy Incoming WebHooks because you can't do it dynamically from your code.

@driesvints there is still an inconsistency on the Slack Notifications documentation page. It leads you to create a new Slack app (https://api.slack.com/incoming-webhooks) that doesn't support a from method described below. We should choose one approach:

  1. Recommend using a legacy Incoming WebHooks app that supports from. Then change the link on https://laravel.com/docs/7.x/notifications#slack-notifications;
  2. Recommend to create your own Slack app and remove everything about the from method from Slack Notifications documentation page and change the link on https://laravel.com/docs/7.x/logging#configuration.

@driesvints
Copy link
Member

@chimit done: laravel/docs#5964

Thanks for clarifying that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants