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

Scheduling messages expects the post_at attribute to be string while slack returns an integer #92

Closed ScSherifTarek closed 3 years ago

ScSherifTarek commented 3 years ago

When scheduling a message using the following code:

$client->chatScheduleMessage([
    'channel'=> 'testing-slack-apps',
    'text'=> 'Hey, This is a scheduled message :tada:',
    'post_at'=> 1599654720
]);

I got the following error because the package is expecting the post_at attribute to be of type string. image

so I have changed the post_at attribute to be of type string as follows:

$client->chatScheduleMessage([
    'channel'=> 'testing-slack-apps',
    'text'=> 'Hey, This is a scheduled message :tada:',
    'post_at'=> '1599654720'
]);

now it works and the message gets scheduled successfully, but now another exception is throwed, saying that JoliCode\Slack\Api\Model\ChatScheduleMessagePostResponse200::setPostAt() is expecting the post_at parameter to be of type string, but actually slack returns it as an integer.

image

I believe that it doesn't have to be of type string since slack is expecting it as an integer representing the UNIX timestamp.

damienalexandre commented 3 years ago

Thanks for reporting! I just submitted a PR that address this issue.