See the supported connectors for Application Integration.
Invoke a sub-integration to send an email
Using the For Each Loop task, invoke a sub-integration that takes input from the main integration to send email notifications.
Code sample: Sub-integration
{
"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"
}]
}
Code sample: Main Integration
{
"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"
}]
}
Sample integration flow
The following images shows a sample layout of the integration editor for this integration code sample.
Main Integration
Upload and run the sample integration
To upload and run the sample integration, do the following steps:
Save the integration sample as a .json file on your system.
In the Google Cloud console, go to the Application Integration page.
Go to Application Integration
In the navigation menu, click Integrations . The Integrations page appears.
Select an existing integration or create a new integration by clicking Create integration .
If you are creating a new integration:
Enter a name and description in the Create Integration dialog.
Select a region for the integration.
Note: The Regions dropdown only lists the regions provisioned in your Google Cloud project. To provision a new region, Click Enable Region . See Enable new region for more information.
Select a service account for the integration. You can change or update the service account details of an integration any time from the info Integration summary pane in the integration toolbar.
Note: The option to select a service account is displayed only if you have enabled integration governance for the selected region.
Click Create .
This opens the integration in the integration editor .
In the integration editor , click publish Upload/download menu and then select Upload integration .
In the file browser dialog, select the file that you saved in step 1, and then click Open .
A new version of the integration is created using the uploaded file.
In the integration editor , click Test .
Click Test integration . This runs the integration and displays the execution result in the Test Integration pane.