maknz / slack

A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax.
BSD 2-Clause "Simplified" License
1.17k stars 204 forks source link

Explicitly setting channel and username #6

Closed REBELinBLUE closed 9 years ago

REBELinBLUE commented 9 years ago

When you set up a webhook on slack it asks you the username and channel to use. You only need to include those variables in the post request if you want to overwrite what you have set.

Shouldn't Client.php have them undefined by default rather than explicitly set, and then only send them if they have been set with setChannel or setUsername?

maknz commented 9 years ago

Hi @REBELinBLUE,

It's possibly a good idea, although I figured people would set defaults in the config (if using Laravel) or when instantiating the class, so then it's pretty explicit as to how the post will work (without magic defaults on the Slack side getting confusing).

I figure you're using the package outside of Laravel, where it could be more elegant to not have to include the username and channel explicitly when creating the client, and let Slack handle it. If you'd find that useful, I'll look at including it :-).

REBELinBLUE commented 9 years ago

No problem.

I was just confused when I first started using it as I couldn't figure out where my notifications were going as I had not set a channel

maknz commented 9 years ago

I think it's a good idea, at least then the hardcoded class defaults don't cause confusion. Will look at it over the holidays. Thanks.

maknz commented 9 years ago

Implemented in version 1.0