将最新的blob存储内容附加到SendGrid

问题描述 投票:-1回答:1

如何使用逻辑应用程序在sendgrid服务中附加最新的blob内容?

sendgrid azure-logic-apps
1个回答
-1
投票

您可以使用SendGrid Action创建Blob触发器LA,如下所示:

{
    "$connections": {
        "value": {
            "azureblob": {
                "connectionId": "/subscriptions/<SubscriptionId>/resourceGroups/<ResourceGroup>/providers/Microsoft.Web/connections/azureblob",
                "connectionName": "azureblob",
                "id": "/subscriptions/<SubscriptionId>/providers/Microsoft.Web/locations/southeastasia/managedApis/azureblob"
            },
            "sendgrid": {
                "connectionId": "/subscriptions/<SubscriptionId>/resourceGroups/<ResourceGroup>/providers/Microsoft.Web/connections/sendgrid",
                "connectionName": "sendgrid",
                "id": "/subscriptions/<SubscriptionId>/providers/Microsoft.Web/locations/southeastasia/managedApis/sendgrid"
            }
        }
    },
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Get_blob_content_using_path": {
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/datasets/default/GetFileContentByPath",
                    "queries": {
                        "inferContentType": true,
                        "path": "@triggerBody()?['Path']",
                        "queryParametersSingleEncoded": true
                    }
                },
                "runAfter": {},
                "type": "ApiConnection"
            },
            "Send_email_(V2)": {
                "inputs": {
                    "body": {
                        "file": "@{base64(body('Get_blob_content_using_path'))}",
                        "filename": "@triggerBody()?['Name']",
                        "from": "<FromEmail>",
                        "ishtml": true,
                        "subject": "test attach met",
                        "text": "PFA",
                        "to": "<ToEmail>"
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['sendgrid']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/mail/send"
                },
                "runAfter": {
                    "Get_blob_content_using_path": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "When_a_blob_is_added_or_modified_(properties_only)": {
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/datasets/default/triggers/batch/onupdatedfile",
                    "queries": {
                        "folderId": "JTJmbGFjb250YWluZXI=",
                        "maxFileCount": 10
                    }
                },
                "metadata": {
                    "JTJmbGFjb250YWluZXI=": "/lacontainer"
                },
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "splitOn": "@triggerBody()",
                "type": "ApiConnection"
            }
        }
    }
}

enter image description here enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.