Closed tchapuis closed 8 months ago
The temporary solution is create a custom endpoint class, and use this class to call api method:
<?php
use JoliCode\Slack\Api\Endpoint\ChatPostMessage;
final class FixedChatPostMessageEndpoint extends ChatPostMessage
{
protected function getFormOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getFormOptionsResolver();
$optionsResolver->setDefined(['metadata']);
$optionsResolver->setAllowedTypes('metadata', ['string']);
return $optionsResolver;
}
}
$slack->executeEndpoint(new FixedChatPostMessageEndpoint([
'channel' => $channel,
'text' => $text,
'metadata' => $metadata,
]));
Hello, The patch file was a pain to get it right 😅
Thanks for working on this!
Tests on main
were red, so I fixed them in https://github.com/jolicode/slack-php-api/pull/162 ;
could you please:
And push?
Awesome, thank you so much!
Version v4.6.0 is published!
The Slack documentation says that we can include metadata in
chat.postMessage
arguments. See : https://api.slack.com/metadataOpenApi spec for this argument doesn't seem to be up to date.
So I added it to the patched version for message definition and
chat.postMessage
method. I also added theinclude_all_metadata
argument for theconversations.history
method