Skip to main content
The First Step
Jun 16, 2023 4:53 PM UTC
Question

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?

3 replies

PhongVu
Community Manager
Community Manager
Jun 16, 2023 6:12 PM UTC

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?

robgothThe First StepAuthor
The First Step
Jun 16, 2023 7:49 PM UTC

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?

PhongVu
Community Manager
Community Manager
Jun 16, 2023 8:09 PM UTC

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.