Skip to content

Commit

Permalink
Shopify to square connector template (#358)
Browse files Browse the repository at this point in the history
* Update template-metadata.json

* Create Create a customer in square when a customer created in shopify.yaml

* Create Create a customer in square when a customer created in shopify_instructions.md

* Update and rename Create a customer in square when a customer created in shopify.yaml to Create a customer in Square when a customer is created in Shopify.yaml

correction

* Update and rename Create a customer in square when a customer created in shopify_instructions.md to Create a customer in Square when a customer is created in Shopify_instructions.md

corrections

* Update template-metadata.json

corrections

---------

Co-authored-by: Deepak Ayilliath <[email protected]>
  • Loading branch information
prafullmahajan and Deepak-Ayilliath authored Sep 8, 2023
1 parent 79e6005 commit d16ec32
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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: Create a customer in Square when a customer is created in Shopify
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: {}
Original file line number Diff line number Diff line change
@@ -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%20is%20created%20in%20Shopify_instructions.md) (opens in a new window).

1. Click **Create flow** to start using the template.
1. Click **Operations**, then click **Edit flow** to edit the operations.
1. Click on the Shopify node, and if you're not already connected, connect to your [Shopify account](https://ibm.biz/acshopify).
1. Click on the Square node, and if you're not already connected, connect to your [Square account](https://ibm.biz/acsquare).
1. Click **Done**.
1. To start the flow, in the banner click **Start flow**.

For more information about this flow, see the tutorial [Creating flows for an API](https://www.ibm.com/docs/en/app-connect/saas?topic=designer-introduction-creating-flows-api-part-1).
11 changes: 10 additions & 1 deletion resources/template-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,15 @@
"targetApps": ["asana"],
"tags": ["surveymonkey", "asana"],
"offerings": ["app connect professional"]
}
},
{
"name": "Create a customer in Square when a customer is created in Shopify",
"description": "Use this template to create a new customer in Square when a new customer is created in Shopify.",
"summary": "2 flows using 2 applications",
"sourceApp": "api",
"targetApps": ["shopify", "square"],
"tags": ["api", "shopify", "square"],
"offerings": ["app connect professional"]
}
]
}

0 comments on commit d16ec32

Please sign in to comment.