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

usecase for ZohoBooks #483

Closed
wants to merge 3 commits 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
$integration: http://ibm.com/appconnect/integration/v2/integrationFile
integration:
type: trigger-action
trigger-interfaces:
trigger-interface-1:
connector-type: streaming-connector-scheduler
type: event-trigger
triggers:
SCHEDULE:
input-context:
data: scheduler
assembly:
$ref: '#/integration/assemblies/assembly-1'
options:
subscription:
scheduleConfiguration:
interval:
unit: minute
value: 1
runOnceOncheck: false
days:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
timeZone: UTC
action-interfaces:
action-interface-1:
type: api-action
business-object: order
connector-type: shopify
actions:
RETRIEVEALL: {}
action-interface-2:
type: api-action
business-object: postQuotes_model
connector-type: zohobooks
actions:
postQuotes: {}
action-interface-3:
type: api-action
business-object: message
connector-type: slack
actions:
CREATE: {}
assemblies:
assembly-1:
assembly:
execute:
- retrieve-action:
name: Shopify Retrieve orders
target:
$ref: '#/integration/action-interfaces/action-interface-1'
filter:
where:
created_at_min: '{{$Trigger.lastEventTime}}'
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: flowDetails
$ref: '#/flowDetails'
limit: 10
allow-truncation: true
pagination-type: TOKEN
allow-empty-output: true
- for-each:
name: For each
assembly:
$ref: '#/integration/assemblies/assembly-2'
source:
expression: '$ShopifyRetrieveorders '
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: flowDetails
$ref: '#/flowDetails'
mode: sequential
continue-on-error: true
map:
$map: http://ibm.com/appconnect/map/v1
customSchemas:
properties.`output`:
type: object
properties:
Order_Number:
type: string
id:
type: string
input:
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: Trigger
$ref: '#/trigger/payload'
- variable: ZohoBooksCreatequote
$ref: >-
#/block/For each/node-output/Zoho Books Create
quote/response/payload
- variable: ShopifyRetrieveorders
$ref: '#/node-output/Shopify Retrieve orders/response/payload'
- variable: ShopifyRetrieveordersMetadata
$ref: '#/node-output/Shopify Retrieve orders/response'
- variable: flowDetails
$ref: '#/flowDetails'
mappings:
- output:
mappings:
- Order_Number:
template: '{{$ZohoBooksCreatequote.reference_number}}'
- id:
template: '{{$ZohoBooksCreatequote.estimate_id}}'
display-name: Shopify order
- logging:
name: Log
map:
$map: http://ibm.com/appconnect/map/v1
mappings:
- logLevel:
template: Info
- logMessage:
template: Order Number=>{{$Foreach.output.Order_Number}}
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreach
$ref: '#/node-output/For each/response/payload'
- variable: flowDetails
$ref: '#/flowDetails'
tags:
- incomplete
assembly-2:
assembly:
execute:
- custom-action:
name: Zoho Books Create quote
target:
$ref: '#/integration/action-interfaces/action-interface-2'
action: postQuotes
map:
mappings:
- customer_id:
template: '1332619000000031077'
- line_items:
foreach:
input: '$Foreachitem.line_items '
iterator: line_itemsItem
mappings:
- description:
template: '{{$line_itemsItem.title}}'
- discount_amount:
expression: '$line_itemsItem.total_discount '
- item_id:
template: '1332619000000289019'
- quantity:
expression: '$line_itemsItem.quantity '
- rate:
expression: '$line_itemsItem.price '
- reference_number:
template: '{{$Foreachitem.id}}'
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: flowDetails
$ref: '#/flowDetails'
- create-action:
name: Slack Send message
target:
$ref: '#/integration/action-interfaces/action-interface-3'
map:
mappings:
- OBJECT_ID:
template: D05FP3M0YGH
- OBJECT_NAME:
template: im
- text:
template: Quote is ready
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: flowDetails
$ref: '#/flowDetails'
name: Create a quote in Zoho Books for each new Shopify order and send the quote
through Slack
models: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
$integration: http://ibm.com/appconnect/integration/v2/integrationFile
integration:
type: trigger-action
trigger-interfaces:
trigger-interface-1:
type: event-trigger
triggers:
SCHEDULE:
input-context:
data: scheduler
assembly:
$ref: '#/integration/assemblies/assembly-1'
options:
subscription:
scheduleConfiguration:
interval:
unit: minute
value: 1
runOnceOncheck: false
days:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
timeZone: UTC
connector-type: streaming-connector-scheduler
action-interfaces:
action-interface-1:
type: api-action
business-object: payments
connector-type: square
actions:
RETRIEVEALL: {}
action-interface-2:
type: api-action
business-object: getExpenses_model
connector-type: zohobooks
actions:
RETRIEVEALL: {}
action-interface-3:
type: api-action
business-object: postExpense_model
connector-type: zohobooks
actions:
postExpense: {}
assemblies:
assembly-1:
assembly:
execute:
- retrieve-action:
name: Square Retrieve payments
target:
$ref: '#/integration/action-interfaces/action-interface-1'
filter:
where:
and:
- begin_time: '{{$split($Trigger.lastEventTime , "+")[0]}}'
- location_id: LS78PYWXTAFK2
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: flowDetails
$ref: '#/flowDetails'
limit: 100
allow-truncation: true
pagination-type: TOKEN
allow-empty-output: false
- for-each:
name: For each
assembly:
$ref: '#/integration/assemblies/assembly-2'
source:
expression: '$SquareRetrievepayments '
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: flowDetails
$ref: '#/flowDetails'
mode: sequential
continue-on-error: true
map:
$map: http://ibm.com/appconnect/map/v1
mappings: []
display-name: Square payments
- logging:
name: Log
map:
$map: http://ibm.com/appconnect/map/v1
mappings:
- logLevel:
template: Info
- logMessage:
template: Expenses are created
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreach
$ref: '#/node-output/For each/response/payload'
- variable: flowDetails
$ref: '#/flowDetails'
tags:
- incomplete
assembly-2:
assembly:
execute:
- retrieve-action:
name: Zoho Books List expenses
target:
$ref: '#/integration/action-interfaces/action-interface-2'
filter:
where:
reference_number: '{{$Foreachitem.id}}'
input:
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: Trigger
$ref: '#/trigger/payload'
- variable: SquareRetrievepayments
$ref: '#/node-output/Square Retrieve payments/response/payload'
- variable: SquareRetrievepaymentsMetadata
$ref: '#/node-output/Square Retrieve payments/response'
- variable: flowDetails
$ref: '#/flowDetails'
limit: 10
allow-truncation: true
pagination-type: SKIP_LIMIT
allow-empty-output: true
- if:
name: If
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: flowDetails
$ref: '#/flowDetails'
branch:
- condition:
'{{$ZohoBooksListexpensesMetadata."status-code"}}': '204'
execute:
- custom-action:
name: Zoho Books Create expense
target:
$ref: '#/integration/action-interfaces/action-interface-3'
action: postExpense
map:
mappings:
- account_id:
template: '1332619000000000570'
- amount:
expression: '$Foreachitem.amount_money.amount '
- date:
template: '{{$split($Foreachitem.updated_at , "T")[0]}}'
- description:
template: >-
{{$Foreachitem.statement_description_identifier}}
- paid_through_account_id:
template: '1332619000000015012'
- reference_number:
template: '{{$Foreachitem.id}}'
$map: http://ibm.com/appconnect/map/v1
input:
- variable: Trigger
$ref: '#/trigger/payload'
- variable: Foreachitem
$ref: '#/block/For each/current-item'
- variable: flowDetails
$ref: '#/flowDetails'
else:
execute: []
output-schema: {}
name: Create an expense in Zoho Books for each new payment in Square
models: {}
Loading
Loading