<?php
use CallFire\Api\Rest\Request;
use CallFire\Api\Rest\Response;
require 'vendor/autoload.php';
$client = CallFire\Api\Client::Rest("<api-login>", "<api-password>", "Broadcast");
$request = new Request\QueryBroadcasts;
$response = $client->QueryBroadcasts($request);
$result = $client::response($response);
if($result instanceof Response\ResourceList) {
foreach($result as $broadcast) {
?>
<?=$broadcast->getName()?> (<?=$broadcast->getId()?>) [
Status: <?=$broadcast->getStatus()?>
Last Modified: <?=$broadcast->getLastModified()?>
Type: <?=$broadcast->getType()?>
]
<?php
}
}
Issue a ControlBroadcast request with a command of START
.
Note that the response for this operation is simply true
,
indicating that it has succeeded.
<?php
use CallFire\Api\Rest\Request;
require 'vendor/autoload.php';
$broadcastId = 123456;
$client = CallFire\Api\Client::Rest("<api-login>", "<api-password>", "Broadcast");
$request = new Request\ControlBroadcast;
$request->setCommand($client::COMMAND_START);
$response = $client->ControlBroadcast($broadcastId, $request);
$result = $client::response($response);
if(is_bool($result) && $result) { // ControlBroadcast response is `true`
// Success
}
Load contacts into a broadcast's contact batch, including
setting some contact metadata for use in the IVR.
Note that this operation returns a ResourceReference response.
Note that the spaces in the contact
data are intentionally replaced with underscores. The API
does not support spaces in any contact data.
<?php
use CallFire\Api\Rest\Request;
use CallFire\Api\Rest\Response;
use CallFire\Common\Resource;
require 'vendor/autoload.php';
$broadcastId = 123456;
$batchName = 'My Contact Batch';
$contacts = array(
(new Resource\Contact)->setId('15551231234') // Phone number
->setFirstName('John')
->setLastName('Doe')
->addAttribute('address', '123_Main_St'), // Custom attribute
(new Resource\Contact)->setId('15551231235')
->setFirstName('Jane')
->setLastName('Smith')
->addAttribute('address', '324_First_Boulevard')
);
$client = CallFire\Api\Client::Rest("<api-login>", "<api-password>", "Broadcast");
$request = new Request\CreateContactBatch;
$request->setTo($contacts);
$response = $client->CreateContactBatch($broadcastId, $request);
$result = $client::response($response);
if($result instanceof Response\ResourceReference) {
// Success
}