From e9641c92cbef8ead8d93aaed2a16968705e9448f Mon Sep 17 00:00:00 2001 From: prafullmahajan <55887834+prafullmahajan@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:25:01 +0000 Subject: [PATCH 1/3] Create Create a customer in square when a customer created in shopify.yaml --- ...re when a customer created in shopify.yaml | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 resources/Create a customer in square when a customer created in shopify.yaml diff --git a/resources/Create a customer in square when a customer created in shopify.yaml b/resources/Create a customer in square when a customer created in shopify.yaml new file mode 100644 index 000000000..dad022f2f --- /dev/null +++ b/resources/Create a customer in square when a customer created in shopify.yaml @@ -0,0 +1,188 @@ +$integration: http://ibm.com/appconnect/integration/v2/integrationFile +integration: + type: api + trigger-interfaces: + trigger-interface-1: + triggers: + createCustomer: + assembly: + $ref: '#/integration/assemblies/assembly-1' + input-context: + data: Customer + output-context: + data: Customer + retrieveCustomer: + assembly: + $ref: '#/integration/assemblies/assembly-2' + input-context: + data: Customer + output-context: + data: Customer + options: + resources: + - business-object: Customer + model: + $ref: '#/models/Customer' + triggers: + create: createCustomer + retrieve: retrieveCustomer + type: api-trigger + action-interfaces: + action-interface-1: + type: api-action + business-object: customer + connector-type: shopify + actions: + CREATE: {} + action-interface-2: + type: api-action + business-object: customer + connector-type: shopify + actions: + RETRIEVEALL: {} + action-interface-3: + type: api-action + business-object: customers + connector-type: square + actions: + CREATE: {} + assemblies: + assembly-1: + assembly: + execute: + - create-action: + name: Shopify Create customer + target: + $ref: '#/integration/action-interfaces/action-interface-1' + map: + mappings: + - email: + template: '{{$Request.email}}' + - first_name: + template: '{{$Request.first_name}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + - response: + name: response-1 + reply-maps: + - title: Customer successfully created + status-code: '200' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: ShopifyCreatecustomer + $ref: '#/node-output/Shopify Create customer/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - id: + expression: '$ShopifyCreatecustomer.id ' + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: ShopifyCreatecustomer + $ref: '#/node-output/Shopify Create customer/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + assembly-2: + assembly: + execute: + - retrieve-action: + name: Shopify Retrieve customers + target: + $ref: '#/integration/action-interfaces/action-interface-2' + filter: + where: + id: '{{$api.id}}' + input: + - variable: api + $ref: '#/trigger/api/parameters' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: true + pagination-type: TOKEN + allow-empty-output: false + - create-action: + name: Square Create customer + target: + $ref: '#/integration/action-interfaces/action-interface-3' + map: + mappings: + - email_address: + template: '{{$ShopifyRetrievecustomers.email}}' + - given_name: + template: '{{$ShopifyRetrievecustomers.first_name}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: api + $ref: '#/trigger/api/parameters' + - variable: ShopifyRetrievecustomers + $ref: '#/node-output/Shopify Retrieve customers/response/payload' + - variable: ShopifyRetrievecustomersMetadata + $ref: '#/node-output/Shopify Retrieve customers/response' + - variable: flowDetails + $ref: '#/flowDetails' + - response: + name: response-1 + reply-maps: + - title: Customer successfully retrieved + status-code: '$ShopifyRetrievecustomersMetadata."status-code" ' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: api + $ref: '#/trigger/api/parameters' + - variable: ShopifyRetrievecustomers + $ref: >- + #/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: '#/node-output/Shopify Retrieve customers/response' + - variable: SquareCreatecustomer + $ref: '#/node-output/Square Create customer/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - id: + expression: '$SquareCreatecustomer.customer_id ' + input: + - variable: api + $ref: '#/trigger/api/parameters' + - variable: ShopifyRetrievecustomers + $ref: >- + #/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: '#/node-output/Shopify Retrieve customers/response' + - variable: flowDetails + $ref: '#/flowDetails' + name: Shopify Usecase +models: + Customer: + name: Customer + properties: + first_name: + required: false + id: false + type: string + id: + required: false + id: true + type: number + email: + required: false + id: false + type: string + plural: Customer + description: ' ' + operations: + create: '#/integration/assemblies/assembly-1' + retrieve: '#/integration/assemblies/assembly-2' + methods: {} From f0890cd4c2095dfef35885930151c16b2c1a53d6 Mon Sep 17 00:00:00 2001 From: prafullmahajan <55887834+prafullmahajan@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:30:37 +0000 Subject: [PATCH 2/3] Update template-metadata.json --- resources/template-metadata.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/template-metadata.json b/resources/template-metadata.json index a41d4db87..3a61c9307 100644 --- a/resources/template-metadata.json +++ b/resources/template-metadata.json @@ -1159,6 +1159,15 @@ "targetApps": ["jenkins", "slack"], "tags": ["github", "jenkins", "slack"], "offerings": ["app connect professional"] - } + }, + { + "name": "Create a customer in Square when a new customer created in Shopify", + "description": "This template creates a new customer in Square when a new customer is created in Shopify.", + "summary": "Shopify to 1 application", + "sourceApp": "Shopify", + "targetApps": ["Square"], + "tags": ["Shopify", "Square"], + "offerings": ["app connect professional"] + } ] } From c817e792df82bba9dd02adcf7b3b7194b8f2fd25 Mon Sep 17 00:00:00 2001 From: prafullmahajan <55887834+prafullmahajan@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:31:51 +0000 Subject: [PATCH 3/3] Create Create a customer in square when a customer created in shopify_instructions.md --- ... when a customer created in shopify_instructions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 resources/markdown/Create a customer in square when a customer created in shopify_instructions.md diff --git a/resources/markdown/Create a customer in square when a customer created in shopify_instructions.md b/resources/markdown/Create a customer in square when a customer created in shopify_instructions.md new file mode 100644 index 000000000..94a3c2095 --- /dev/null +++ b/resources/markdown/Create a customer in square when a customer created in shopify_instructions.md @@ -0,0 +1,10 @@ +To refer to these instructions while editing the flow, open [the github page](https://github.com/ot4i/app-connect-templates/blob/master/resources/markdown/Create%20a%20customer%20in%20square%20when%20a%20customer%20created%20in%20shopify.md) (opens in a new window). + +1. Click **Create flow** to start using the template. +1. Click **Operations**, then **Edit flow** for the Create Customer operation. +1. Connect to your [Shopify account](https://partners.shopify.com/). +1. Click on the Shopify node, and if you're not already connected, connect to your [Shopify account](https://developer.ibm.com/integration/docs/app-connect/how-to-guides-for-apps/). +1. Connect to your [Square account](https://developer.squareup.com/). +1. To start the flow, in the banner open the options menu [⋮] then click **Start flow**. + +For more information about this flow, see the tutorial [Creating flows for an API](https://developer.ibm.com/integration/docs/app-connect/tutorials-for-ibm-app-connect/creating-flows-api/).