An export or import flow step can easily use an integrator.io async helper to communicate with asynchronous APIs. This article explains the configuration of the async helper for Amazon Inbound Shipment flows.
Configure an async helper
Follow these steps to enable and create an async helper for your flow step:
- In the Advanced section on the Create import/export (or Edit import/export) panel, check the Configure async helper checkbox.
- Click the + icon to create a new async helper. If you have already created an Async helper for this platform, you can select it from the drop-down list. Click the pencil icon to edit an existing async helper.
- Complete the following fields on the Create async helper page:
Note: This article is concerned only with the settings needed for configuration of async helper for Amazon Inbound Shipment flows. For complete field documentation, see Async helpers
Configure how to check status
Complete all the following settings:
-
Status export: Click the + icon to create a new status export. If you have already created a status export, you can select it from the drop-down list. Click the pencil icon to edit an existing status export.
In the What would you like to export? section on the Create import/export (or Edit import/export) panel,-
Relative URI: Enter
/inbound/fba/2024-03-20/operations/{{operationId}}
and click Save.
-
Relative URI: Enter
-
-
Status path: Enter
operationStatus
. -
In progress values: Enter
IN_PROGRESS
. -
Done values: Enter
SUCCESS
andFAILED
.
-
Status path: Enter
Configure how to get the results
Complete all the following settings:
- Result export: Click the + icon to create a new result export. If you have already created a result export, you can select it from the drop-down list. Click the pencil icon to edit an existing result export.
In the What would you like to export? section on the Create import/export (or Edit import/export) panel,
-
-
Relative URI: Enter the following URI and click Save.
/inbound/fba/2024-03-20/{{#compare statusRes.operationStatus '===' 'SUCCESS'}}{{#compare statusRes.operation '===' 'createInboundPlan'}}inboundPlans/{{inboundPlanId}}{{else}}operations/{{operationId}}{{/compare}}{{else}}operations/{{operationId}}{{/compare}}
-
Relative URI: Enter the following URI and click Save.
Configure hooks
For configuring hooks, complete all the following settings:
-
Hook type: Choose
Script
. -
Post submit:
-
Function: Enter
postSubmit
. -
Scripts: Enter
trasferOrderCheck
.
-
Function: Enter
Function stub
function postSubmit (options) { const finalResponse = [] if (!options || !options.responseData || !options.responseData.length) return callback(null, finalResponse) options.responseData.forEach((response) => { if (!response || !response.data || !response.data.operationProblems) { finalResponse.push(response) return } // removing operationProblems which have severity as WARNING const operationProblems = [] const errorTag = 'ERROR: ' const amazonTag = 'AMAZON ' const detailsTag = ' DETAILS: ' response.data.operationProblems.forEach((problem) => { if (problem && problem.severity && problem.severity.toUpperCase() !== 'WARNING') { if (!problem.message) problem.message = 'Operation Unsuccessful. Contact Celigo Support if the issue persists.' problem.message = (problem.message.startsWith(errorTag)) ? amazonTag + problem.message : amazonTag + errorTag + problem.message problem.message = (problem.details) ? problem.message + detailsTag + problem.details : problem.message operationProblems.push(problem) } }) if (!operationProblems.length) { finalResponse.push(response) return } finalResponse.push({ statusCode: 422, errors: operationProblems }) }) return finalResponse }
Comments
Article is closed for comments.