{"id":20455454,"url":"https://github.com/bitloops/node-bitloops","last_synced_at":"2025-04-13T03:40:31.019Z","repository":{"id":41850611,"uuid":"416037193","full_name":"bitloops/node-bitloops","owner":"bitloops","description":"NodeJS library for the Bitloops","archived":false,"fork":false,"pushed_at":"2022-04-26T15:06:22.000Z","size":195,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T20:51:22.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitloops.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":"2021-10-11T18:10:33.000Z","updated_at":"2022-04-06T08:06:13.000Z","dependencies_parsed_at":"2022-08-11T19:20:56.362Z","dependency_job_id":null,"html_url":"https://github.com/bitloops/node-bitloops","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitloops%2Fnode-bitloops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitloops%2Fnode-bitloops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitloops%2Fnode-bitloops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitloops%2Fnode-bitloops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitloops","download_url":"https://codeload.github.com/bitloops/node-bitloops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248660582,"owners_count":21141321,"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":[],"created_at":"2024-11-15T11:18:57.535Z","updated_at":"2025-04-13T03:40:30.936Z","avatar_url":"https://github.com/bitloops.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Bitloops](https://bitloops.com/assets/img/bitloops-logo_320x80.png)\n\n# bitloops\n\nNodeJS library for the Bitloops\n\n## Usage\n\n### Installing\n\nUsing npm:\n\n```bash\n$ npm install bitloops\n```\n\nUsing yarn:\n\n```bash\n$ yarn add bitloops\n```\n\n### TypeScript Frontend usage Example\n\n```ts\nimport Bitloops, { AuthTypes, BitloopsUser, getAuth } from 'bitloops';\n\n// You will get this from your Console in your Workflow information\nconst bitloopsConfig = {\n\tapiKey: \"kgyst344ktst43kyygk4tkt4s\",\n\tserver: \"bitloops.net\",\n\tenvironmentId: \"3c42a5ef-fe21-4b50-8128-8596ea47da93\",\n\tworkspaceId: \"4f7a0fc5-fe2f-450a-b246-11a0873e91f0\",\n\tmessagingSenderId: \"742387243782\",\n  auth: {\n    authenticationType: AuthTypes.User,\n    providerId: 'myProviderId', // You create this in the Bitloops Console\n    clientId: 'myWebAppId', // You create this in the Bitloops Console\n  }\n}\n\nconst bitloops = Bitloops.initialize(bitloopsConfig);\n\nbitloops.auth.authenticateWithUsername('username', 'email', 'password');\nbitloops.auth.authenticateWithEmail('email', 'password');\nbitloops.auth.authenticateWithEmailLink('email');\nbitloops.auth.authenticateWithEmailLinkVerification('link');\nbitloops.auth.forgotPassword('email', 'username');\nbitloops.auth.forgotPassword('email');\nbitloops.auth.forgotPasswordLink('link');\nbitloops.auth.forgotPasswordLink('link', 'new-password');\n\nbitloops.auth.authenticateWithGoogle();\nbitloops.auth.registerWithGoogle();\nbitloops.auth.addGoogle();\nbitloops.auth.authenticateWithGitHub();\nbitloops.auth.registerWithGitHub();\nbitloops.auth.addGitHub();\nbitloops.auth.authenticateWithTwitter();\nbitloops.auth.registerWithTwitter();\nbitloops.auth.addTwitter();\nbitloops.auth.sendVerificationCode(phone);\nbitloops.auth.verifyPhoneCode(phone, code);\n\nbitloops.auth.getUser();\nbitloops.auth.clear();\n\nbitloops.auth.onAuthStateChanged((user: BitloopsUser) =\u003e {\n  if (user) {\n    // Do stuff when authenticated\n  } else {\n    // Do stuff if authentication is cleared\n  }\n});\n\n...\n\nconst userInfo = await bitloops.request('db7a654a-1e2c-4f9c-b2d0-8ff2e2d6cbfe', '70e3084f-9056-4905-ac45-a5b65c926b1b');\nconst productInfo = await bitloops.request('64f264ad-76b1-4ba1-975c-c7b9795e55ce', '70e3084f-9056-4905-ac45-a5b65c926b1b', { productId: '7829' });\nbitloops.publish('page-visited-event', { page: 'landing-page'});\n```\n\n\u003e _PRO TIP_: The second argument passed in the _product.getProductInfo_ request and in the p*age-visited-event* publish message containing the data of the request/publish message is using a shortcut notation which you can use if the only arguments other than the _requestId_ or the _messageId_ are the payload parameters. The full form is the following:\n\n```ts\nbitloops.publish('page-visited-event', { payload: { page: 'landing-page' } });\n```\n\n\u003e The above is equivalent to:\n\n```ts\nbitloops.p('page-visited-event', { page: 'landing-page' });\n```\n\nThis means that if you need to pass more settings to the request / publish message then you need to explicitly define the _payload_ argument.\n\n### Testing Example\n\nTo ask your workflows to return mocked values based on your test scenarios you can pass the _testScenarioId_ along with your request.\n\n```ts\nconst productInfo = await bitloops.request('product.getProductInfo', {\n  payload: { productId: '7829' },\n  testScenarioId: 'Test-Scenario-1',\n});\n```\n\n### Subscriptions\n\n```ts\nconst callback = (data: any) =\u003e {\n  console.log('Received', data);\n};\nbitloops.subscribe('ride-requested', callback);\n```\n\n## Questions?\n\nPlease post your questions on [Stack Overflow](https://stackoverflow.com) making sure you use the **Bitloops** tag and someone from the Bitloops team or the community will make sure to help you.\n\nAlternatively feel free to [submit an Issue on GitHub](https://github.com/bitloops/node-bitloops/issues/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitloops%2Fnode-bitloops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitloops%2Fnode-bitloops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitloops%2Fnode-bitloops/lists"}