question

Robert Goth avatar image
Robert Goth asked Phong Vu commented

Setting up and receiving event notifications.

Thanks in advance.

Ok I have to say I do not fully understand the notification and events but I am trying.

I have a php page (notification.php) at

"https://myurl.com/webhook-notification.php?webhookcallback"

I used the code from https://developers.ringcentral.com/guide/notifications/webhooks/quick-start to set up a notification. with the following settings

 $DELIVERY_ADDRESS='https://myurl.com/recall/ring/webhook-notification.php?webhookcallback';


  $params = array(
        'eventFilters' => array(
            '/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS',
            '/restapi/v1.0/account/~/telephony/sessions'
        ),
        'deliveryMode' => array(
            'transportType' => "WebHook",
            'address' => $DELIVERY_ADDRESS
        ));

I opened a terminal window and started PHP server and ran the following

$ php -S localhost:5000

when I load the URL page in a browser I get the following Response:

 {"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/subscription/############","id":"################","creationTime":"2023-06-16T16:17:56.455Z","status":"Active","eventFilters":["/restapi/v1.0/account/#########/telephony/sessions","/restapi/v1.0/account/#######/extension/######/message-store/instant?type=SMS"],"expirationTime":"2023-06-23T16:17:56.455Z","expiresIn":604799,"deliveryMode":{"address":"https://myurl.com/recall/ring/webhook-notification.php?webhookcallback","transportType":"WebHook","encryption":false}}

SO if I understand it correctly I should now be notified when a text or sms is sent by a push notification to the following address

https://myurl.com/recall/ring/webhook-notification.php?webhookcallback

I have a code in this php page to make a log evey time the above URL page is loaded. When I call or text the sandbox number I do not get a pageload indicating to me the push notification was not sent. Any advice?

notifications
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

Double check if your app has the SMS and Call Control app scopes.

Is your delivery address a localhost on port 5000 on your local machine? Or is it an online server? Can you post something to that address?

1 |3000

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

Robert Goth avatar image
Robert Goth answered Phong Vu commented

It is on an online web server. I have never tried to post anything to the address from outside the local host so maybe that is the problem?\

3 comments
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 ♦♦ commented ·

If it is an online server, why do you need to run the command

$ php -S localhost:5000

That command is needed only if you run the server code in your local machine and using ngrok tunnel address on the port 5000.

0 Likes 0 ·
Robert Goth avatar image Robert Goth Phong Vu ♦♦ commented ·

I wasn't sure what the port 5000 was for but thought I would follow the instructions on the documentation as I didn't want that to be the reason it did not work.


0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Robert Goth commented ·

If you follow the instructions to run the server locally on your machine, then also run ngrok and get the forward address and use that address as the delivery address as instructed from the dev guide.

$ ngrok http 5000
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