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

Create a customer in square from shopify #285

Closed
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
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: 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: {}
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%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/).
Loading