This topic was automatically generated from Slack. You can find the original thread here.
ibrahim abou khashabh : I am trying to integrate shoebox with pipedream, I made a trigger to run the workflow in pipedream.
I get the data from shoebox api via the below code and it seems not error popup, but not sure how can I fetch the data! I have this code output = { participant: body[0] }; but it does not work, any help? const fetch=require(‘node-fetch’); const sboapi = ‘xxxxx?limit=1’; //Keep the “?limit=1”, only replace <YOUR-API-ENDPOINT-HERE> with your API Endpoint const sboapikey = ‘xxxxx’ var headers = {
‘x-api-key’: sboapikey
} const res = await fetch(sboapi, { method: ‘GET’, headers: headers}); const body = await res.json();
ibrahim abou khashabh : No error in the code, it seems the trigger is working and the node.js code works. but how can I see the data, or fetch it from the body variable?
ibrahim abou khashabh : as I can see you have hubspot integration to get the contact, can I use it to insert the contact? or I have to run Node js code with hubspot?
Dylan Sather (Pipedream) : In this case we don’t yet have an action for creating a contact, but yes, you can run any Node.js code you’d like on Pipedream, so I’d recommend choosing the option to Run Node.js code with Hubspot and modifying that API request to create a new contact according to the Hubspot API docs.
ACTIVE_HANDLEThis step was still trying to run code when the step ended. Make sure you promisify callback functions and await all Promises. (Reason: GetAddrInfoReqWrap, Learn more: https://pipedream.com/docs/workflows/steps/code/async)
Dylan Sather (Pipedream) : The request package has actually been deprecated: request - npm
It also doesn’t support Promises, which you’ll need to run the code synchronously on Pipedream (read more here: Running asynchronous code) .
axios does support Promises and all of the examples on the docs I linked to above should work for you. The main difference between request and axios is that you’ll need to pass the data in the POST body in the data property instead of the body property