Share via

Error Calling Beta Subscription endpoint for OnlineMeetings notifications

Norris, Stephen 0 Reputation points
2023-06-02T19:00:53.3133333+00:00

Hi All,

We are trying to subscribe to notifications fro an online meeting that we are successfully creating with the onlinemeetings endpoint.

I have the below function in node.js to make a call to beta/subscriptions. I am not using ngrok, but I have my notificationUrl in my azure idp yml file reply_urls which is working for authcodes from MS.

The joinUrl a string returned directly from the createMeeting call.

I am getting the following error:

'{"error":{"code":"InvalidRequest","message":"Unable to connect to the remote server","innerError":{"date":"2023-06-02T18:17:53","request-id":"06a8021d-6508-4d14-bb20-58cfe67fe781","client-request-id":"06a8021d-6508-4d14-bb20-58cfe67fe781"}}}

Any help would be greatly appreciated.

Thanks!

function subscribeToCallRecords(joinUrl: string) {  

cca.acquireTokenByClientCredential({ scopes: ['https://graph.microsoft.com/.default'] }).then(async codeResponse => {
    const { accessToken } = codeResponse;
    await superagent.post(`https://graph.microsoft.com/beta/subscriptions`)
    .set('Accept', 'application/json')
    .auth(accessToken, { type: 'bearer' })
    .send({
           changeType: 'updated',
           notificationUrl: 'https://localhost:3000/api/ms-graph/subscription-response',
           includeResourceData: true,
           resource: `/communications/onlineMeetings/?$filter=JoinWebUrl eq '${joinUrl}'`,
           expirationDateTime: new Date(Date.now() + 3600000).toISOString(),
           encryptionCertificateId: process.env.ENCRYPTION_CERT_ID,
           encryptionCertificate: process.env.BASE64_ENCRYPTION_CERT,
           clientState: 'ClientState'
         })
   .then(response => { 
     console.log('RESPONSE', response);
     return response;
     })
   .catch(error => {
      console.log('ERROR', error);
    });
})
}
Microsoft Security | Microsoft Graph

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.