Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created April 17, 2019 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpowell/5f37e2ae873b779abd75db4718eb58a8 to your computer and use it in GitHub Desktop.
Save aaronpowell/5f37e2ae873b779abd75db4718eb58a8 to your computer and use it in GitHub Desktop.
Auto tweeting logic app
{
"$connections": {
"value": {
"rss": {
"connectionId": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/resourceGroups/personal-website/providers/Microsoft.Web/connections/rss",
"connectionName": "rss",
"id": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/providers/Microsoft.Web/locations/southcentralus/managedApis/rss"
},
"twitter": {
"connectionId": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/resourceGroups/personal-website/providers/Microsoft.Web/connections/twitter",
"connectionName": "twitter",
"id": "/subscriptions/7e2b0a07-47db-4a2e-bfca-03c0d5b75f15/providers/Microsoft.Web/locations/southcentralus/managedApis/twitter"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Delay": {
"inputs": {
"interval": {
"count": 12,
"unit": "Hour"
}
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Wait"
},
"For_each": {
"actions": {
"Post_a_tweet": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['twitter']['connectionId']"
}
},
"method": "post",
"path": "/posttweet",
"queries": {
"tweetText": "I just blogged: @{triggerBody()?['title']} @{items('For_each')} #@{body('Hashtagged_Categories')}"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@triggerBody()?['links']",
"runAfter": {
"Hashtagged_Categories": [
"Succeeded"
]
},
"type": "Foreach"
},
"For_each_delay": {
"actions": {
"Post_a_tweet_delay": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['twitter']['connectionId']"
}
},
"method": "post",
"path": "/posttweet",
"queries": {
"tweetText": "ICYMI: I blogged: @{triggerBody()?['title']} @{items('For_each_delay')} @{body('Hashtagged_Categories')}"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@triggerBody()?['links']",
"runAfter": {
"Delay": [
"Succeeded"
]
},
"type": "Foreach"
},
"Hashtagged_Categories": {
"inputs": {
"from": "@triggerBody()?['categories']",
"joinWith": " #"
},
"runAfter": {},
"type": "Join"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_feed_item_is_published": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['rss']['connectionId']"
}
},
"method": "get",
"path": "/OnNewFeed",
"queries": {
"feedUrl": "https://www.aaron-powell.com/index.xml"
}
},
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"splitOn": "@triggerBody()?['value']",
"type": "ApiConnection"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment