Created
March 1, 2023 09:20
-
-
Save naosim/d61e5a200c1b5de3878a283acdf1fe18 to your computer and use it in GitHub Desktop.
GoogleAppsScriptでMisskeyに投稿する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} text | |
* @param { {server: string, token: string} } options options.serverはたとえば"misskey.io" | |
*/ | |
function postToMisskey(text, options) { | |
return UrlFetchApp.fetch( | |
`https://${options.server}/api/notes/create`, | |
{ | |
'method': 'POST', | |
'headers' : {'Content-Type': 'application/json'}, | |
'payload':JSON.stringify({i : options.token, text: text}) | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment