查看 Application Integration 支持的连接器

调用子集成以发送电子邮件

使用 For Each 循环任务,调用从主集成获取输入以发送电子邮件通知的子集成。

代码示例:子集成

{
  "triggerConfigs": [{
    "label": "API Trigger",
    "startTasks": [{
      "taskId": "1"
    }],
    "properties": {
      "Trigger name": "SubIntegrationSendEmailDemo_API_1"
    },
    "triggerType": "API",
    "triggerNumber": "1",
    "triggerId": "api_trigger/SubIntegrationSendEmailDemo_API_1"
  }],
  "taskConfigs": [{
    "task": "EmailTask",
    "taskId": "1",
    "parameters": {
      "Cc": {
        "key": "Cc",
        "value": {
          "stringArray": {
          }
        }
      },
      "TextBody": {
        "key": "TextBody",
        "value": {
          "stringValue": "$EmailContent$"
        }
      },
      "Bcc": {
        "key": "Bcc",
        "value": {
          "stringArray": {
          }
        }
      },
      "AttachmentPath": {
        "key": "AttachmentPath",
        "value": {
          "stringArray": {
          }
        }
      },
      "To": {
        "key": "To",
        "value": {
          "stringArray": {
            "stringValues": ["$Recipients$"]
          }
        }
      },
      "BodyFormat": {
        "key": "BodyFormat",
        "value": {
          "stringValue": "text"
        }
      },
      "EmailConfigInput": {
        "key": "EmailConfigInput",
        "value": {
          "jsonValue": "{\n  \"@type\": \"type.googleapis.com/enterprise.crm.eventbus.proto.EmailConfig\"\n}"
        }
      },
      "Subject": {
        "key": "Subject",
        "value": {
          "stringValue": "$Email_Subject$"
        }
      }
    },
    "taskExecutionStrategy": "WHEN_ALL_SUCCEED",
    "displayName": "Send Email"
  }],
  "integrationParameters": [{
    "key": "EmailContent",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": ""
    },
    "displayName": "EmailContent",
    "inputOutputType": "IN"
  }, {
    "key": "Recipients",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": ""
    },
    "displayName": "Recipients",
    "inputOutputType": "IN"
  }, {
    "key": "Email_Subject",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": ""
    },
    "displayName": "Email_Subject",
    "inputOutputType": "IN"
  }]
}

代码示例:主要集成

{
  "triggerConfigs": [{
    "label": "API Trigger",
    "startTasks": [{
      "taskId": "1"
    }],
    "properties": {
      "Trigger name": "ForEachLoopDemo_API_1"
    },
    "triggerType": "API",
    "triggerNumber": "1",
    "triggerId": "api_trigger/ForEachLoopDemo_API_1"
  }],
  "taskConfigs": [{
    "task": "SubWorkflowForEachLoopV2Task",
    "taskId": "1",
    "parameters": {
      "iterationElementMapping": {
        "key": "iterationElementMapping",
        "value": {
          "stringValue": "EmailContent"
        }
      },
      "aggregatorParameterMapping": {
        "key": "aggregatorParameterMapping"
      },
      "triggerId": {
        "key": "triggerId",
        "value": {
          "stringValue": "api_trigger/SubIntegrationSendEmailDemo_API_1"
        }
      },
      "loopMetadata": {
        "key": "loopMetadata",
        "value": {
          "stringArray": {
            "stringValues": ["$`Task_1_loopMetadata`$"]
          }
        }
      },
      "disableEucPropagation": {
        "key": "disableEucPropagation",
        "value": {
          "booleanValue": false
        }
      },
      "listToIterate": {
        "key": "listToIterate",
        "value": {
          "stringValue": "$ListOfEmailContent$"
        }
      },
      "workflowName": {
        "key": "workflowName",
        "value": {
          "stringValue": "SubIntegrationSendEmailDemo"
        }
      },
      "requestParameterMapping": {
        "key": "requestParameterMapping",
        "value": {
          "jsonValue": "{\n  \"@type\": \"type.googleapis.com/enterprise.crm.eventbus.proto.ParameterMap\",\n  \"entries\": [{\n    \"key\": {\n      \"literalValue\": {\n        \"stringValue\": \"Recipients\"\n      }\n    },\n    \"value\": {\n      \"literalValue\": {\n        \"stringValue\": \"Recipients\"\n      }\n    }\n  }, {\n    \"key\": {\n      \"literalValue\": {\n        \"stringValue\": \"Email_Subject\"\n      }\n    },\n    \"value\": {\n      \"literalValue\": {\n        \"stringValue\": \"Email_Subject\"\n      }\n    }\n  }]\n}"
        }
      },
      "overrideParameterMapping": {
        "key": "overrideParameterMapping"
      }
    },
    "taskExecutionStrategy": "WHEN_ALL_SUCCEED",
    "displayName": "For Each Loop"
  }],
  "integrationParameters": [{
    "key": "`Task_1_loopMetadata`",
    "dataType": "JSON_VALUE",
    "displayName": "`Task_1_loopMetadata`",
    "isTransient": true,
    "producer": "1_1"
  }, {
    "key": "Recipients",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": ""
    },
    "displayName": "Recipients",
    "inputOutputType": "IN"
  }, {
    "key": "Email_Subject",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": ""
    },
    "displayName": "Email_Subject",
    "inputOutputType": "IN"
  }, {
    "key": "ListOfEmailContent",
    "dataType": "STRING_ARRAY",
    "defaultValue": {
      "stringArray": {
        "stringValues": ["\"Content 1\"", "\"Content 2\"", "\"Content 3\"", "\"Content 4\""]
      }
    },
    "displayName": "ListOfEmailContent",
    "inputOutputType": "IN"
  }]
}

集成流程示例

以下图片显示了此集成代码示例的集成编辑器的示例布局。

子集成

显示示例子集成流程的图片 显示示例子集成流程的图片

主要集成

显示主集成流程示例的图片 显示主集成流程示例的图片

上传并运行示例集成

如需上传并运行示例集成,请按以下步骤操作:

  1. 集成示例保存为系统上的 .json 文件。
  2. 在 Google Cloud 控制台中,前往 Application Integration 页面。

    转到 Application Integration

  3. 在导航菜单中,点击集成。系统随即会显示集成页面。
  4. 选择现有集成,或通过点击创建集成来创建新的集成。

    要创建新的集成,请执行以下操作:

    1. 创建 Integrations对话框中输入名称和说明。
    2. 选择集成的区域。
    3. 为集成选择服务账号。您随时可以在集成工具栏的 集成摘要窗格中更改或更新集成的服务账号详细信息。
    4. 点击创建

    这将在集成编辑器中打开集成。

  5. 集成编辑器中,点击 “上传/下载”菜单,然后选择上传集成
  6. 在文件浏览器对话框中,选择您在第 1 步中保存的文件,然后点击 Open

    系统会使用上传的文件创建新版本的集成。

  7. 在集成编辑器中,点击测试
  8. 点击测试集成。这将运行集成,并在 Test Integration 窗格中显示执行结果。