Postings tasks
Using tasks in RingCentral, teams can better assign action items following a meeting, keep track of personal to-do lists, or even sychronize project management tasks from external systems. Simply put, at the end of the day all of our lives can be boiled down to a set of tasks we are responsible for, and tasks in RingCentral team messaging cam help us keep track of it all.
Using the RingCentral API, the creation and management of tasks can be completely automated.
Posting a task via the REST API
Select your preferred language below.
const RC = require('@ringcentral/sdk').SDK
require('dotenv').config();
CHAT_ID = '<GROUP ID>'
var rcsdk = new RC({
'server': process.env.RC_SERVER_URL,
'clientId': process.env.RC_APP_CLIENT_ID,
'clientSecret': process.env.RC_APP_CLIENT_SECRET
});
var platform = rcsdk.platform();
platform.login({ 'jwt': process.env.RC_USER_JWT })
platform.on(platform.events.loginSuccess, () => {
post_task( CHAT_ID )
})
async function post_task( group ) {
try {
var resp = await platform.post('/team-messaging/v1/chats/'+group+'/tasks', {
"subject": "You need to do X",
"assignees": {
"id": "<ID>"
},
"description": "In this task assignees will need to do x, y and z."
});
var jsonObj = await resp.json()
console.log( JSON.stringify(jsonObj) )
} catch (e) {
console.log(e)
}
}
#!/usr/bin/python
# You get the environment parameters from your
# application dashbord in your developer account
# https://developers.ringcentral.com
import os
import sys
from dotenv import load_dotenv
from ringcentral import SDK
load_dotenv()
CHAT_ID = '<GROUP ID>'
rcsdk = SDK( os.environ.get('RC_APP_CLIENT_ID'),
os.environ.get('RC_APP_CLIENT_SECRET'),
os.environ.get('RC_SERVER_URL') )
platform = rcsdk.platform()
try:
platform.login( jwt=os.environ.get('RC_USER_JWT') )
except Exception as e:
sys.exit("Unable to authenticate to platform: " + str(e))
endpoint = "/team-messaging/v1/chats/" + CHAT_ID + '/tasks'
note = {
"title": "This is a note",
"body": "<strong>heading</strong><br><br>Any HTML can be entered here."
}
resp = platform.post(endpoint, note)
print(resp.text())
<?php
// Remember to modify the path ./../ pointing to the location where the RingCentral SDK was installed and the .env file was saved!
require('./../vendor/autoload.php');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . './../');
$dotenv->load();
$CHAT_ID = '<GROUP ID>';
$rcsdk = new RingCentral\SDK\SDK( $_ENV['RC_APP_CLIENT_ID'],
$_ENV['RC_APP_CLIENT_SECRET'],
$_ENV['RC_SERVER_URL'] );
$platform = $rcsdk->platform();
$platform->login( [ "jwt" => $_ENV['RC_USER_JWT'] ] );
$endpoint = "/team-messaging/v1/chats/"+CHAT_ID+"/notes";
$params = array(
"subject" => "You need to do X",
"assignees" => array( "id" => "<ID>" ),
"description" => "In this task assignees will need to do x, y and z."
);
$resp = $platform->post($endpoint, $params);
print($resp->text());
?>
#!usr/bin/ruby
# You get the environment parameters from your
# application dashbord in your developer account
# https://developers.ringcentral.com
require 'ringcentral'
require 'dotenv/load'
CHAT_ID = '<GROUP ID>'
$rc = RingCentral.new(ENV['RC_APP_CLIENT_ID'],
ENV['RC_APP_CLIENT_SECRET'],
ENV['RC_SERVER_URL'])
$rc.authorize(jwt: ENV['RC_USER_JWT'])
resp = rc.post('/team-messaging/v1/chats/'+CHAT_ID+'/tasks', payload: {
"subject": "You need to do X",
"assignees": {
"id": "<ID>"
},
"description": "In this task assignees will need to do x, y and z."
})
puts resp.body
Tasks Schema
Please consult our API Reference for creating a task to learn more about the following options:
- start and due dates
- color and appearance
- task recurrence
- assignees
- attachments
- sections/categories
Keep learning
Using the Tasks API you can do more than just create a task, you can also: