{"id":15310257,"url":"https://github.com/maykonn/netdeal-node-js-sdk","last_synced_at":"2026-05-03T19:32:53.037Z","repository":{"id":57310290,"uuid":"159687061","full_name":"Maykonn/netdeal-node-js-sdk","owner":"Maykonn","description":"Backend Node.js SDK that allows you to integrate your Users with Netdeal Services - http://www.netdeal.com.br","archived":false,"fork":false,"pushed_at":"2019-03-21T13:49:37.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T04:24:11.417Z","etag":null,"topics":["documentation","integration","javascript","netdeal","netdeal-documentation","netdeal-integration","node-js","nodejs","sdk"],"latest_commit_sha":null,"homepage":"http://npmjs.com/package/netdeal-node-js-sdk","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maykonn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-29T15:26:03.000Z","updated_at":"2019-03-21T13:49:39.000Z","dependencies_parsed_at":"2022-09-05T14:00:58.150Z","dependency_job_id":null,"html_url":"https://github.com/Maykonn/netdeal-node-js-sdk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maykonn%2Fnetdeal-node-js-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maykonn%2Fnetdeal-node-js-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maykonn%2Fnetdeal-node-js-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maykonn%2Fnetdeal-node-js-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maykonn","download_url":"https://codeload.github.com/Maykonn/netdeal-node-js-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245862956,"owners_count":20684759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","integration","javascript","netdeal","netdeal-documentation","netdeal-integration","node-js","nodejs","sdk"],"created_at":"2024-10-01T08:27:13.896Z","updated_at":"2026-05-03T19:32:53.004Z","avatar_url":"https://github.com/Maykonn.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=N72BSYR3XE3LS\u0026item_name=Through+your+donation,+I+can+keep+an+active+support+and+improvements+to+this+tool.+Or+may+you+want+to+thanks+me+%3A%29\u0026currency_code=BRL\u0026source=url"],"categories":[],"sub_categories":[],"readme":"# Netdeal Node.js SDK\n\nBackend Node.js SDK that allows you to integrate your Users with [Netdeal Services](http://www.netdeal.com.br/). \nYou can use this SDK in [Serverless Architectures](https://serverless.com/) too ([AWS Lambda](https://aws.amazon.com/lambda/), [Azure Functions](https://azure.microsoft.com/en-us/services/functions/), [Google Functions](https://cloud.google.com/functions/), etc). \nThat was the main reason why javascript was chosen to write this SDK.\n\n## Installation\n\n```\nnpm i netdeal-node-js-sdk\n```\n\n## How to use\n\n### Configuration\n\nFirst, you need to import the SDK and configure the app id and secret pass - provided by Netdeal:  \n\n```JS\nconst Netdeal = require('netdeal-node-js-sdk');\n    \nNetdeal.Configuration.appId = 'app-id-value';\nNetdeal.Configuration.secretPass = 'secret-pass-value';\n```\n\nThis SDK provides an integration cache layer that saves a lot of network requests for you.\n[Learn more about the Cache Layer](https://github.com/Maykonn/netdeal-node-js-sdk#how-the-cache-layer-works): \n\n```JS\nNetdeal.Configuration.enableTheCache(\n  Netdeal.Configuration.cache.supportedMethods.REDIS, // Currently only Redis is supported \n  'my-redis-server-endpoint',\n  'my-redis-server-endpoint-port',\n)\n```\n\n### Integrating Entities\n\nThis SDK works with Entities Collections, to facilitate the integration of one or many users at the same time. \nNote that 1000 is the maximum supported amount of entities integrated with one integration call.\n  \nNote that you have two ways to populate the user data and that exists two different Entities objects (you can integrate\nyour Users and/or your Leads). [Learn more about the Netdeal Integration API](http://www.netdeal.com.br/documentation/#data-integration):\n\n```JS\n// Populating the Lead1 data\nconst Lead1 = new Netdeal.Lead();\nLead1.email = \"lead1@email.com\";\nLead1.consumerId = \"SOMETHING:asdfasdfasdf\";\nLead1.cluster = [\"politics\", \"economy\"];\n  \n// Populating the User1 data\nconst User1 = new Netdeal.Consumer();\nUser1.id = 1;\nUser1.name = \"User1\";\nUser1.email = \"user1@email.com\";\nUser1.cellphone = \"+5541987541\";\n  \n// Populating the User2 data\nconst User2 = new Netdeal.Consumer();\nUser2.properties = {\n  \"id\": 2,\n  \"name\": \"User2\",\n  \"email\": \"user1@email.com\",\n  \"identifier\": null,\n  \"cellphone\": \"4198741244\",\n  \"birthday\": null,\n  \"photo\": null,\n  \"subscriber\": true,\n  \"created_at\": \"2018-02-05T14:28:05+00:00\",\n  \"purchases\": [\n    {\n      \"id\": 1234,\n      \"consumer_id\": 2,\n      \"created_at\": \"2017-07-18T13:48:37+00:00\"\n    },\n    {\n      \"id\": 9874,\n      \"consumer_id\": 2,\n      \"created_at\": \"2017-07-19T14:42:21+00:00\"\n    }\n  ]\n};\n```\n\nOnce you have configured your entities (may you can use a loop, or a map function when integrating many users), you can populate \nthe entities collection and call the `Netdeal.integrate()` method to finalize the integration:\n\n```JS\n// The entities collections that will be integrated with Netdeal\nconst collection = Netdeal.createEntitiesCollection();\ncollection.add(Lead1);\ncollection.addMany([User1, User2]);\n  \n// Integrating entities with Netdeal\n(async () =\u003e {\n  const response = await Netdeal.integrate(collection);\n  console.log('response');\n  console.log(response);\n})();\n```\n\n## How the Cache Layer works\n\nOnce enabled the cache system creates a hash for each of your users integrated with Netdeal. \nTherefore, if you try to resent an already integrated user that don't have any changes in him attributes the SDK don't \nwill call the Netdeal Integration API, avoiding the integration request. \n  \nOnce existing a minimal changing in any user attribute the current hash don't will match the cached hash and the \n[Netdeal Integration API](http://www.netdeal.com.br/documentation/#data-integration) will be called and the hash updated for this user.\n   \nThe SDK caches the Netdeal Access Token to avoid a new request to the [Netdeal Authentication API](http://www.netdeal.com.br/documentation/#authentication) \nbefore 30 minutes. In other words, the Access Token has a TTL of 30 minutes. \n\n# Community Support\n\nIf you need help with this bundle please consider [open a question on StackOverflow](https://stackoverflow.com/questions/ask)\nusing the `netdeal` tag, it is the official support platform for this bundle.\n\nGithub Issues are dedicated to bug reports and feature requests.\n\n# Contributing\n\nYou can contribute to this project cloning this repository and in your clone, you just need to create a new branch using a \nname related to the new functionality which you'll create.  \nWhen you finish your work, you just need to create a pull request which will be revised, merged to master branch (if the code \ndoesn't break the project) and published as a new release.\n\n\u003ca href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=N72BSYR3XE3LS\u0026item_name=Through+your+donation,+I+can+keep+an+active+support+and+improvements+to+this+tool.+Or+may+you+want+to+thanks+me+%3A%29\u0026currency_code=BRL\u0026source=url\n\" target=\"_blank\"\u003e\u003cimg alt=\"Donate\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif\" /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaykonn%2Fnetdeal-node-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaykonn%2Fnetdeal-node-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaykonn%2Fnetdeal-node-js-sdk/lists"}