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.
This SDK is tested against Python 3.7 so we recommend installing using it with Python 3.7 or newer
https://github.com/ringcentral/ringcentral-python/blob/master/dev-notes.md
$ git clone https://github.com/ringcentral/python-sdk.git ./ringcentral-python-sdk
Install dependencies:
$ pip3 install ringcentral
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.
Take a look at a sample code.
from ringcentral import SDK
sdk = SDK('CLIENT_ID', 'CLIENT_SECRET', 'SERVER')
platform = sdk.platform()
platform.login(jwt='JWT_TOKEN')
res = platform.get('/account//extension/')
print('User loaded ' + res.json().name)
# Subscribing for server events
## With WebSocket (recommended)
Please refer to [demo_subscription.py](./ringcentral/demos/demo_subscription.py)
## With PubNub (deprecated)
```py
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
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(jwt='JWT_TOKEN')
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()