laravel-notification-channels/twitter

Send Tweets now locked behind V2; update needed.

corsair opened this issue ยท 18 comments

Twitter appears to have forced current V1.1 apps to migrate to V2 this morning, thus causing this to break, including just sending text-only tweets.

Without any changes, we received the following error from Twitter:

"Couldn't post notification. Response: You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product".

This appears to be because this package only utilizes the V1.1 API endpoints. As other issues have been made relating to this, could this finally be updated? Otherwise, the package should be archived soon.

Even after migrating to V2 (after initially receiving this error), we are still experiencing the same issue.

Thank you, as always.

Mine stopped working this morning, too and I assume it's related:

[2023-07-05 09:00:02] production.ERROR: Couldn't post notification. Response: Sorry, that page does not exist {"exception":"[object] (NotificationChannels\\Twitter\\Exceptions\\CouldNotSendNotification(code: 0): Couldn't post notification. Response: Sorry, that page does not exist at /vendor/laravel-notification-channels/twitter/src/Exceptions/CouldNotSendNotification.php:17)
[stacktrace]

Sorry I couldn't check yet because of new family member? Anyone can take a look or do a PR?

I'm still researching, but Twitter must have removed the 1.1 endpoint sometime around July 1st. That's my only guess; however, their API docs do not mention 1.1 is gone:
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api

Maybe it's just a blip or something. Honestly, I'm not sure I have confidence in rebuilding this for Twitter v2 API since who knows when they'll decide to break it. ๐Ÿ‘€

@christophrumpel Assign the issue to me, I think we need to port the project to V2 of the api

Yeah I think so too. Would be great if you can take a look ๐Ÿ™

@christophrumpel it is ready for review

Just FYI, the v1.1 API worked for me this morning for auto-posting a tweet.

@ericlbarnes with this package?

Yes, sorry I wasn't clear. The package failed to post a tweet Mon-Wed this week with this message in my log:

[2023-07-05 09:00:02] production.ERROR: Couldn't post notification. Response: Sorry, that page does not exist {"exception":"[object] (NotificationChannels\\Twitter\\Exceptions\\CouldNotSendNotification(code: 0): Couldn't post notification. Response: Sorry, that page does not exist at /vendor/laravel-notification-channels/twitter/src/Exceptions/CouldNotSendNotification.php:17)
[stacktrace]

Then today, with zero changes on my end, it just worked. So it's like Twitter itself broke the API, and then they fixed the endpoints at some point in the last 24 hours. ๐Ÿคทโ€โ™‚๏ธ

Ah thanks for the extra info. Interesting. Please let me know it fails again. Probably still a good idea to update this package when I find time.

Hello, I still have the same error:

(NotificationChannels\Twitter\Exceptions\CouldNotSendNotification(code: 0): Couldn't post notification. Response: You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product at ///laravel/vendor/laravel-notification-channels/twitter/src/Exceptions/CouldNotSendNotification.php:19)

I made a new app on Twitter developper with read and write permissions ๐Ÿฅฒ

edit: I use 5.1.0 version (php 7.4 on my side), doesn't know if impact the thing
edit: the same on php > 8 and laravel 9.52

@Nelwhix has made a PR, and we are close to a solution to use V2. ๐Ÿ™

Only "Direct Messages" we couldn't make work so far. Pain the a** to debug what that is about. I think about shipping a new version without direct messages for now ๐Ÿค”

It may be the case that "direct messages" is not part of the free plan anymore. Unfortunately, it is not mentioned anywhere. I will prepare a release without direct messages.

I published a new version of this package v8. Can you all try it?

Just make sure to:

  • your twitter app must be within a twitter project (developer portal)
  • you may need to regenerate all your tokens
  • make sure your access token have read and write access (see image, this can be done through user authentication, see second image)

CleanShot 2023-07-15 at 09 07 05@2x

CleanShot 2023-07-15 at 09 08 01@2x

Please let me know if it works for you.

I also updated the readme file with the things to be aware of. I will close this for now, but let me know if run into any issues ๐Ÿ‘

Hello, and... it work's for me with twitter status updates with V8, many thanks :)

The update on doc is also great. On my side, I just added
namespace App\Notifications; inside my notification file
and after regeneration of access token (and consumer), I maybe was missing an: php artisan config:cache

Both cases: laravel side.

I will now work on customise my posts.
Thanks again ๐Ÿ’ช

Thanks for letting me know and glad it works ๐Ÿ™