Hi Team
I want to send text.I try this code for sending sms:
<?php
require('vendor/autoload.php');
use RingCentralSDKSDK;
// Parse the .env file
$dotenv = new DotenvDotenv(getcwd());
$dotenv->load();
try {
// Create SDK instance
$rcsdk = new SDK($_ENV['GLIP_APPKEY'], $_ENV['GLIP_APPSECRET'] , $_ENV['GLIP_SERVER'], 'Demo', '1.0.0');
// Create Platform instance
$platform = $rcsdk->platform();
/*
* Using the caching mechanism
*/
$cacheDir = __DIR__ . DIRECTORY_SEPARATOR . '_cache';
$file = $cacheDir . DIRECTORY_SEPARATOR . 'platform.json';
$cachedAuth = array();
if (file_exists($file)) {
$cachedAuth = json_decode(file_get_contents($file), true);
}
$platform->auth()->setData($cachedAuth);
// To login user
$rc=$platform->login($_ENV['username'],$_ENV['extension'],$_ENV['password']);
$apiResponse = $rcsdk->platform()->post('/account/~/extension/~/sms', array(
'from' => array('phoneNumber' => 'your-ringcentral-sms-number'),
'to' => array(
array('phoneNumber' => 'mobile-number'),
),
'text' => 'Test from PHP',
));
/*
* Setup Webhook Subscription
*/
$apiResponse = $platform->post('/subscription',array(
"eventFilters"=>array(
"/restapi/v1.0/glip/groups",
"/restapi/v1.0/glip/posts"
),
"deliveryMode"=>array(
"transportType"=> "WebHook",
"address"=>$_ENV['GLIP_WEBHOOK_URL']
)
));
print PHP_EOL . "Wohooo, your Bot is Registered now." . PHP_EOL;
} catch (Exception $e) {
print 'Webhook Setup Error: ' . $e->getMessage() . PHP_EOL;
}
after running this code I get this error:
Please tell me if i miss something in this.Also suggest docs for sending msg from local machine.