Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Update Twitter avatar with Apps Script
function oAuthConfig() {
var oAuthConfig = UrlFetchApp.addOAuthService("twitter");
// Register an app at to get the following key and secret
oAuthConfig.setConsumerKey("PUT CONSUMER KEY HERE");
oAuthConfig.setConsumerSecret("PUT CONSUMER SECRET HERE");
function setProfileImage() {
// This is a picture that will be set as Twitter avatar
var picture = UrlFetchApp.fetch("");
var encodedImage = Utilities.base64Encode(picture.getContent());
var options =
"method": "post",
"oAuthServiceName" : "twitter",
"oAuthUseToken" : "always",
"payload": { "image" : encodedImage, "skip_status": true}
var request = UrlFetchApp.fetch("", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment