Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Notifier] Add Twitter notifier #48084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2022
Merged

[Notifier] Add Twitter notifier #48084

merged 1 commit into from
Dec 2, 2022

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Let's make it easy to tweet from Symfony apps.

$tweet = new ChatMessage('Hello World', (new TwitterOptions())
    ->attachImage(new File('/path/to/image.jpg'), 'Alt text for the image')
);

$chatter->send($tweet->transport('twitter'));

The TwitterOptions class supports all options from /2/tweets and also supports adding alt text to images and subtitles to videos, all this using async uploads.

TwitterTransport::request() is also exposed as public API to make authenticated requests to any other API endpoints.

@carsonbot carsonbot added this to the 6.2 milestone Nov 2, 2022
@nicolas-grekas nicolas-grekas modified the milestones: 6.2, 6.3 Nov 2, 2022
@symfony symfony deleted a comment from carsonbot Nov 2, 2022
@nicolas-grekas nicolas-grekas force-pushed the twitter branch 3 times, most recently from 184bcc7 to cb7f52b Compare November 2, 2022 17:25
Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this super nice conribution!

@nicolas-grekas
Copy link
Member Author

Thank you all for the reviews. Comments addressed.

@nicolas-grekas nicolas-grekas force-pushed the twitter branch 3 times, most recently from c026c2a to a5d49e3 Compare November 3, 2022 09:49
@OskarStark OskarStark requested review from maxbeckers, stof and 94noni and removed request for maxbeckers November 3, 2022 19:14
@gnito-org
Copy link
Contributor

There is risk to providing this particular component, because it could lead to people inadvertently violating Twitter's Developer Policy.

The policy states:

You may not store Twitter passwords, or request that people provide their Twitter password, account credentials, or developer application information (including consumer key) to you directly.

It will be fine if the developer uses the component to publish tweets using his own app's consumer key, but the moment the developer writes an application where users can provide their own Twitter app credentials, then that developer will be in violation of Twitter's policies.

This has been a long-standing policy and a thorn in the side of developers.

@gnito-org
Copy link
Contributor

gnito-org commented Nov 18, 2022

You might want to adapt this component to Twitter API v2, which uses OAuth 2.

That means the component config only needs an OAuth access token, and not the Twitter app credentials such as the consumer key.

https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets

@nicolas-grekas
Copy link
Member Author

You might want to adapt this component to Twitter API v2, which uses OAuth 2.

I don't think we can, because media uploading requires using API v1.1

@fabpot
Copy link
Member

fabpot commented Dec 2, 2022

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 97db974 into symfony:6.3 Dec 2, 2022
@fabpot fabpot deleted the twitter branch December 2, 2022 16:03
@fabpot fabpot mentioned this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.