Closed gr2m closed 4 years ago
It looks like creating polls is a bit complicated. It requires that the twitter account is enabled for the Twitter Ads API: https://developer.twitter.com/en/docs/ads/general/overview/adsapi-application
Once that is done, it's a two-step process.
card_uri
parameter to the URI returned by step 1@stalgiag do you want to get the process going for https://mobile.twitter.com/p5xjs? I'd start by creating a new repository and setting up the action on the @processing org, follow the instructions at https://github.com/gr2m/twitter-together#setup. You will also get the application ID
as a result of said setup.
I've submitted https://twitter.com/commit2tweet for testing myself, the automated response is
We will review your application within 1-3 business days. If you do not recieve an email confirming or denying your app's whitelist after 7 days, feel free to contact us at adsapi-program@twitter.com. Please make sure to provide your app ID.
I'll post updates if there are any
The app currently only supports plain text tweets, no attachments such as images or polls are currently supported. When adding support for polls, I'd also like to think ahead how image attachments would work, as that is a feature I'd like to add in future, too, and I wouldn't want to introduce a breaking change.
I think we can borrow the idea of multipart emails. I do not think that we need a boundary though, separating the parts with just ---
and two new lines should be enough. For example
Here is the tweet text
---
( ) Poll option 1
( ) Poll option 2
( ) Poll option 3
( ) Poll option 4
---
https://example.com/url/to/image.jpg
I think the type of attachment can be derived by the content of the part itself.
I'm not yet sure if that format will work with tweet threads, though. Twitter threads are not directly supported, but can be created by creating a separate tweet for each reply and using the in_reply_to_status_id
parameter
This is exciting @gr2m! It is the beginning of a winter vacation for me soon but I will take care of the setup as soon as possible.
FYI I started the Twitter Ad API approval process for a @p5xjs app and received a similar message to the one @gr2m posted above. Will keep you updated on this.
Finally getting back around to this. Thanks for starting the API approval processing @lmccart
Just to clarify, @gr2m do you think that I should setup a new repository for the @processing org for testing this? I am unsure of what is meant by:
@stalgiag do you want to get the process going for https://mobile.twitter.com/p5xjs? I'd start by creating a new repository and setting up the action on the @processing org
I can add the .yml workflow file to the existing p5 repo (and do the rest of the setup for twitter-together), or I can start a new repo and do this in that repo instead.
Thanks in advance for the clarification!
Either works. You can set it up for the existing repo https://github.com/processing/p5.js/ repository. The benefit of setting up a separate repository is better control of who can approve tweets, I could imagine these people might be different from the people who can accept pull requests. Do whatever works best for the project
Thanks for the clarification!
I believe that either would work. What are your thoughts @lmccart ?
I think we can integrate directly into the p5.js repo. In general, we try to give as much access as possible to contributors (anyone can get push access to repos, twitter/IG passwords are public, etc). So it probably makes sense to have this directly in the repo just to simplify things.
Quick update: I received an email from twitter that my test Twitter account @commit2tweet was approved for the Twitter Ads API program. I'll experiment with creating twitter polls this week and will keep you posted here
I did too! so we can switch to the p5 account anytime it's ready-ish
There is nothing to switch, I've setup @commit2tweet
on this repository, so all *.tweet
files merged into https://github.com/gr2m/twitter-together/tree/master/tweets result in a tweet from @commit2tweet
. You can already setup twitter-together on the https://github.com/processing/p5.js/ repository for the @p5xjs
twitter account, following the instructions at https://github.com/gr2m/twitter-together#setup. Once the feature is ready you'll be able to use it right away, I don't expect any setup changes to be necessary.
ah, got it, that makes sense. thanks for the clarification!
Looks like I accidentally submitted an incorrect app ID 🤦♂ I'll try to submit again
I tried to create a poll with the other app that was accidentally approved, but I another error:
User 11754732 is not authorized to make this request. Please have them reauthorize with your client application with id 5728201.
Now I have no idea how to reauthorize an app, and google was not helpful either. I spent way too much time on the mess that is Twitter's APIs & documentation :( I'll wait for them to hopefully come back to me soon. I'll keep you posted here. I hope to get this unblocked soon 🤞
Update: regenerating the keys & tokens worked: https://twittercommunity.com/t/how-to-reauthorize-an-application/133227/2
Success:
I deleted that tweet.
There are still a few things to figure out, but it basically works as I described above: https://github.com/gr2m/twitter-together/issues/79#issuecomment-567889171
I'm still waiting for the approval of the app belonging to @twitter-together
:( Let me know if this becomes more urgent for you, I can build it and we can test the new code with p5's twitter account instead.
Do you have any thoughts on the syntax I suggested in https://github.com/gr2m/twitter-together/issues/79#issuecomment-567896037?
@gr2m thanks for the update, no rush on our end. I think the format looks great.
you're most welcome to use the p5 account to test though if you're itching to work on it
Still no update for @twitter-together
. I'll just go ahead and build this and use my personal @gr2m
account for experimentation as I've an approved app for that.
Good news, finally got the app for @twitter-together
approved. I had to follow up with them per email though, but have been very responsive once I did. I also started working on it at #91
Amazing! This is really exciting.
Sorry that this takes me so long. I'm heads down pushing out a new version of https://github.com/octokit/rest.js/ at work, it takes up all of my time 😭
I'll try to find some today though 🤞 Thanks for bearing with me, I really want to get this done and then build upon it :)
What would be a good time for twitter polls? It can be anything between 5 minutes and 7 days. I don't want to make it customizable, too complicated. I'd say two days, but please let me know what you think :)
I agree on not having it customizable. 2 days sounds very reasonable. there is something nice and clean about 1 day, but maybe 2 gives more time/space..
Yeah let's do one day. I also checked what the default is on twitter.com, and it's 1 day too. We can experiment and change it later as we see fit
One more thought, apologies if this has already been covered above and I missed it. What do you think about including a link back to the github issue thread? This might invite people to take a peek for more context, or if the poll has closed, they can at least find the thread to comment directly.
Oh interesting idea! Would it be the URL of the pull request that added the *.tweet
file? Or would you have a separate issue discussing the question that you created a poll for on twitter?
I think for now, in both cases, you can just make the URL part of the *.tweet
file? We might consider automating it later, or supporting placeholders
Ohh I didn't realize it was a separate file. I was imagining a scenario where you could directly initiate a poll from an issue, as a way of gathering broader input. But yes, I guess if it's a *.tweet
file, then there's no need to build in this link format, one could simply add a link to any relevant issue thread in the body of the tweet message.
Hm there is also a hack-y way to add embedded polls in GitHub issue directly, maybe that would be of interest?
Check the links at the bottom, there are some helpful tools for it.
We could also fairly simply build another custom action that lets you do a comment like
/tweet-poll "option 1" "option 2" "option 3" "option 4"
which in turn would create a pull request with a new *.tweet
file (or bypass the PR and create the file directly), which would include a link back to the issue. And once tweeted, the URL to the tweet could be posted back to the thread.
🤷♂️ dunno, sounds fun to build, but might be too much?
Damn I thought I had it, but no luck yet: https://github.com/gr2m/twitter-together/runs/429079950?check_suite_focus=true#step:5:60
I have an idea what it might be, I'll get back to it as soon as possible
Now that looks promising: https://twitter.com/commit2tweet/status/1225939208650608640
:tada: This issue has been resolved in version 1.5.3 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Can you give it a try?
So I think I have everything set up correctly and I committed a new tweet to the tweets folder. It looks like the action was triggered but I am not seeing a tweet.
Well actually I am now seeing a 'Resource not accessible by integration' error.
Hm it's possible that it has something to do with the fact that you ran it on a fork, let me see
The action was triggered by a pull request. What pull request was that?
I've a check in the code that should avoid trying to create a check run if the PR is coming from a fork, but somehow it didn't do it in your case. I'm a little confused
Looks like the tweet text is too long:
https://github.com/processing/p5.js/commit/4db6696eab44056df8f8fcdabe4b2f5400ff8d81
Note that updating the *.tweet
file will have no effect. I would remove the tweet in master, then in a pull request re-create it. Can you ping me in that PR so I can see if the preview feature is working as it should?
Ah yes sorry about that I am twitter naive. I will reopen a pull request but it will have to wait till tomorrow. Thanks for figuring out the problem.
Ah yes sorry about that I am twitter naive
not at all your fault. Sounds like an opportunity to improve the documentation :)
What’s missing?
This is a follow up to https://github.com/processing/p5.js/issues/3893#issuecomment-567193686
Why?
@stalgiag suggested to automate the process of creating twitter polls to generate discussions. Adding that feature to twitter-together will also allow everyone to contribute a twitter poll
Alternatives you tried
Manually creating a pull using twitter.com or one of the apps.