Advertisement
Guest User

Untitled

a guest
May 19th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import RingCentral, { SERVER_SANDBOX } from ‘ringcentral-ts’;
  2. let rc = new RingCentral({
  3.  server: SERVER_SANDBOX, // You should use SERVER_PRODUCTION in production
  4.  appKey: ‘{yourAppKey}’,
  5.  appSecret: ‘{yourAppSecret}’
  6. });
  7. // Log into RingCentral
  8. rc.auth({
  9.  username: ‘{username}’,
  10.  extension: ‘{extension}’,
  11.  password: ‘{password}’
  12. }).then(() => {
  13.  console.log(‘login success’);
  14.  return rc.account().get(); // Call RingCentral REST API
  15. }).then(accountInfo => {
  16.  console.log(“Current account info”, accountInfo);
  17.  return rc.logout(); // Logout
  18. }).then(() => {
  19.  console.log(“logout success”);
  20. }).catch(e => {
  21.  console.error(‘Error occured’, e);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement