question

Thomas Carlson avatar image
Thomas Carlson asked Thomas Carlson edited

Custom Salesforce status field to update RC embeddable status

Howdy,

I have a custom Salesforce object 'User Setting' and I would like to add a custom field 'User Status'.

Ideally, updating the User Status would update the RC embeddable widget's status field as well as the desktop soft-phone status. We would like our system to look through the RC HUD and automatically route calls to a user based on their presence status.

Is it possible to accomplish this, to have the RC embeddable listening for changes on a custom Salesforce field ? Maybe by using RC event data subscriptions to Salesforce's streaming API, or webhooks that are listening for updates/changes to the custom User Status Salesforce field?

integrationswebhookssubscription
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 Phong Vu edited

Hi Thomas,

You can implement a server-side app to listen for user presence status changes at the account level then update user settings in Salesforce accordingly.

Please refer to these documentations for more info:

1. Webhook notifications quick start (change the event type with presence)

2. Presence information explained

Hope this helps!

1 |3000

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

Thomas Carlson avatar image
Thomas Carlson answered Thomas Carlson edited

Hey @Phong Vu

Thank you for the time, energy, and response! When you say a 'server-side' app, are you referring to the kind of application that I create in RingCentral Dev Portal? The Server/no ui option?

Would it be possible to change user presence status in the embeddable widget and have a custom 'User HUD Status' Salesforce field update accordingly? I'm new to Salesforce but I think that using the Streaming API to listen for user presence change events and then updating the custom SF field would be plausible. But where would I put the code telling Salesforce to listen for User Status Presence Changes? Where do I put the code that tells the RingCentral embeddble widget to emit User Status change events? Is the embeddable widget extensible to that degree? How does it get authorization to change a Users Salesforce Data?


Maybe you could point me in the right direction in regards to redirect url's; and why I'm unable to get a response when using cURL to submit requests.

I have thus far been unable to get a request to respond with anything other than an error. I've been trying to test my requests using cURL but I can't get an authorization token. The request I'm using (but with the account/password/clientid/clientsecret filled in appropriately) is from this medium article on using cURL to access the RC platform API.

Windows 10 Command Prompt uses the ^ for multiple lines so I use those instead of what is listed in the article "/".

curl -i -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token" ^
-H "Accept: application/json" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
-u "<clientId>:<clientSecret>" ^
-d "username=<Account>&password=<password>&extension=&grant_type=password"


In Salesforce I have set up a Connected Application with two allowed callback URL's

https://ringcentral.github.io/ringcentral-embeddable/redirect.html

https://apps.ringcentral.com/restapi/oauth/authorize?response_type=code&client_id=myClientID&redirect_uri=https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/presence&prompt=login_consent

But in response I get,

Date: Tue, 18 Jun 2019 15:21:44 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 199
Connection: keep-alive
X-Application-Context: application:8080
Content-Language: en
WWW-Authenticate: Bearer realm="RingCentral REST API", error="invalid_grant", error_description="Invalid resource owner credentials"
RCRequestId: c7c80804-91dc-11e9-943c-005056bb3a93
Pragma: no-cache
Cache-Control: no-store
AceRoutingKey: sjc11-c01-ace11.d4949dec-85f2-11e9-9962-005056bb6e9b
X-HLB-Server: sjc11-c01-hlb11
X-HLB-Connection: 320459994
X-HLB-RequestId: 507ff7b53a64258d5bbebf4b6364827a
X-HLB-Upstream-Server: 10.28.23.0:8080
X-HLB-Upstream-Status: 400

{
  "error" : "invalid_grant",
  "errors" : [ {
    "errorCode" : "OAU-140",
    "message" : "Invalid resource owner credentials"
  } ],
  "error_description" : "Invalid resource owner credentials"
}

Maybe I have an error in my connected application callback URL? Maybe I'm sending my request to the wrong place? I am using my live RC credentials in the sandbox RC Server/no Ui application, could this be the issue? I am using my live credentials because the password field in the Sandbox is 'inactive'; can I set the password for my sandbox account?

Thank you!

1 |3000

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

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