Articles in this section

Configure async helper for Amazon Inbound Shipment

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:

  1. In the Advanced section on the Create import/export (or Edit import/export) panel, check the Configure async helper checkbox.
  2. 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.
  3. Complete the following fields on the Create async helper page:
API.png

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.
API.png
    • Status path: Enter operationStatus.
    • In progress values: Enter IN_PROGRESS.
    • Done values: Enter SUCCESS and FAILED.
API.png

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.
API.png

In the What would you like to export? section on the Create import/export (or Edit import/export) panel, 

API.png
    • 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}}

Configure hooks

For configuring hooks, complete all the following settings:

  • Hook type: Choose Script.
  • Post submit
    • Function: Enter postSubmit.
    • Scripts: Enter trasferOrderCheck.
API.png

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
}
  
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.