Created
January 18, 2013 00:54
-
-
Save mufid/4561372 to your computer and use it in GitHub Desktop.
Progresio API test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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