Skip to main content

Hi, 

im stuck.

I'm trying to integrate Nova Engel's dropshipping system with my Shopify store using Zapier. The goal is to fetch an authentication token from Nova Engel's API and use it to send order details from Shopify to Nova Engel.

Issue: I'm getting an error in the coding step (Step 2) while trying to extract the token from the login response. The error message is: "Empty response from login request. Check the API endpoint, payload, and headers."

Steps I've Taken:

  1. Created a Zap with a Shopify trigger for new orders.
  2. Added a Webhooks by Zapier action to send a POST request to Nova Engel's login API to get a token.
  3. Configured the Webhooks action with the correct URL, headers, and payload.
  4. Added a Code by Zapier step to extract the token from the response.

Problem: The error indicates that the response variable is empty, meaning the login request might not be returning any data or it's not correctly passed from the previous step. I’ve verified the API endpoint, payload, and headers, but I’m still stuck.

Can anyone help me identify what might be going wrong or provide guidance on how to correctly configure this integration?

Thanks in advance!

 

This is js Code:
const response = inputData.response; // Log the entire response for debugging console.log("Response from login request:", response); if (!response) { throw new Error("Empty response from login request. Check the API endpoint, payload, and headers."); } let token; try { const jsonResponse = JSON.parse(response); token = jsonResponse.Token; } catch (error) { throw new Error("Failed to parse JSON response: " + response); } if (token) { return { token: token }; } else { throw new Error("Token not found in response: " + response); }

Hi @xdasjo 

Change the Input Data key to just: response