auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, auths) => {
}
const {axios} = require("@pipedreamhq/platform")
const getStatusID = () => {
const buf = new Buffer(steps.trigger.raw_event.body_b64, 'base64')
console.log(buf.toString())
const urlParts = buf.toString().split('/')
const tweet_id = urlParts.length == 0 ? '' : urlParts.slice(-1)[0]
console.log(tweet_id)
return tweet_id
}
const oauthSignerUri = auths.twitter.oauth_signer_uri
function config (statusId) {
return {
url: `https://api.twitter.com/1.1/statuses/update.json`,
method: 'POST',
params: {
status: `https://www.youtube.com/watch?v=iWLE8pVLgNE`,
in_reply_to_status_id: statusId,
auto_populate_reply_metadata: true,
},
}
}
const token = {
key: auths.twitter.oauth_access_token,
secret: auths.twitter.oauth_refresh_token,
}
const signConfig = {
token,
oauthSignerUri
}
await axios(this, config(getStatusID()), signConfig)