Skip to main content

I have an app in production with permission Meetings and can successfully create a Meeting with the API for the admin account. I want to be able via my script to authenticate on the admin account and then pass through the details for a user in the account so the meeting is created with the user as host. I tried using the number I see for each user in the Admin Portal URL but that is not working.

How do I get a valid host ID for each user and pass it via the API Create Meeting?

Can you try to read the user's extension id then create a meeting with that extension id

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/[extensionId]/meeting

So do I have to make a different App for every user? That seems odd. When I authenticate to the App it is with the admin credentials - when attempting to create a meeting for another user if I set host id to what I believe is the correct internal extension id I get a "errorCode":"MET-106"

"message":"Cannot create meeting. Reason : [Provider internal error]" error and if I set both extension id and host id with the internal user id I get "errorCode":"CMN-101"

"message":"Parameter [extensionId] value is invalid"

Perhaps I'm using the incorrect extension Id but how do I get extension IDs for users unless my App has the ReadAccounts permission? Do I need to create a whole other App with ReadAccounts, get it approved to Production just so I can get the correct IDs. Perhaps I'm missing the obvious here but I'm having trouble finding much documentation on this. Appreciate your help on this @Phong Vu


@Joseph Kaylen

Here is the code in Node JS. remember that it works on production. You can try on sandbox if your sandbox has been enabled Meeting feature

const RingCentral = require('@ringcentral/sdk').SDK

RINGCENTRAL_CLIENTID = "your-app-client-id"
RINGCENTRAL_CLIENTSECRET = "your-app-client-secret"
RINGCENTRAL_SERVER = 'https://platform.ringcentral.com'

RINGCENTRAL_USERNAME = 'main-company-number'
RINGCENTRAL_PASSWORD = '101-password'
RINGCENTRAL_EXTENSION = '101'

const rcsdk = new RingCentral({
server: RINGCENTRAL_SERVER,
clientId: RINGCENTRAL_CLIENTID,
clientSecret: RINGCENTRAL_CLIENTSECRET
})

var platform = rcsdk.platform();

platform.login({
username: RINGCENTRAL_USERNAME,
extension: RINGCENTRAL_EXTENSION,
password: RINGCENTRAL_PASSWORD
})

platform.on(platform.events.loginSuccess, () => {
read_user_extension_id()
})

async function read_user_extension_id(){
console.log("read_user_extension_id")
try{
var resp = await platform.get('/restapi/v1.0/account/~/extension')
var jsonObj = await resp.json()
for (var record of jsonObj.records){
if (record.extensionNumber == 102){ // e.g. 101 creates a meeting for 102
console.log(record)
create_meeting(record.id)
}
}
}catch(e){
console.log(e.message)
}
}

async function create_meeting(id){
console.log("Schedule a meeting for: " + id)
var endpoint == `/restapi/v1.0/account/~/extension/${id}/meeting`
try{
var resp = await platform.post(endpoint, {
topic: 'Test Meeting',
meetingType: 'Instant',
allowJoinBeforeHost: false,
startHostVideo: true,
startParticipantsVideo: false
})
var jsonObj = await resp.json()
console.log( 'Start Your Meeting: ' + jsonObj.links.startUri )
console.log( 'Meeting id: ' + jsonObj.id )
}catch(e){
console.log(e.message)
}
}

Thank you very much Phong!

I didn't realize record.ID (as used in the meeting endpoint), did not equal Extension Number. Wow! That would've taken forever for me to determine.

Does your 101 account have permissions do create meetings on behalf of all users? Or does each user have to go into settings and add your 101 account to 'Schedule Meetings for Me'?


I am referencing this article: https://medium.com/ringcentral-developers/programmatically-manage-others-meetings-a96cd8a9653f (about halfway down).

Sorry for all the questions, but my sandbox account does not yet have [Meetings] enabled. I sent an email earlier today with my paid account information, so hopefully it gets turned on soon.

I would almost prefer each user has to modify their Schedule Meetings for Me settings, rather then using the Super Admin account.


@Phong Vu are you able to get Meetings enabled on My Sandbox Account? 14244335649 Thank you! - Joe


Enabled.


Reply