Lihat konektor yang didukung untuk Application Integration.

Memanggil sub-integrasi untuk mengirim email

Dengan menggunakan tugas For Every Loop, panggil sub-integrasi yang mengambil input dari integrasi utama untuk mengirim notifikasi email.

Contoh kode: Sub-integrasi

{
  "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"
  }]
}

Contoh kode: Integrasi Utama

{
  "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"
  }]
}

Contoh alur integrasi

Gambar berikut menunjukkan contoh tata letak editor integrasi untuk contoh kode integrasi ini.

Sub-integrasi

gambar yang menunjukkan contoh alur sub-integrasi gambar yang menunjukkan contoh alur sub-integrasi

Integrasi Utama

gambar yang menunjukkan contoh alur integrasi utama gambar yang menunjukkan contoh alur integrasi utama

Mengupload dan menjalankan contoh integrasi

Untuk mengupload dan menjalankan contoh integrasi, lakukan langkah-langkah berikut:

  1. Simpan contoh integrasi sebagai file .json di sistem Anda.
  2. Di konsol Google Cloud, buka halaman Application Integration.

    Buka Application Integration

  3. Di menu navigasi, klik Integrasi. Halaman Integrations List akan muncul.
  4. Pilih integrasi yang ada atau buat integrasi baru dengan mengklik Buat integrasi.

    Jika Anda membuat integrasi baru:

    1. Masukkan nama dan deskripsi dalam dialog Create Integration.
    2. Pilih region untuk integrasi.
    3. Pilih akun layanan untuk integrasi. Anda dapat mengubah atau memperbarui detail akun layanan integrasi kapan saja dari panel Integration summary di toolbar integrasi.
    4. Klik Create.

    Tindakan ini akan membuka integrasi di editor integrasi.

  5. Di editor integrasi, klik Menu upload/download, lalu pilih Upload integrasi.
  6. Dalam dialog file browser, pilih file yang Anda simpan di langkah 1, lalu klik Open.

    Versi baru integrasi dibuat menggunakan file yang diupload.

  7. Di editor integrasi, klik Test.
  8. Klik Uji integrasi. Tindakan ini akan menjalankan integrasi dan menampilkan hasil eksekusi dalam dialog Test Integration.