Skip to content

Instantly share code, notes, and snippets.

@karn09
Last active March 29, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karn09/ede6591dc2f6c6fb46939be17235692a to your computer and use it in GitHub Desktop.
Save karn09/ede6591dc2f6c6fb46939be17235692a to your computer and use it in GitHub Desktop.
{
"description": "",
"name": "shopify-process-v3",
"steps": [
{
"params": {
"phone": "/#steps.1.attributes.data.customer.phone",
"id": "/#steps.Sy_Dgk0qx.customer",
"custom": {
"totalSpentNum": "/#fn:parseFloat,steps.1.attributes.data.customer.total_spent",
"lastOrderIdNum": "/#steps.1.attributes.data.customer.last_order_id",
"lastOrderNameStr": "/#steps.1.attributes.data.customer.last_order_name",
"acceptsMarketingBool": "/#steps.1.attributes.data.customer.accepts_marketing",
"ordersCountNum": "/#steps.1.attributes.data.customer.orders_count"
}
},
"action": "kustomer.customer.update",
"id": "ByFFphfhx",
"transitions": [
{
"condition": {
"values": [
true
],
"op": "true"
},
"target": "SkyvZyAcl"
}
]
},
{
"action": "kustomer.conversation.find-before-date",
"id": "SkyvZyAcl",
"params": {
"date": "/#steps.1.attributes.data.updated_at",
"customerEmail": "/#steps.1.attributes.data.contact_email",
"customerId": "/#steps.Sy_Dgk0qx.customer"
},
"transitions": [
{
"meta": {
"name": "conv found"
},
"target": "HJqOSJR9x",
"condition": {
"op": "exists",
"values": [
"/#steps.SkyvZyAcl.id"
]
}
},
{
"meta": {
"name": "no conv found"
},
"condition": {
"values": [
"/#steps.SkyvZyAcl.id",
""
],
"op": "dne"
},
"target": "B1_CL3fng"
}
]
},
{
"params": {
"testString": "{{{dateDiff 'hours' from=steps.SkyvZyAcl.createdAt to=steps.1.attributes.data.updated_at}}}",
"regex": "^(.*)$"
},
"action": "kustomer.regex-match.generic",
"id": "HJqOSJR9x",
"transitions": [
{
"condition": {
"values": [
true
],
"op": "true"
},
"target": "HyCmGJ05g"
}
]
},
{
"id": "HyCmGJ05g",
"action": "kustomer.kobject.update",
"params": {
"createdAt": "/#steps.1.attributes.data.updated_at",
"klassName": "shopify-order",
"id": "/#steps.Sy_Dgk0qx.id",
"title": "/#steps.Sy_Dgk0qx.title",
"icon": "{{#if steps.1.attributes.data.fulfillment_status}}truck-delivery{{else}}tshirt-crew{{/if}}",
"images": [],
"data": "/#steps.1.attributes.data",
"custom": {
"cancelledAt": "/#steps.1.attributes.data.cancelled_at",
"lastConversationAt": "/#steps.SkyvZyAcl.createdAt",
"conversationRel": "/#steps.SkyvZyAcl.id",
"orderNumberNum": "/#fn:parseFloat,steps.1.attributes.data.order_number",
"orderCreatedAt": "/#steps.1.attributes.data.created_at",
"orderStatusStr": "/#steps.1.attributes.data.fulfillment_status",
"billingStatusStr": "/#steps.1.attributes.data.financial_status",
"shippingAddressStr": "{{steps.1.attributes.data.shipping_address.address1}} {{steps.1.attributes.data.shipping_address.address2}}, {{steps.1.attributes.data.shipping_address.city}}, {{steps.1.attributes.data.shipping_address.province_code}} {{steps.1.attributes.data.shipping_address.zip}}",
"trackingNumberStr": "/#steps.1.attributes.data.fulfillments.0.tracking_number",
"specialInstructionsStr": "{{#if steps.1.attributes.data.note}}{{steps.1.attributes.data.note}}{{else}}none{{/if}}",
"totalPriceNum": "/#fn:parseFloat,steps.1.attributes.data.total_price",
"orderUpdatedAt": "/#steps.1.attributes.data.updated_at",
"hoursSinceConversationNum": "/#fn:parseFloat,steps.HJqOSJR9x.captures.0"
}
},
"transitions": []
},
{
"params": {
"email": "/#steps.1.attributes.data.contact_email",
"identifier": "/#steps.1.attributes.data.contact_email"
},
"action": "kustomer.customer.find-by-email",
"id": "rJb0uJR5e",
"transitions": [
{
"meta": {
"name": "customer found"
},
"condition": {
"values": [
"/#steps.rJb0uJR5e.id",
""
],
"op": "exists"
},
"target": "ByY3ahz3l"
},
{
"meta": {
"name": "no customer found"
},
"condition": {
"values": [
"/#steps.rJb0uJR5e.id",
""
],
"op": "dne"
},
"target": "rJHeFkAcx"
}
]
},
{
"params": {
"phone": "/#steps.1.attributes.data.customer.phone",
"id": "/#steps.rJb0uJR5e.id",
"custom": {
"totalSpentNum": "/#fn:parseFloat,steps.1.attributes.data.customer.total_spent",
"lastOrderIdNum": "/#steps.1.attributes.data.customer.last_order_id",
"lastOrderNameStr": "/#steps.1.attributes.data.customer.last_order_name",
"acceptsMarketingBool": "/#steps.1.attributes.data.customer.accepts_marketing",
"ordersCountNum": "/#steps.1.attributes.data.customer.orders_count"
}
},
"action": "kustomer.customer.update",
"id": "ByY3ahz3l",
"transitions": [
{
"condition": {
"values": [
true
],
"op": "true"
},
"target": "r1mxY1Ace"
}
]
},
{
"params": {
"customerId": "/#steps.rJb0uJR5e.id",
"customerEmail": "/#steps.1.attributes.data.contact_email",
"date": "/#steps.1.attributes.data.created_at"
},
"action": "kustomer.conversation.find-before-date",
"id": "r1mxY1Ace",
"transitions": [
{
"condition": {
"values": [
"/#steps.r1mxY1Ace.id"
],
"op": "exists"
},
"target": "r1BmtJR9e",
"meta": {
"name": "conversation found"
}
},
{
"target": "ByUZi1C5e",
"condition": {
"op": "dne",
"values": [
"/#steps.r1mxY1Ace.id",
""
]
},
"meta": {
"name": "no conversation found"
}
}
]
},
{
"params": {
"testString": "{{{dateDiff 'hours' from=steps.r1mxY1Ace.createdAt to=steps.1.attributes.data.created_at}}}",
"regex": "^(.*)$"
},
"action": "kustomer.regex-match.generic",
"id": "r1BmtJR9e",
"transitions": [
{
"condition": {
"values": [
true
],
"op": "true"
},
"target": "BkNPt109g"
}
]
},
{
"params": {
"createdAt": "/#steps.1.attributes.data.updated_at",
"externalId": "/#steps.1.attributes.data.order_number",
"images": [],
"icon": "{{#if steps.1.attributes.data.fulfillment_status}}truck-delivery{{else}}tshirt-crew{{/if}}",
"title": "Order #{{steps.1.attributes.data.order_number}} ({{steps.1.attributes.data.line_items.length}} items ordered for ${{steps.1.attributes.data.total_price}})",
"klassName": "shopify-order",
"customer": "/#steps.rJb0uJR5e.id",
"custom": {
"hoursSinceConversationNum": "/#fn:parseFloat,steps.r1BmtJR9e.captures.0",
"orderUpdatedAt": "/#steps.1.attributes.data.updated_at",
"totalPriceNum": "/#fn:parseFloat,steps.1.attributes.data.total_price",
"specialInstructionsStr": "{{#if steps.1.attributes.data.note}}{{steps.1.attributes.data.note}}{{else}}none{{/if}}",
"trackingNumberStr": "/#steps.1.attributes.data.fulfillments.0.tracking_number",
"shippingAddressStr": "{{steps.1.attributes.data.shipping_address.address1}} {{steps.1.attributes.data.shipping_address.address2}}, {{steps.1.attributes.data.shipping_address.city}}, {{steps.1.attributes.data.shipping_address.province_code}} {{steps.1.attributes.data.shipping_address.zip}}",
"orderStatusStr": "/#steps.1.attributes.data.fulfillment_status",
"billingStatusStr": "/#steps.1.attributes.data.financial_status",
"orderCreatedAt": "/#steps.1.attributes.data.created_at",
"orderNumberNum": "/#fn:parseFloat,steps.1.attributes.data.order_number",
"conversationRel": "/#steps.r1mxY1Ace.id",
"lastConversationAt": "/#steps.r1mxY1Ace.createdAt",
"cancelledAt": "/#steps.1.attributes.data.cancelled_at"
},
"data": "/#steps.1.attributes.data"
},
"action": "kustomer.kobject.create-with-customer",
"id": "BkNPt109g",
"transitions": []
},
{
"id": "ByUZi1C5e",
"action": "kustomer.kobject.create-with-customer",
"params": {
"createdAt": "/#steps.1.attributes.data.created_at",
"data": "/#steps.1.attributes.data",
"custom": {
"orderNumberNum": "/#fn:parseFloat,steps.1.attributes.data.order_number",
"orderCreatedAt": "/#steps.1.attributes.data.created_at",
"orderStatusStr": "/#steps.1.attributes.data.fulfillment_status",
"billingStatusStr": "/#steps.1.attributes.data.financial_status",
"shippingAddressStr": "{{steps.1.attributes.data.shipping_address.address1}} {{steps.1.attributes.data.shipping_address.address2}}, {{steps.1.attributes.data.shipping_address.city}}, {{steps.1.attributes.data.shipping_address.province_code}} {{steps.1.attributes.data.shipping_address.zip}}",
"trackingNumberStr": "/#steps.1.attributes.data.fulfillments.0.tracking_number",
"specialInstructionsStr": "{{#if steps.1.attributes.data.note}}{{steps.1.attributes.data.note}}{{else}}none{{/if}}",
"totalPriceNum": "/#fn:parseFloat,steps.1.attributes.data.total_price",
"orderUpdatedAt": "/#steps.1.attributes.data.updated_at",
"cancelledAt": "/#steps.1.attributes.data.cancelled_at"
},
"klassName": "shopify-order",
"customer": "/#steps.rJb0uJR5e.id",
"title": "Order #{{steps.1.attributes.data.order_number}} ({{steps.1.attributes.data.line_items.length}} items ordered for ${{steps.1.attributes.data.total_price}})",
"icon": "{{#if steps.1.attributes.data.fulfillment_status}}truck-delivery{{else}}tshirt-crew{{/if}}",
"externalId": "/#steps.1.attributes.data.order_number"
},
"transitions": []
},
{
"params": {
"phone": "/#steps.1.attributes.data.customer.phone",
"custom": {
"acceptsMarketingBool": "/#steps.1.attributes.data.customer.accepts_marketing",
"lastOrderNameStr": "/#steps.1.attributes.data.customer.last_order_name",
"lastOrderIdNum": "/#steps.1.attributes.data.customer.last_order_id",
"totalSpentNum": "/#fn:parseFloat,steps.1.attributes.data.customer.total_spent",
"ordersCountNum": "/#steps.1.attributes.data.customer.orders_count"
},
"name": "{{steps.1.attributes.data.customer.first_name}} {{steps.1.attributes.data.customer.last_name}}",
"email": "/#steps.1.attributes.data.contact_email"
},
"action": "kustomer.customer.create",
"id": "rJHeFkAcx",
"transitions": [
{
"meta": {
"name": "customer create success"
},
"condition": {
"values": [
"/#steps.rJHeFkAcx.id",
""
],
"op": "exists"
},
"target": "SJH83kRcg"
}
]
},
{
"params": {
"createdAt": "/#steps.1.attributes.data.created_at",
"externalId": "/#steps.1.attributes.data.order_number",
"icon": "{{#if steps.1.attributes.data.fulfillment_status}}truck-delivery{{else}}tshirt-crew{{/if}}",
"title": "Order #{{steps.1.attributes.data.order_number}} ({{steps.1.attributes.data.line_items.length}} items ordered for ${{steps.1.attributes.data.total_price}})",
"customer": "/#steps.rJHeFkAcx.id",
"custom": {
"orderUpdatedAt": "/#steps.1.attributes.data.updated_at",
"totalPriceNum": "/#fn:parseFloat,steps.1.attributes.data.total_price",
"specialInstructionsStr": "{{#if steps.1.attributes.data.note}}{{steps.1.attributes.data.note}}{{else}}none{{/if}}",
"trackingNumberStr": "/#steps.1.attributes.data.fulfillments.0.tracking_number",
"shippingAddressStr": "{{steps.1.attributes.data.shipping_address.address1}} {{steps.1.attributes.data.shipping_address.address2}}, {{steps.1.attributes.data.shipping_address.city}}, {{steps.1.attributes.data.shipping_address.province_code}} {{steps.1.attributes.data.shipping_address.zip}}",
"orderStatusStr": "/#steps.1.attributes.data.fulfillment_status",
"billingStatusStr": "/#steps.1.attributes.data.financial_status",
"orderCreatedAt": "/#steps.1.attributes.data.created_at",
"orderNumberNum": "/#fn:parseFloat,steps.1.attributes.data.order_number",
"cancelledAt": "/#steps.1.attributes.data.cancelled_at"
},
"data": "/#steps.1.attributes.data",
"klassName": "shopify-order"
},
"action": "kustomer.kobject.create-with-customer",
"id": "SJH83kRcg",
"transitions": []
},
{
"params": {
"icon": "{{#if steps.1.attributes.data.fulfillment_status}}truck-delivery{{else}}tshirt-crew{{/if}}",
"createdAt": "/#steps.1.attributes.data.updated_at",
"title": "/#steps.Sy_Dgk0qx.title",
"id": "/#steps.Sy_Dgk0qx.id",
"klassName": "shopify-order",
"data": "/#steps.1.attributes.data",
"custom": {
"orderNumberNum": "/#fn:parseFloat,steps.1.attributes.data.order_number",
"orderCreatedAt": "/#steps.1.attributes.data.created_at",
"orderStatusStr": "/#steps.1.attributes.data.fulfillment_status",
"billingStatusStr": "/#steps.1.attributes.data.financial_status",
"shippingAddressStr": "{{steps.1.attributes.data.shipping_address.address1}} {{steps.1.attributes.data.shipping_address.address2}}, {{steps.1.attributes.data.shipping_address.city}}, {{steps.1.attributes.data.shipping_address.province_code}} {{steps.1.attributes.data.shipping_address.zip}}",
"trackingNumberStr": "/#steps.1.attributes.data.fulfillments.0.tracking_number",
"specialInstructionsStr": "{{#if steps.1.attributes.data.note}}{{steps.1.attributes.data.note}}{{else}}none{{/if}}",
"totalPriceNum": "/#fn:parseFloat,steps.1.attributes.data.total_price",
"orderUpdatedAt": "/#steps.1.attributes.data.updated_at",
"cancelledAt": "/#steps.1.attributes.data.cancelled_at"
}
},
"action": "kustomer.kobject.update",
"id": "B1_CL3fng",
"transitions": []
},
{
"params": {
"externalId": "/#steps.1.attributes.data.order_number",
"klassName": "shopify-order"
},
"action": "kustomer.kobject.find-by-external-id",
"id": "Sy_Dgk0qx",
"transitions": [
{
"meta": {
"name": "existing order found"
},
"condition": {
"values": [
"/#steps.Sy_Dgk0qx.id",
""
],
"op": "exists"
},
"target": "ByFFphfhx"
},
{
"meta": {
"name": "no order found"
},
"condition": {
"values": [
"/#steps.Sy_Dgk0qx.id",
""
],
"op": "dne"
},
"target": "rJb0uJR5e"
}
]
}
],
"trigger": {
"transitions": [
{
"meta": {
"name": "don't continue if no email available"
},
"condition": {
"values": [
"/#steps.1.attributes.data.contact_email",
""
],
"op": "exists"
},
"target": "Sy_Dgk0qx"
}
],
"eventName": "kustomer.app.shopify.order-update",
"id": "1",
"appVersion": "shopify-^0.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment