laravel-notification-channels / twitter

Twitter Notifications Channel for Laravel
http://laravel-notification-channels.com
MIT License
169 stars 44 forks source link

Not working media #106

Closed michaloravec closed 6 months ago

michaloravec commented 6 months ago

Hi,

there is issue with sending media.

As you can see in the code there is a comment:

// api V2 does not support sending media yet, so I wait till after sending media to switch api version

That was added within this PR exactly 15. July 2023.

But as of version 6.0 abraham/twitteroauth which was released on July 24, 2023, the default twitter api version is 2.

This means it will be necessary to set version 1.1 using $this->twitter->setApiVersion('1.1'); at the beginning of send method in TwitterChannel as you can see on the image below:

image

christophrumpel commented 6 months ago

Hey, when you set the version to 1.1 at the beginning of this method, it does work for you?

michaloravec commented 6 months ago

Yes, it does.

Without that I got Attempt to read property "media_id_string" on null.

christophrumpel commented 6 months ago

I know I set that API version of the twitter client in my applications myself (doesn't have to be in the package)

But there was a reason for doing it like this: because of the different versions people were using. But I can see that this can be a problem. Need to think of a solution.

michaloravec commented 6 months ago

How did you set API version of the twitter client in your applications?

christophrumpel commented 6 months ago

Sorry, I got that wrong. I did that when using abrahms twitter package alone without this package.

So I guess the fix would to add the line you mentioned? I wonder if that could lead to other problems 🤔 Do you know if Twitter still only support 1.1 for media?

michaloravec commented 6 months ago

Media are still supported only in 1.1. You can see it in the docs.

image

I am pretty sure that everything will be ok. And that's because until 27. February 2024, this package only supported version 5 of the abraham/twitteroauth package, where was default API version 1.1.

Yesterday's release changes for this package changed abraham/twitteroauth support to version 6, which means the default twitter API version is current 2.

And this will cause new people who install this package or update to a newer version to have their media not working.

christophrumpel commented 6 months ago

Sounds right, thanks. Could you make a PR for this?

michaloravec commented 6 months ago

I already did it.

christophrumpel commented 6 months ago

Thanks 🙏

christophrumpel commented 6 months ago

New release is out. Please let me know if everything is working for you. Thanks 👍

michaloravec commented 6 months ago

Yes, everything is working. Thank you.