Created
October 12, 2016 21:32
-
-
Save marbemac/8b76264b5e8ab64068135ac7cb99cd03 to your computer and use it in GitHub Desktop.
twitter retweet flow
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
{ | |
"name": "Retweet Stoplight's latest tweet", | |
"description": "This scenario will grab the latest Stoplight tweet, and retweet it. The twitter API requires that requests be authenticated with oauth1. Before you can run this scenario, you must fill out the variables below.\n\n1. Create a new app at [https://apps.twitter.com](https://apps.twitter.com). No callback url needed.\n2. Navigate to the keys and access tokens tab of your app (see screenshot), and copy paste the tokens and secrets below.\n3. Click run scenario above!\n\n", | |
"steps": [ | |
{ | |
"functions": [ | |
{ | |
"name": "Get latest tweet", | |
"input": { | |
"authorization": { | |
"oauth1": { | |
"tokenSecret": "<<!twitter.tokenSecret>>", | |
"token": "<<!twitter.token>>", | |
"consumerSecret": "<<!twitter.consumerSecret>>", | |
"consumerKey": "<<!twitter.consumerKey>>", | |
"encode": true | |
}, | |
"type": "oauth1" | |
}, | |
"request": { | |
"url": "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=stoplightio", | |
"method": "get" | |
} | |
}, | |
"after": { | |
"transforms": [ | |
{ | |
"sourceLocation": "result.output.response.body", | |
"sourcePath": "[0].id_str", | |
"targetLocation": "result.state", | |
"targetPath": "twitter.idToRetweet" | |
} | |
] | |
} | |
} | |
] | |
}, | |
{ | |
"functions": [ | |
{ | |
"name": "Retweet", | |
"input": { | |
"request": { | |
"method": "post", | |
"url": "https://api.twitter.com/1.1/statuses/retweet/<<twitter.idToRetweet>>.json" | |
}, | |
"authorization": { | |
"type": "oauth1", | |
"oauth1": { | |
"consumerKey": "<<twitter.consumerKey>>", | |
"consumerSecret": "<<twitter.consumerSecret>>", | |
"token": "<<twitter.token>>", | |
"tokenSecret": "<<twitter.tokenSecret>>", | |
"encode": true | |
} | |
} | |
}, | |
"after": { | |
"assertions": [ | |
{ | |
"location": "result.output.response.status", | |
"op": "eq", | |
"expected": 200 | |
} | |
] | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment