Skip to content

Instantly share code, notes, and snippets.

@mufid
Created January 18, 2013 00:54
Show Gist options
  • Save mufid/4561372 to your computer and use it in GitHub Desktop.
Save mufid/4561372 to your computer and use it in GitHub Desktop.
Progresio API test
<?php
class pcommand_UNREG extends ProgresioCommandSkeleton {
var $special = array(
"hidden" => TRUE
);
var $id = 2;
function analyze($phoneNumber, $explodedString) {
$unamePelanggan = $explodedString[1];
$campaignPelanggan = $explodedString[2];
$campaignObject = $this->progresioApi->getCampaignObject($unamePelanggan, $campaignPelanggan);
// Cancel if there's no cmapaign associated, or something happened
if ($campaignObject === FALSE || $campaignObject->subscriberExist($phoneNumber) === FALSE) {
return FALSE;
}
$campaignObject->unsubscribe($phoneNumber);
// Get message string
$rawmsg = $campaignObject->getValueRaw("UNREG_MSG_RAW");
// Check whether unregister confirmation is enabled
if ($rawmsg === FALSE) return TRUE;
// Otherwise, send unregister confirmation
$rawvaluepair = $campaignObject->getParticipantValuePair();
$msg = $this->progresioApi->sanitizeString($rawmsg, $rawvaluepair);
$campaignObject->sendMessage($this->$id, $phoneNumber, $msg);
// return TRUE means everything okay
return TRUE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment