Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

kr870/ringcentral-python

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

134 Commits
134 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RingCentral SDK for Python

Build Status Coverage Status Twitter

RingCentral Developers is a cloud communications platform which can be accessed via more than 70 APIs. The platform's main capabilities include technologies that enable: Voice, SMS/MMS, Fax, Glip Team Messaging, Data and Configurations.

API Reference and APIs Explorer.

Installation

This SDK is tested against Python 3.7 so we recommend installing using it with Python 3.7 or newer

Manual

$ git clone https://github.com/ringcentral/python-sdk.git ./ringcentral-python-sdk

Install dependencies:

PIP

$ pip3 install ringcentral

Setup

Rename credentials-sample.ini to credentials.ini.

Edit credentials.ini and update appropriate parameters. CLIENT_ID is synonymous with APP_KEY. CLIENT_SECRET is synonymous with APP_SECRET. In this repository, the latter convention is used that of APP_KEY and APP_SECRET.

Usage

Take a look at a sample code.

from ringcentral import SDK

sdk = SDK('CLIENT_ID', 'CLIENT_SECRET', 'SERVER')
platform = sdk.platform()
platform.login('USERNAME', 'EXTENSION', 'PASSWORD')

res = platform.get('/account/~/extension/~')
print('User loaded ' + res.json().name)

Subscribing for server events

from threading import Thread
from time import sleep
from ringcentral.subscription import Events

def on_message(msg):
    print(msg)

def pubnub():
    s = sdk.create_subscription()
    s.add_events(['/account/~/extension/~/message-store'])
    s.on(Events.notification, on_message)
    s.register()
    while True:
        sleep(0.1)

try:
    try:
        import Pubnub
        t = Thread(target=pubnub)
        t.start()
    except ImportError as e:
        print("No Pubnub SDK, skipping Pubnub test")

except KeyboardInterrupt:
    pass

Send sms

from ringcentral import SDK

database = []
database.append({"Customer":"Tyler","Payment":"Due","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Chen","Payment":"Paid","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Anne","Payment":"Paid","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Brown","Payment":"Due","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Peter","Payment":"Due","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"White","Payment":"Paid","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Lisa","Payment":"Paid","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Dan","Payment":"Paid","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Stephanie","Payment":"Due","PhoneNumber":"xxxxxxxxxxx"})
database.append({"Customer":"Lukas","Payment":"Due","PhoneNumber":"xxxxxxxxxxx"})

sdk = SDK('CLIENT_ID', 'CLIENT_SECRET', 'SERVER')
platform = sdk.platform()
platform.login('USERNAME', 'EXTENSION', 'PASSWORD')

def sendSMS(message, number):  
    params = {'from': {'phoneNumber': 'USERNAME'},'to': [{'phoneNumber': number}],'text': message}
    response = platform.post('/restapi/v1.0/account/~/extension/~/sms', params)
    print('Sent payment reminder to ' + number)

def main():
    for i in range(len(database)):
        customer = database[i]
        if customer['Payment'] is "Due":
            sendSMS("Hi " + customer['Customer'] + ". Your payment is due.", customer['PhoneNumber'])
        time.sleep(5)
    print("Send payment reminder done.")

if __name__ == '__main__':
    main()

About

RingCentral Connect Platform Python SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.5%
  • Makefile 2.5%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.