Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer customer between Square and Shopify usecase #359

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions resources/Transfer customer between Square and Shopify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
$integration: http://ibm.com/appconnect/integration/v2/integrationFile
integration:
type: api
trigger-interfaces:
trigger-interface-1:
triggers:
createCreate_customer:
assembly:
$ref: '#/integration/assemblies/assembly-1'
input-context:
data: create_customer
output-context:
data: create_customer
options:
resources:
- business-object: create_customer
model:
$ref: '#/models/create_customer'
triggers:
create: createCreate_customer
type: api-trigger
action-interfaces:
action-interface-1:
type: api-action
business-object: customers
connector-type: square
actions:
CREATE: {}
action-interface-2:
type: api-action
business-object: customers
connector-type: square
actions:
RETRIEVEALL: {}
action-interface-3:
type: api-action
business-object: customer
connector-type: shopify
actions:
CREATE: {}
assemblies:
assembly-1:
assembly:
execute:
- create-action:
name: Square Create customer
target:
$ref: '#/integration/action-interfaces/action-interface-1'
map:
mappings:
- address:
mappings:
- address_line_1:
template: '{{$Request.address.address_line_1}}'
- address_line_2:
template: '{{$Request.address.address_line_2}}'
- country:
template: '{{$Request.address.country}}'
- postal_code:
template: '{{$Request.address.postcode}}'
- email_address:
template: '{{$Request.email}}'
- family_name:
template: '{{$Request.name}}'
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Request
$ref: '#/trigger/payload'
- variable: flowDetails
$ref: '#/flowDetails'
- retrieve-action:
name: Square Retrieve customers
target:
$ref: '#/integration/action-interfaces/action-interface-2'
filter:
where:
customer_id: '{{$SquareCreatecustomer.customer_id}}'
input:
- variable: Request
$ref: '#/trigger/payload'
- variable: SquareCreatecustomer
$ref: '#/node-output/Square Create customer/response/payload'
- variable: flowDetails
$ref: '#/flowDetails'
limit: 1
allow-truncation: false
pagination-type: TOKEN
allow-empty-output: false
- create-action:
name: Shopify Create customer
target:
$ref: '#/integration/action-interfaces/action-interface-3'
map:
mappings:
- addresses:
foreach:
input: '[{}]'
iterator: addressesItem
mappings:
- address1:
template: >-
{{$SquareRetrievecustomers.address.address_line_1}}
- address2:
template: >-
{{$SquareRetrievecustomers.address.address_line_2}}
- country:
template: '{{$SquareRetrievecustomers.address.country}}'
- zip:
template: '{{$SquareRetrievecustomers.address.postal_code}}'
- email:
template: '{{$SquareRetrievecustomers.email_address}}'
- first_name:
template: '{{$SquareRetrievecustomers.family_name}}'
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Request
$ref: '#/trigger/payload'
- variable: SquareCreatecustomer
$ref: '#/node-output/Square Create customer/response/payload'
- variable: SquareRetrievecustomers
$ref: '#/node-output/Square Retrieve customers/response/payload'
- variable: SquareRetrievecustomersMetadata
$ref: '#/node-output/Square Retrieve customers/response'
- variable: flowDetails
$ref: '#/flowDetails'
- response:
name: response-1
reply-maps:
- title: create_customer successfully created
status-code: 201
map:
mappings:
- id:
template: '{{$ShopifyCreatecustomer.id}}'
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Request
$ref: '#/trigger/payload'
- variable: SquareCreatecustomer
$ref: '#/node-output/Square Create customer/response/payload'
- variable: SquareRetrievecustomers
$ref: >-
#/node-output/Square Retrieve
customers/response/payload
- variable: SquareRetrievecustomersMetadata
$ref: '#/node-output/Square Retrieve customers/response'
- variable: ShopifyCreatecustomer
$ref: '#/node-output/Shopify Create customer/response/payload'
- variable: flowDetails
$ref: '#/flowDetails'
input: []
name: Usecase1
models:
create_customer:
name: create_customer
properties:
id:
required: false
id: true
type: string
name:
required: false
id: false
type: string
email:
required: false
id: false
type: string
address:
required: false
id: false
type:
address_line_1:
required: false
id: false
type: string
address_line_2:
required: false
id: false
type: string
country:
required: false
id: false
type: string
postcode:
required: false
id: false
type: string
plural: create_customer
description: ' '
operations:
create: '#/integration/assemblies/assembly-1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
To refer to these instructions while editing the flow, open the [GitHub page](https://github.com/ot4i/app-connect-templates/tree/master/resources/markdown/Transfer%20customer%20between%20Square%20and%20Shopify_instructions.md) (opens in a new window).


1. Click **Create flow** to start using the template.
2. Connect to the following accounts by using your credentials:
- **Square**
- **Shopify**
3. To start the flow, in the banner, open the options menu [⋮], and then click **Start flow**.

The flow is started whenever a new file gets created in Square.

For more information, visit the IBM Integration Community for this use case. See, [Using IBM® App Connect to interact with Square](https://community.ibm.com/community/user/integration/blogs/deepak-ayilliath/2023/01/27/using-ibm-app-connect-to-interact-with-square).
9 changes: 9 additions & 0 deletions resources/template-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,15 @@
"targetApps": ["hubspotcrm", "salesforce"],
"tags": ["salesforce", "hubspotcrm", "if"],
"offerings": ["app connect professional"]
},
{
"name": "Transfer customer between Square and Shopify",
"description": "Use this template to transfer customer between square and shopify.",
"summary": "Square to 1 applications",
"sourceApp": "square",
"targetApps": ["square", "shopify"],
"tags": ["salesforce", "shopify"],
"offerings": ["app connect professional"]
}
]
}