laravel-slack-api icon indicating copy to clipboard operation
laravel-slack-api copied to clipboard

Channel join method returning error: missing required field channel

Open haresh-p opened this issue 1 year ago • 2 comments

I'm using this code to join the channel:

SlackChannel::join('C1234567890')

In the response I'm getting this error message:

"ok" => false
"error" => "invalid_arguments"
"message" => "[ERROR] missing required field: channel"

When I check the join method inside Vluzrmos\SlackApi\Methods\Channel I found this code:

public function join($name) { return $this->method('join', ['name' => $name]); }

Here, in argument we are passing name. But when I check Slack API documentation I found this: Required arguments:

  1. token
  2. channel

When I changed parameter in join method from name to channel then it is working fine. Code inside inside Vluzrmos\SlackApi\Methods\Channel after change:

public function join($name) { return $this->method('join', ['channel' => $name]); }

Can you please look into this? Also, if I'm missing something then let me know. If anyone needs additional information then let me know.

haresh-p avatar Apr 04 '23 13:04 haresh-p

Seems like the same problem is occurring in several places. https://api.slack.com/methods/conversations.invite

https://github.com/vluzrmos/laravel-slack-api/blob/6fd8c3d584c78809ac2b29e6d3f3ed1ff0e5bcc9/src/Vluzrmos/SlackApi/Methods/Channel.php#L78-L81

naiguchi avatar Apr 06 '23 10:04 naiguchi

Had the same issue. Made a pull request just in case you would feel it's usefull.

thank you very much for all the hard work creating this library.

coupej avatar Apr 13 '23 20:04 coupej