News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Subscribe to SMS Events
Tags: subscription
Aug 25, 2023 at 7:23am   •   1 replies  •  0 likes
Justin Rankin

Subscribing to a message event is giving me a hard time. I have set up webhook notifications for my account before but a previous integration was failing so I had to remove my old subscription and create a new one to test with locally. Now when I go to subscribe to the webhook using the extensions credentials to sign in, the process responds back with an error message "403 - Forbidden" "Not allowed to subscribe for events of other account". I don't know how this could be though since I am signing in as myself to subscribe to an event.

platform.login({
    "username": 1234567890,
    "password": "nOTmyPaSsword",
    "extension": 999
})

platform.on(platform.events.loginSuccess, async ()=>{
    var body = {
        eventFilters: [
            "/restapi/v1.0/account/1234567890/extension/999/message-store/instant?type=SMS"
        ],
        expiresIn: 315360000,
        "deliveryMode": {
            "transportType": "WebHook",
            "address": "https://bigtest.ngrok-free.app/ring-central",
            "verificationToken": "verificationTOKEN"
        }
    }
    var respose = await platform.post("/restapi/v1.0/subscription", body);
    var json = await respose.json();
    console.log(json);
})

If it really helps I can expose the extension and number (just not the password obviously) but this is what I have been using to try and subscribe to an event. I am logging in with the extension and then if I log in successfully, subscribe. I am able to log-in successfully as I am logging successes back to the console, but as I said earlier, the API returns a 404 Forbidden Response. Is there something that I am inherently missing?

1 Answer
answered on Aug 25, 2023 at 11:18am  

This is the key problem.

eventFilters: [
            "/restapi/v1.0/account/1234567890/extension/999/message-store/instant?type=SMS"
        ]

And the error message told you the reason:

error message "403 - Forbidden" "Not allowed to subscribe for events of other account"

The API reference shows you this. The account Id and the extension Id (Not extension number 999 as in your code.

/restapi/v1.0/account/{accountId}/extension/{extensionId}/message-store

If you don't know the account Id nor the extension Id, simple use the tilde like this

/restapi/v1.0/account/~/extension/~/message-store

Check the dev guide for sample code


 1



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us