Registering call logging service into RingCentral Embeddable results in undefined error

67 views Asked by At

It appears all my current attempts to register a third party service (My Single Page Application) using RingCentral Embeddable are proving difficult. I'm using the postMessage API with type rc-adapter-register-third-party-service and the result remains "undefined"

document.querySelector("#rc-widget-adapter-frame").contentWindow.postMessage({
  type: 'rc-adapter-register-third-party-service',
  service: {
    name: 'TestService'
  }
}, '*');

Is there a resolution to this as I'm successful receiving inbound calls. When I use type "rc-adapter-new-call" for outbound calls it also works but third party integration is proving difficult and the link neither pops up on the softPhone.

For more details see...

https://github.com/ringcentral/ringcentral-embeddable/blob/master/docs/third-party-service-in-widget.md#register-your-service

Thanks!

1

There are 1 answers

0
embbnux On

I think the issue is that we need to register service after widget loaded. Here is a demo for it. Let me update the embeddable docs.

var registered = false;
window.addEventListener('message', function (e) {
  const data = e.data;
  if (data && data.type === 'rc-login-status-notify' && registered === false) {
    registered = true;
    registerService();
  }
});