Closed jkudish closed 3 years ago
Hey @damienalexandre sorry to ping you directly but was wondering if you could chime in here?
Hi @jkudish thanks for reporting this issue.
It's highly possible that Slack just broke the specification for no reason.
As I can see in https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2_without_examples.json here is all the usages of as_user
:
But that's just type hint, in fact boolean in the Slack API can be send as string (everything is a string in HTTP) so using as_user => 'true'
should work, have you tried?
I will keep this issue open because that's something we can patch if it's an issue.
Hi @damienalexandre
Sorry for the delay, some work and life stuff came up and I didn't have a chance to circle back to this until now.
'true'
does NOT work, it results in no message being sent at all.true
results in a PHP error The option "as_use\" with value true is expected to be of type "string", but is of type "bool"
Although I do see that it still says string on the json file you linked to, it does say it should be a boolean on the slack documentation website: https://api.slack.com/methods/chat.postMessage#arg_as_user I believe the documentation in their json is wrong, perhaps it would be worth reaching out to slack support about updating it?
I think the best course of action here is to add a new patch on our end, to transform the "as_user" typed in "string" as "boolean".
Will have a look at this tonight. Cheers
This should be fixed in 3.0.2! Feel free to reopen the issue if you still have any issue.
Thanks @damienalexandre
Hey there!
Glad to see this package being worked on and some updates in v3. Thanks for the contributions 👍
I'm confused about the change to
as_user
:Breaking Some options have new types, for example ChatUpdate as_user option was a boolean and is now a string
generated/Endpoint/ChatPostMessage.php
do hint it as a string, but the description still describes it as a boolean,@var string $as_user Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See [authorship](#authorship) below.
I don't follow the change or understand why it was changed. I tried to search for any meaningful commit about this in the repo but didn't see anything relevant either. Can you please explain the change and explain what I should be passing into it to keep the previous behaviour the same (I was previously passing in
as_user => true
to send DMs on behalf of users)? Is it now expecting the string'true'
?Thanks so much!