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

Shopify to square connector template #358

Merged
merged 6 commits into from
Sep 8, 2023
Merged
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
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"]
}
]
}
Loading