Skip to content

Instantly share code, notes, and snippets.

@bdunnette
Created July 1, 2019 15:02
Show Gist options
  • Save bdunnette/123431793c35d72a36cdabad63b7f677 to your computer and use it in GitHub Desktop.
Save bdunnette/123431793c35d72a36cdabad63b7f677 to your computer and use it in GitHub Desktop.
function postToot(text) {
host_instance = 'https://botsin.space'
token = 'your-token-goes-here'
var data = {
'status': text,
'visibility' : 'public'
};
var options = {
'method' : 'post',
'headers':{'Authorization':'Bearer ' + token},
'contentType': 'application/json',
'payload' : JSON.stringify(data)
};
var response = UrlFetchApp.fetch(host_instance + '/api/v1/statuses', options);
Logger.log(response.getContentText());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment