question

RingCentral Admin avatar image
RingCentral Admin asked ·

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

api
2 comments
1 |1000 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

· Write an 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.

Share
1 |1000 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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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