question

shaun-mclean6109 avatar image
shaun-mclean6109 asked Phong Vu commented

How can I specify a user as host for a meeting when authenticated with the admin account in an API?

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?

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered Joseph Kaylen commented

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
5 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

shaun-mclean6109 avatar image shaun-mclean6109 commented ·

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

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ shaun-mclean6109 commented ·

I tested myself and it works well. I just modified my answer to show better the [accountId], which you don't need to specify but can use the tilde ~.

I have working code in Node JS. Let me know if you want the code. It is simple though.

0 Likes 0 ·
shaun-mclean6109 avatar image shaun-mclean6109 Phong Vu ♦♦ commented ·

Unfortunately I can't even get this to work in the API Reference interface that RC offers at https://developers.ringcentral.com/api-reference/Meeting-Management/createMeeting
Not sure what's wrong but I've submitted a ticket and hope it gets resolved

0 Likes 0 ·
Show more comments
Show more comments
Phong Vu avatar image
Phong Vu answered Phong Vu edited

@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)
  }
}
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Joseph Kaylen avatar image
Joseph Kaylen answered Joseph Kaylen commented

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.

2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

I did not test on sandbox yet but I can try it later. I've tested to login with a standard user and schedule a meeting for another standard user (e.g. ext. 103 schedules for ext. 102 and it also works).

I am going to chat with the author of the article and will ask him to retest his code and edit the article accordingly.

For your sandbox, what is your sandbox main company number or account id?


Hold on. It seems working only for Instant meeting. I just tested with meetingType = "Scheduled" and it failed. Let me investigate a bit more then give you an update.

1 Like 1 ·
Joseph Kaylen avatar image Joseph Kaylen Phong Vu ♦♦ commented ·

Thank you for the follow-up! Account information is below. I am building the middleware so that the Learning Management System our company sells can automatically create RingCentral meetings for Instructors when they host a Training Event. We have integrations with WebEx, GoTo Meeting, and others, but not yet RingCentral.

Production Main Account (Cornerstone Ondemand): +19493934961
Production My Extension: 580098
My Sandbox Account: 14244335649

0 Likes 0 ·
Joseph Kaylen avatar image
Joseph Kaylen answered Phong Vu commented

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

3 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Enabled.

0 Likes 0 ·
Joseph Kaylen avatar image Joseph Kaylen Phong Vu ♦♦ commented ·

Thank you for Enabling!

I am able to create a scheduled meeting for my super user (ext 101), however when I try to create a meeting on behalf of another user (ext 102/id 687835005/Kristina Kaylen on Sandbox Account 14244335649). I get an error that the user needs to have [Meetings] permission.

Do you mind enabling Meetings for this second user (ext 102/id 687835005/Kristina Kaylen on Sandbox Account 14244335649) so that I can test creating scheduled meetings on behalf of that user?

Thank you for all of the help! We're excited to make the transition from WebEx.

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Joseph Kaylen commented ·

No I can't. That is the problem under discussion in this thread that one user extension cannot schedule a meeting on behalf of another user extension. In my test, I could only create an instant meeting for other extensions but not be able to "Schedule" a meeting for them. While I am waiting for an answer from the dev team, I think that this is the limitation right now.

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys