Microsoft Flow 西日本豪雨を市町村別に振り分けるJSON

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "logicAppName": {
            "type": "String",
            "metadata": {
                "description": "Name of the logic app."
            }
        },
        "logicAppLocation": {
            "defaultValue": "[resourceGroup().location]",
            "allowedValues": [
                "eastasia",
                "southeastasia",
                "centralus",
                "eastus",
                "eastus2",
                "westus",
                "northcentralus",
                "southcentralus",
                "northeurope",
                "westeurope",
                "japanwest",
                "japaneast",
                "brazilsouth",
                "australiaeast",
                "australiasoutheast",
                "southindia",
                "centralindia",
                "westindia",
                "canadacentral",
                "canadaeast",
                "westcentralus",
                "westus2",
                "[resourceGroup().location]"
            ],
            "type": "String",
            "metadata": {
                "description": "Location of the logic app."
            }
        },
        "googlesheet_Connection_Name": {
            "defaultValue": "googlesheet",
            "type": "String",
            "metadata": {
                "description": "Name of the connection."
            }
        },
        "twitter_Connection_Name": {
            "defaultValue": "twitter",
            "type": "String",
            "metadata": {
                "description": "Name of the connection."
            }
        }
    },
    "resources": [
        {
            "type": "Microsoft.Logic/workflows",
            "name": "[parameters('logicAppName')]",
            "apiVersion": "2016-06-01",
            "location": "[parameters('logicAppLocation')]",
            "properties": {
                "state": "Disabled",
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {
                        "$connections": {
                            "defaultValue": {},
                            "type": "Object"
                        },
                        "$authentication": {
                            "defaultValue": {},
                            "type": "SecureObject"
                        }
                    },
                    "triggers": {
                        "新しいツイートが投稿されたら": {
                            "recurrence": {
                                "interval": 15,
                                "frequency": "Minute"
                            },
                            "splitOn": "@triggerBody()?['value']",
                            "metadata": {
                                "flowSystemMetadata": {
                                    "swaggerOperationId": "OnNewTweet"
                                }
                            },
                            "type": "ApiConnection",
                            "inputs": {
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['twitter']['connectionId']"
                                    }
                                },
                                "method": "get",
                                "path": "/onnewtweet",
                                "queries": {
                                    "searchQuery": "-RT #西日本豪雨 #愛媛県"
                                },
                                "authentication": "@parameters('$authentication')"
                            }
                        }
                    },
                    "actions": {
                        "条件": {
                            "actions": {
                                "行の挿入": {
                                    "runAfter": {},
                                    "metadata": {
                                        "1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08": "/西日本豪雨Twitter",
                                        "flowSystemMetadata": {
                                            "swaggerOperationId": "PostItem"
                                        }
                                    },
                                    "type": "ApiConnection",
                                    "inputs": {
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['googlesheet']['connectionId']"
                                            }
                                        },
                                        "method": "post",
                                        "body": {
                                            "日付": "@variables('datetime')",
                                            "ユーザー名": "@triggerBody()?['UserDetails']?['FullName']",
                                            "ツイート": "@triggerBody()?['TweetText']",
                                            "URL": "https://twitter.com/@{triggerBody()?['TweetedBy']}/status/@{triggerBody()?['TweetId']}"
                                        },
                                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08'))}/tables/@{encodeURIComponent(encodeURIComponent('0'))}/items",
                                        "authentication": "@parameters('$authentication')"
                                    }
                                }
                            },
                            "runAfter": {
                                "変数を初期化する": [
                                    "Succeeded"
                                ]
                            },
                            "expression": "@contains(triggerBody()?['TweetText'], '#宇和島市')",
                            "type": "If"
                        },
                        "条件_2": {
                            "actions": {
                                "行の挿入_2": {
                                    "runAfter": {},
                                    "metadata": {
                                        "1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08": "/西日本豪雨Twitter",
                                        "flowSystemMetadata": {
                                            "swaggerOperationId": "PostItem"
                                        }
                                    },
                                    "type": "ApiConnection",
                                    "inputs": {
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['googlesheet']['connectionId']"
                                            }
                                        },
                                        "method": "post",
                                        "body": {
                                            "日付": "@variables('datetime')",
                                            "ユーザー名": "@triggerBody()?['UserDetails']?['FullName']",
                                            "ツイート": "@triggerBody()?['TweetText']",
                                            "URL": "https://twitter.com/@{triggerBody()?['TweetedBy']}/status/@{triggerBody()?['TweetId']}"
                                        },
                                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08'))}/tables/@{encodeURIComponent(encodeURIComponent('1973976058'))}/items",
                                        "authentication": "@parameters('$authentication')"
                                    }
                                }
                            },
                            "runAfter": {
                                "条件": [
                                    "Succeeded"
                                ]
                            },
                            "expression": "@contains(triggerBody()?['TweetText'], '#吉田町')",
                            "type": "If"
                        },
                        "条件_3": {
                            "actions": {
                                "行の挿入_3": {
                                    "runAfter": {},
                                    "metadata": {
                                        "1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08": "/西日本豪雨Twitter",
                                        "flowSystemMetadata": {
                                            "swaggerOperationId": "PostItem"
                                        }
                                    },
                                    "type": "ApiConnection",
                                    "inputs": {
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['googlesheet']['connectionId']"
                                            }
                                        },
                                        "method": "post",
                                        "body": {
                                            "日付": "@variables('datetime')",
                                            "ユーザー名": "@triggerBody()?['UserDetails']?['FullName']",
                                            "ツイート": "@triggerBody()?['TweetText']",
                                            "URL": "https://twitter.com/@{triggerBody()?['TweetedBy']}/status/@{triggerBody()?['TweetId']}"
                                        },
                                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08'))}/tables/@{encodeURIComponent(encodeURIComponent('1157884523'))}/items",
                                        "authentication": "@parameters('$authentication')"
                                    }
                                }
                            },
                            "runAfter": {
                                "条件_2": [
                                    "Succeeded"
                                ]
                            },
                            "expression": "@contains(triggerBody()?['TweetText'], '#西予市')",
                            "type": "If"
                        },
                        "条件_4": {
                            "actions": {
                                "行の挿入_4": {
                                    "runAfter": {},
                                    "metadata": {
                                        "1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08": "/西日本豪雨Twitter",
                                        "flowSystemMetadata": {
                                            "swaggerOperationId": "PostItem"
                                        }
                                    },
                                    "type": "ApiConnection",
                                    "inputs": {
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['googlesheet']['connectionId']"
                                            }
                                        },
                                        "method": "post",
                                        "body": {
                                            "日付": "@variables('datetime')",
                                            "ユーザー名": "@triggerBody()?['UserDetails']?['FullName']",
                                            "ツイート": "@triggerBody()?['TweetText']",
                                            "URL": "https://twitter.com/@{triggerBody()?['TweetedBy']}/status/@{triggerBody()?['TweetId']}"
                                        },
                                        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('1_obWpwPUPbasX2YMWbhMv0L2cNT1MZPKgOGC7lqKz08'))}/tables/@{encodeURIComponent(encodeURIComponent('1365969714'))}/items",
                                        "authentication": "@parameters('$authentication')"
                                    }
                                }
                            },
                            "runAfter": {
                                "条件_3": [
                                    "Succeeded"
                                ]
                            },
                            "expression": "@contains(triggerBody()?['TweetText'], '#大洲市')",
                            "type": "If"
                        },
                        "変数を初期化する": {
                            "runAfter": {},
                            "type": "InitializeVariable",
                            "inputs": {
                                "variables": [
                                    {
                                        "name": "datetime",
                                        "type": "String",
                                        "value": "@{convertTimeZone(triggerBody()?['CreatedAtIso'],'UTC','Tokyo Standard Time','yyyy-MM-dd HH:mm:ss')}"
                                    }
                                ]
                            }
                        }
                    }
                },
                "parameters": {
                    "$connections": {
                        "value": {
                            "googlesheet": {
                                "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'googlesheet')]",
                                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('googlesheet_Connection_Name'))]",
                                "connectionName": "[parameters('googlesheet_Connection_Name')]"
                            },
                            "twitter": {
                                "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'twitter')]",
                                "connectionId": "[resourceId('Microsoft.Web/connections', parameters('twitter_Connection_Name'))]",
                                "connectionName": "[parameters('twitter_Connection_Name')]"
                            }
                        }
                    }
                },
                "runtimeConfiguration": {
                    "collections": {
                        "maximumItemCount": 5000
                    },
                    "performanceProfile": {
                        "throttles": {
                            "mode": "Low"
                        }
                    }
                }
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/connections', parameters('googlesheet_Connection_Name'))]",
                "[resourceId('Microsoft.Web/connections', parameters('twitter_Connection_Name'))]"
            ]
        },
        {
            "type": "Microsoft.Web/connections",
            "name": "[parameters('googlesheet_Connection_Name')]",
            "apiVersion": "2016-06-01",
            "location": "[parameters('logicAppLocation')]",
            "properties": {
                "api": {
                    "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'googlesheet')]"
                },
                "displayName": "[parameters('googlesheet_Connection_Name')]"
            }
        },
        {
            "type": "Microsoft.Web/connections",
            "name": "[parameters('twitter_Connection_Name')]",
            "apiVersion": "2016-06-01",
            "location": "[parameters('logicAppLocation')]",
            "properties": {
                "api": {
                    "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'twitter')]"
                },
                "displayName": "[parameters('twitter_Connection_Name')]"
            }
        }
    ]
}