jolicode / slack-php-api

:hash: PHP Slack Client based on the official OpenAPI specification
https://jolicode.github.io/slack-php-api/
MIT License
221 stars 54 forks source link

No text error code? #119

Closed cgunnels closed 1 year ago

cgunnels commented 3 years ago

Anyone know why i'd be getting this error?

JoliCode\Slack\Exception\SlackErrorResponse: Slack returned error code "no_text" in /var/www/vendor/jolicode/slack-php-api/src/HttpPlugin/SlackErrorPlugin.php:36

PHP 7.4.1 jolicode/slack-php-api - v4.1.1

running this code:

    $client = ClientFactory::create(config('services.slack.token'));
    $client->chatPostMessage([
            'channel' => $slack_id,
            'link_names' => true,
            'text' => "Test string"
    ]);
pyrech commented 3 years ago

Hello @cgunnels

I failed to reproduce the issue with your snippet. Do you still experiment it? Could it be a temporary issue of Slack's API?

cgunnels commented 3 years ago

Hello @cgunnels

I failed to reproduce the issue with your snippet. Do you still experiment it? Could it be a temporary issue of Slack's API?

This is still happening.

Here is more of the stack trace:

JoliCode\Slack\Exception\SlackErrorResponse: Slack returned error code "no_text" in /var/www/vendor/jolicode/slack-php-api/src/HttpPlugin/SlackErrorPlugin.php:36
Stack trace:
#0 /var/www/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php(31): JoliCode\Slack\HttpPlugin\SlackErrorPlugin->JoliCode\Slack\HttpPlugin\{closure}(Object(Nyholm\Psr7\Response))
#1 /var/www/vendor/jolicode/slack-php-api/src/HttpPlugin/SlackErrorPlugin.php(37): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure))
#2 /var/www/vendor/php-http/client-common/src/PluginChain.php(48): JoliCode\Slack\HttpPlugin\SlackErrorPlugin->handleRequest(Object(Nyholm\Psr7\Request), Object(Closure), Object(Http\Client\Common\PluginChain))
#3 /var/www/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php(62): Http\Client\Common\PluginChain->Http\Client\Common\{closure}(Object(Nyholm\Psr7\Request))
#4 /var/www/vendor/php-http/client-common/src/PluginChain.php(48): Http\Client\Common\Plugin\ErrorPlugin->handleRequest(Object(Nyholm\Psr7\Request), Object(Closure), Object(Http\Client\Common\PluginChain))
#5 /var/www/vendor/php-http/client-common/src/PluginChain.php(63): Http\Client\Common\PluginChain->Http\Client\Common\{closure}(Object(Nyholm\Psr7\Request))
#6 /var/www/vendor/php-http/client-common/src/PluginClient.php(90): Http\Client\Common\PluginChain->__invoke(Object(Nyholm\Psr7\Request))
#7 /var/www/vendor/jolicode/slack-php-api/generated/Runtime/Client/Client.php(82): Http\Client\Common\PluginClient->sendRequest(Object(Nyholm\Psr7\Request))
#8 /var/www/vendor/jolicode/slack-php-api/generated/Client.php(1806): JoliCode\Slack\Api\Runtime\Client\Client->executeEndpoint(Object(JoliCode\Slack\Api\Endpoint\ChatPostMessage), 'object')
#9 /var/www/app/MyScript.php(88): JoliCode\Slack\Api\Client->chatPostMessage(Array)
pyrech commented 3 years ago

This is quite strange because I tested yesterday with the exact same snippet (only the token and channel id should change obviously) and it worked and the message appeared in our Slack worskpace:

image

I don't really understand why Slack API is throwing you such error. I try to find some clue on Google of anyone experimenting the same issue with this endpoint but it looks like people getting no_text error with chat.postMessage are always sending message with blocks or attachments - which is not your case here :confused:

I wonder if this could be related to a custom configuration of your channel or workspace?

lyrixx commented 1 year ago

Hello,

I'm closing this issue for lack of activity.

Thanks for opening it in the first place.