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
SMS Webhook subscription not receiving via PHP and not able to send/receive SMS via devtest GLIP app.
Tags: rest api
Apr 13, 2020 at 9:08pm   •   1 replies  •  0 likes
Kyle McLaughlin

Hello I'm trying to use Webhook subscription for SMS using the code here - https://developers.ringcentral.com/guide/notifications/quick-start/webhook/php I used php sdk installed via composer. I'm using non-gui type of App.

I successfully registered my endpoint that save received data as json file.

{
  "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/subscription/84810115-4216-400b-a0c4-386ed513abd3",
  "id": "84810115-4216-400b-a0c4-386ed513abd3",
  "creationTime": "2020-04-14T03:56:24.424Z",
  "status": "Active",
  "eventFilters": [
    "/restapi/v1.0/account/275222004/extension/275222004/message-store/instant?type=SMS"
  ],
  "expirationTime": "2020-04-21T03:56:24.424Z",
  "expiresIn": 604799,
  "deliveryMode": {
    "transportType": "WebHook",
    "encryption": false,
    "address": "https://mydomain.com/PodioReWeb/RingCentral/Webhooksms.php?webhookcallback"
  }
}


On my end point this is the code I have.

<?php
require_once $_SERVER['DOCUMENT_ROOT']."/Utilities/Helper/Class.php";
$_POST = json_decode(file_get_contents('php://input'), true); //Catch JSON post request
Helper::LogFile("Logfile_ReceivedData", $_POST, "Data received");
require('vendor/autoload.php');

$RINGCENTRAL_CLIENTID = '<secret>';
$RINGCENTRAL_CLIENTSECRET = '<secret>';
$RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com';
$RINGCENTRAL_USERNAME = '+14704622677';
$RINGCENTRAL_PASSWORD = '<secret>';
$RINGCENTRAL_EXTENSION = '101';

$DELIVERY_ADDRESS = 'https://mydomain.com/PodioReWeb/RingCentral/Webhooksms.php?webhookcallback';

$rcsdk = new RingCentral\SDK\SDK($RINGCENTRAL_CLIENTID, $RINGCENTRAL_CLIENTSECRET, $RINGCENTRAL_SERVER);
$platform = $rcsdk->platform();

if (isset($_REQUEST['webhookcallback'])){
    if (array_key_exists('HTTP_VALIDATION_TOKEN', $_SERVER)) {
        return header("Validation-Token: {$_SERVER['HTTP_VALIDATION_TOKEN']}");
Helper::LogFile("Logfile_ReceivedData", $_POST, "Data received");
    }else{
  Helper::LogFile("Logfile_ReceivedData", $_POST, "Data received");
    }
}else{
    $platform->login($RINGCENTRAL_USERNAME, $RINGCENTRAL_EXTENSION, $RINGCENTRAL_PASSWORD);
    $params = array(
            'eventFilters' => array(
                '/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS'
                ),
            'deliveryMode' => array(
                'transportType' => "WebHook",
                'address' => $DELIVERY_ADDRESS
            ));
    try {
          $apiResponse = $platform->post('/subscription', $params);
          print_r ("Response: " . $apiResponse->text());
    }catch (Exception $e){
          print_r ("Exception: " . $e->getMessage());
    }
}
?>


The thing is I'm not receiving any webhook notification when I tried to send SMS via Sandbox API (sms sent successfully using sandbox extension). Also I tried sending SMS to the sandbox extension. I do not see the message under GLIP App or not even receiving any Webhook notification for it. When I tried to manually send a message via devtest GLIP app, I received the following error below.

Customer account plan is on Office Premium plan.

1 Answer
answered on Apr 14, 2020 at 9:05am  

This filter means your app will receive a notification of incoming text messages sent to a phone number belongs to the extension identified by the extension id "275222004", which I believe is the 101 as you logged in your app with "101".

extension/275222004/message-store/instant?type=SMS"/message-store/instant?type=SMS"

So when you wrote "The thing is I'm not receiving any webhook notification when I tried to send SMS via Sandbox API (sms sent successfully using sandbox extension)", did you send to a phone number owned by the 101 extension?


Let's solve one problem at a time and can you ask the GLIP notification in a new thread (it's a different problem) so it is easier to follow up.


 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