question

RingCentral Admin avatar image
RingCentral Admin asked RingCentral Admin answered

Webhook Notifications Ruby Quick Start doesn't work

Hello,

I am following exactly the instructions at https://developers.ringcentral.com/guide/notifications/quick-start/webhook/ruby

The authorization line works:

rc.authorize(username: RINGCENTRAL_USERNAME, extension: RINGCENTRAL_EXTENSION, password: RINGCENTRAL_PASSWORD)

But when I want to POST it fails:

    r = rc.post('/restapi/v1.0/subscription', payload: {
        eventFilters: ['/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS'],
        deliveryMode: { transportType: 'WebHook', address: DELIVERY_ADDRESS }
    })

I get this:

RestClient::BadRequest: 400 Bad Request

Any idea why this is happening?

Thanks

rest api
2 comments
1 |1500 characters needed characters left characters exceeded

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

What is your deliver address (DELIVERY_ADDRESS)? Are you running locally on your machine and do you use ngrok tunnel? If yes, can you also open this url http://127.0.0.1:4040 on your browser to see if the request is correct.

Also did you copy and run the server code:

require 'sinatra'
set  :port, 5000
post '/' do
    status 200
    headers('Validation-Token' => request.env['HTTP_VALIDATION_TOKEN']) if request.env['HTTP_VALIDATION_TOKEN']
    request.body.rewind
    body = request.body.read
    puts body
    # do whatever with body
    body 'OK'
end
0 Likes 0 ·

I found the problem. I was using an old version of the ringcentral-sdk gem. Now updated to 0.9.4 and it works.

0 Likes 0 ·

1 Answer

RingCentral Admin avatar image
RingCentral Admin answered

I found the problem. I was using an old version of the ringcentral-sdk gem. Now updated to 0.9.4 and it works.

1 |1500 characters needed characters left characters exceeded

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