Skip to main content

Hi community :)

I have an issue building a trigger for my app. Maybe someone could help me.

I am calling this endpoint: 

https://api.conexteo.com/users/credits

the answer is with this format: 

p
  {
    "label": "<string>",
    "credits": "<number>",
    "price": "<number>",
    "msgType": "<number>"
  }

 

When I am building my trigger, I want to get the number of credits.

Here is the code sent in zapier:

const options = {
  url: 'https://api.conexteo.com/users/credits',
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'X-X-API-KEY': bundle.authData.X-API-KEY,
    'X-X-APP-ID': bundle.authData.X-APP-ID
  },
  params: {
    'X-API-KEY': bundle.authData.X-API-KEY,
    'X-APP-ID': bundle.authData.X-APP-ID
  }
}

return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

 

But when I test, I have this answer:

Invalid API Response: - Got a result missing the "id" property ({"label":"SMS Premium","credits":48761,"price":2048.266,"msgType":1}) What happened (You are seeing this because you are an admin): Executing triggers.checkCredit.operation.perform with bundle Invalid API Response: - Got a result missing the "id" property ({"label":"SMS Premium","credits":48761,"price":2048.266,"msgType":1}) Console logs: Stack trace: CheckError: Invalid API Response: - Got a result missing the "id" property ({"label":"SMS Premium","credits":48761,"price":2048.266,"msgType":1}) at checkOutput (/var/task/node_modules/zapier-platform-core/src/app-middlewares/after/checks.js:42:15) at Object.<anonymous> (/var/task/node_modules/zapier-platform-core/src/middleware.js:80:37) at bound (node:domain:433:15) at Object.runBound (node:domain:444:12) at Object.tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/var/task/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/var/task/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromiseCtx (/var/task/node_modules/bluebird/js/release/promise.js:641:10) at _drainQueueStep (/var/task/node_modules/bluebird/js/release/async.js:97:12) at _drainQueue (/var/task/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/var/task/node_modules/bluebird/js/release/async.js:102:5) at Async.drainQueues aas _onImmediate] (/var/task/node_modules/bluebird/js/release/async.js:15:14) at process.processImmediate (node:internal/timers:476:21) at process.topLevelDomainCallback (node:domain:161:15) at process.callbackTrampoline (node:internal/async_hooks:128:24)

 

Could someone help me here, please?

 

Thanks in advance,

Hi @danconexteo 

Seems like you may want to post the topic in the Developer Zone.

https://community.zapier.com/general-discussion-13