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.