-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
π 5/17 @ noon PT - Automating gr2m/helpdesk, Episode II #14
Comments
Some notes ahead of the show π In order to send scheduled tweets from your own account, you need to
No idea why scheduling a tweet requires access to a dedicated Ads API but here we are. The twitter-together docs might be outdated, twitter is changing things all the time. pull requests welcome :) Here are some snippets. instantiate twitter and set userId and add account IDconst Twitter = require("twitter");
const twitter = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
});
// get account ID at https://ads.twitter.com/, press on "Create an ad", then
// copy the part the 2nd segment of the URL path, e.g.
// https://ads.twitter.com/onboarding/6zy0c/welcome?onboarding=true => 6zy0c
const accountId = "6zy0c";
// Get your Twitter account's user ID at https://codeofaninja.com/tools/find-twitter-id
const userId = "11754732"; List scheduled tweetstwitter.get(
`https://ads-api.twitter.com/9/accounts/${accountId}/scheduled_tweets`,
(error, result) => {
if (error) {
console.log(error);
return;
}
console.log(result);
}
); Create a new scheduled tweettwitter.post(
`https://ads-api.twitter.com/9/accounts/${accountId}/scheduled_tweets`,
{
scheduled_at: "2021-05-17T18:30:00Z",
as_user_id: userId,
text:
"π΄ Going live in 30 minutes: Automating gr2m/helpdesk, Episode II\n\nhttps://github.com/gr2m/helpdesk/issues/14",
nullcast: true,
},
(error, result) => {
if (error) {
console.log(`error`);
console.log(error);
return;
}
console.log(result);
}
); |
Twitter API documentation for scheduled tweets: |
I mentioned https://github.com/octokit/webhooks/ in the show. It has very complete JSON schemas and payload examples for all of GitHub's webhook event requests. Much more complete than what GitHub has on its own developer docs. It's a great @octokit community initiative by @wolfy1339 and other contributors |
Recording is now available on twitch: https://www.twitch.tv/videos/1026105427 |
The video is now archived on YouTube: https://youtu.be/9Y68cC7nR68 Feel free to add comments if you have more questions |
ππ» Automating gr2m/helpdesk, Episode II
π Monday, May 17th, 2021
π noon Pacific Time (in your timezone)
ποΈ no guests
π·οΈ Automation
Subscribe to this issues to get a notification before the show begins and a summary after the show concludes.
Automating gr2m/helpdesk
I've laid out the current process for this repository at https://github.com/gr2m/helpdesk/tree/f085060fb98f61a005c9e79df15fdad6466c6a1a#how-i-use-this-repository. It's mostly manual. Time to spice it up a bit with some automation!
In this show, I'll try to automate the tweeting and comments on the issue belonging to the show.
Outline
Preparation
Recording
Shownotes
twitter
packageThe text was updated successfully, but these errors were encountered: