{"id":21406598,"url":"https://github.com/ringcentral/ringcentral-js-client","last_synced_at":"2025-07-14T00:32:37.013Z","repository":{"id":49156014,"uuid":"46536127","full_name":"ringcentral/ringcentral-js-client","owner":"ringcentral","description":"RingCentral Connect Platform JS Client","archived":false,"fork":false,"pushed_at":"2021-06-25T23:06:26.000Z","size":535,"stargazers_count":13,"open_issues_count":9,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-19T19:18:34.853Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ringcentral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-20T03:14:11.000Z","updated_at":"2024-12-13T02:15:53.000Z","dependencies_parsed_at":"2022-08-25T20:12:41.185Z","dependency_job_id":null,"html_url":"https://github.com/ringcentral/ringcentral-js-client","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ringcentral/ringcentral-js-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-js-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-js-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-js-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-js-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ringcentral","download_url":"https://codeload.github.com/ringcentral/ringcentral-js-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-js-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265227898,"owners_count":23731059,"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-22T16:40:49.134Z","updated_at":"2025-07-14T00:32:34.448Z","avatar_url":"https://github.com/ringcentral.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RingCentral Client\n\n[![Build Status](https://travis-ci.org/ringcentral/ringcentral-js-client.svg?branch=master)](https://travis-ci.org/ringcentral/ringcentral-js-client)\n[![Coverage Status](https://coveralls.io/repos/github/ringcentral/ringcentral-js-client/badge.svg?branch=master)](https://coveralls.io/github/ringcentral/ringcentral-js-client?branch=master)\n[![Community](https://img.shields.io/badge/dynamic/json.svg?label=community\u0026colorB=\u0026suffix=%20users\u0026query=$.approximate_people_count\u0026uri=http%3A%2F%2Fapi.getsatisfaction.com%2Fcompanies%2F102909.json)](https://devcommunity.ringcentral.com/ringcentraldev)\n[![Twitter](https://img.shields.io/twitter/follow/ringcentraldevs.svg?style=social\u0026label=follow)](https://twitter.com/RingCentralDevs)\n\n__[RingCentral Developers](https://developer.ringcentral.com/api-products)__ is a cloud communications platform which can be accessed via more than 70 APIs. The platform's main capabilities include technologies that enable:\n__[Voice](https://developer.ringcentral.com/api-products/voice), [SMS/MMS](https://developer.ringcentral.com/api-products/sms), [Fax](https://developer.ringcentral.com/api-products/fax), [Glip Team Messaging](https://developer.ringcentral.com/api-products/team-messaging), [Data and Configurations](https://developer.ringcentral.com/api-products/configuration)__.\n\n[API Reference](https://developer.ringcentral.com/api-docs/latest/index.html) and [APIs Explorer](https://developer.ringcentral.com/api-explorer/latest/index.html).\n\n## Overview\n\nThis is a library implemented in TypeScript which provides convenient APIs for TypeScript and JavaScript developers to access RingCentral webservice(https://developer.ringcentral.com/api-docs/latest/index.html).\n\n# Table of contents\n\n- [Getting Started](#getting-started)\n- [API Call Examples](#api-call-examples)\n    - [Telephony Calls](#telephony-calls)\n    - [Send SMS](#send-sms)\n    - [Send Fax](#send-fax)\n    - [Extension management](#extension-management)\n\n\n## Getting started\n\n### Install\n\n```shell\nnpm install ringcentral-client --save\nnpm install @ringcentral/sdk     # Install the peerDependency\n\nyarn add ringcentral-client @ringcentral/sdk\n```\n\n### Import the module\n\n#### In Typescript or ES6 (Recommended)\n```typescript\nimport RingCentralClient, {SERVER_SANDBOX} from \"ringcentral-client\";\nimport { SDK } from \"@ringcentral/sdk\";\n```\n\n#### In commonjs(node.js, webpack and browserify)\n```javascript\nvar ringcentral = require(\"ringcentral-client\");\nvar RingCentralClient = ringcentral.Client;\nvar SERVER_SANDBOX = ringcentral.SERVER_SANDBOX;\nvar SDK = require(\"@ringcentral/sdk\").SDK;\n```\n\n#### Used in browser through the prebuilt javascript bundle\nAll APIs are exposed on the global variable `RingCentral`.\n```html\n\u003cscript type=\"text/javascript\" src=\"node_modules/ringcentral-client/build/ringcentral-client.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    console.log(\"All api\", RingCentral);\n    var RingCentralClient = RingCentral.Client;\n    var SERVER_SANDBOX = RingCentral.SERVER_SANDBOX;\n    var SDK = RingCentral.SDK;\n    // ...\n\u003c/script\u003e\n```\n\n### Quick Start\n\nLogin, logout, get account info.\n\n```typescript\nconst sdk = new SDK({\n\tserver: SERVER_PRODUCTION, // Optional, default is production server\n\tclientId: process.env.CLIENT_ID,\n\tclientSecret: process.env.CLIENT_SECRET\n});\nconst client = new RingCentralClient(sdk);\n\n\n// Log into RingCentral\nsdk.platform().login({\n\t\"username\": process.env.USERNAME,\n\t\"extension\": process.env.EXTENSION,\n\t\"password\": process.env.PASSWORD\n}).then(() =\u003e {\n\tconsole.log(\"Login success\");\n\treturn client.account().get(); // Call RingCentral REST API\n}).then((accountInfo) =\u003e {\n\tconsole.log(\"Current account info\", accountInfo);\n\treturn sdk.platform().logout();\t// Logout\n}).then(() =\u003e {\n\tconsole.log(\"logout success\");\n}).catch(e =\u003e {\n\tconsole.error(\"Error occured\", e);\n});\n```\n\n## API Call Examples\n\n### Telephony Calls\n\n1. Make phone calls by ringout(https://developer.ringcentral.com/api-docs/latest/index.html#!#MakeRingOut.html):\n\n    ```javascript\n    client.account().extension().ringout().post({\n        from: { phoneNumber: \"xxx\" },\n        to: { phoneNumber: \"xxx\" },\n        callerId: { phoneNumber: \"xxx\" }\n    }).then(ringout =\u003e {\n        console.log(\"Ringout sucess\", ringout);\n        // To check the call status: `client.account().extension().ringout(ringout.id).get();`\n    }, e =\u003e {\n        console.error(\"Fail to ringout\", e);\n    });\n    ```\n\n2. Track the telephony status\n\n    To get notications when calls come in, go out or ends, subscribe to the **Presence Event**:\n    ```javascript\n    let subscription = client.createSubscription();\n\n    subscription.on(subscription.events.notification, function (msg) {\n        let presenceEvt = msg.body; // Detail for presence event: https://developer.ringcentral.com/api-docs/latest/index.html?section=RefNotifications.html#!#RefGetDetailedPresenceEvent\n        console.log(\"@@@@presence event\", presenceEvt);\n        console.log(\"telephonyStatus\", presenceEvt.telephonyStatus);\n        console.log(\"activeCalls\", presenceEvt.activeCalls);\n    });\n\n    subscription\n        .setEventFilters(['/account/~/extension/~/presence?detailedTelephonyState=true ']) // a list of server-side events\n        .register()\n        .then((subscription) =\u003e {\n            console.log(\"Subscription created\", subscription.json());\n        }, e =\u003e {\n            console.error(\"Fail to create subscription\", e);\n        });\n    ```\n\n3. View the list of active calls\n    ```javascript\n    client.account().extension().activeCalls().list({\n        page: 1,    // Get the 1st page of the result\n        direction: \"Inbound\"    // Specify the direction of the call, omit to get all directions\n    }).then(results =\u003e {\n        console.log(\"Active calls\", results.records);\n    }, e =\u003e {\n        console.error(\"Fail to get active calls\", e);\n    });\n    ```\n\n4. View the recent calls\n\n    ```typescript\n    let dateFrom = new Date(Date.now() - 24 * 60 * 60 * 1000);  // A day ago\n    client.account().extension().callLog().list({ dateFrom: dateFrom.toISOString() }).then(results =\u003e {\n        console.log(\"Recent call logs\", results.records);\n    }, e =\u003e {\n        console.error(\"Fail to get call logs\", e);\n    });\n    ```\n\n### Send SMS\n```typescript\nclient.account().extension().sms().post({\n\tto: [{\n\t\tphoneNumber: \"{receiverPhoneNumber}\"\n\t}],\n\tfrom: {\n\t\tphoneNumber: \"{yourSmsNumber}\"\n\t},\n\ttext: \"Sms content\"\n}).then(function(messageInfo) {\n\tconsole.log(\"Sms sent successfully\", messageInfo);\n}).catch(function(e) {\n\tconsole.error(\"Fail to send sms\", e);\n});\n```\n\n### Send Fax\n\nFor all supported options and mediatype, please refer to https://developer.ringcentral.com/api-docs/latest/index.html#!#RefFaxMessages.html.\n\n```typescript\nimport * as fs from \"fs\";\nclient.account().extension().fax().post({\n            to: [{ phoneNumber: \"{receiverPhoneNumber}\" }],\n            faxResolution: 'High'\n        }, [    // Second argument is an array of attachments, attachment can be string, Blob, node readable stream.\n                \"{Message text}\",\n                fs.createReadStream(\"{filePath}\")   // In node only\n            ]);\n    });\n```\n\n### Extension management\n\nGet detail information of an extension:\n\n```typescript\nclient.account().extension('theExtensionId').get().then(function (extInfo) {\n    console.log(\"The extension info\", extInfo);\n}).catch(function (e) {\n    console.error(\"Get extension error\", e);\n});\n```\n\nList extensions of an account:\n\n```typescript\nclient.account(\"theAccountId\").extension().list().then(function (extensions) {\n    console.log(\"The list of extension info\", extensions.records);\n}).catch(function (e) {\n    console.error(\"Get extension list error\", e);\n});\n```\n\nUpdate infomation of an extension:\n\n```typescript\nclient.account().extension().put({ status: \"Enabled\" }).then(function () {\n    console.log(\"Success to update extension.\");\n}).catch(function () {\n    console.error(\"Fail to update extension.\");\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-js-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fringcentral%2Fringcentral-js-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-js-client/lists"}