question

robert-raj8062 avatar image
robert-raj8062 asked ak commented

Create webhook for receiving calls using Javascript sdk

HI all try create webhook for receiving calls using javascript sdk, but i got Error: Parameter [request] value is invalid

This is my following code

 var _eventFilters = [];
        _eventFilters.push('/restapi/v1.0/account/~/extension/' + 101 + '/presence?detailedTelephonyState=true&aggregated=true')

  rcsdk.platform()
            .send({
                 
                method: 'POST',                  url: '/subscription',                  eventFilters: _eventFilters,                  deliveryMode: {                      "transportType": "WebHook",                      "encryption": false,                      "address": "https://33d7f758.ngrok.io/RingCentralTest/RcTest";                  }              })              .then(function (apiResponse) {                  console.log(apiResponse.json())                })              .catch(function (e) {                    console.log(e)              });  

Thanks in Advance

sdk
1 |1500

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

ak avatar image
ak answered
Hi Robert,

The event filters that you have passed for creating the subscription via WebHook is wrong. 

Kindly use the below code and try the API call again:

var _eventFilters = [];
        _eventFilters.push('/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&aggregated=true')

When you pass the event filters for an extension you can either provide :

1.) (~) which would refer to the extension authorized by.
2.) Provide the extensionID for an extension, which you can look up using the below API Endpoint
      Get Extensions List
      GET  /v1.0/account/{accountId}/extension/
 


1 |1500

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

Tyler Liu avatar image
Tyler Liu answered
101 is extension number. Extension ID is expected.
1 |1500

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

robert-raj8062 avatar image
robert-raj8062 answered ak commented
After applying the extension id getting the error

 Error: Parameter [request] value is invalid
    at Client.<anonymous> (/var/www/html/commusoft-app/node_modules/ringcentral/src/http/Client.js:62)
    at <anonymous>
5 comments
1 |1500

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

Can you help us to help you by posting what you changed/added to the eventFilters.

Basically, you don't need to specify the extension id at all if you login with an extension's credentials. The string "account/~/extension/~/" will tell the server to use the current login extension.

Also, please notify us if an answer helped you solve your problem so we can mark it as "answered".

+ Phong
0 Likes 0 ·
I am seeing the same error. Here is my eventFilters:
'eventFilters':["/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&sipData=true",
"/restapi/v1.0/account/~/extension/~/message-store",
"/restapi/v1.0/account/~/extension/~/presence/line",
"/restapi/v1.0/account/~/extension"] I logged in with no extension. Any idea why the parameter request value is invalid?
0 Likes 0 ·
Yiru,

You don't need to specify the extensionId if you login with an extension's credentials.

The string "account/~/extension/~/" will tell the server to use the current login extension. If you did not login with an extension, I mean you just used the Username and Password then the default Extension would be used to Login ( Default Ext could be 101 unless changed )


You will get the below error only when the request body is incorrect:
{"errorCode":"CMN-101","message":"Parameter [request] value is invalid","errors":[{"errorCode":"CMN-101","message":"Para (truncated...) 
Please could you provide the complete API request here? My assumption is that you are missing something in the HTTP Body when you are creating a subscription using the /subscription API endpoint.

Just for reference, you could look up the HTTP Body Parameters for the subscription endpoint below:

https://developer.ringcentral.com/api-explorer/latest/index.html#/!/Push_Notifications/createSubscri...


0 Likes 0 ·
I got to resolve the problem. I didn't render the Json data properly so my request body was incorrect. Thanks!
0 Likes 0 ·
Awesome 
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