Bod::CRM
Bod::CRM provides simple methods to access the Lets Delight CRM.
use Bod::CRM;
my $crm = Bod::CRM->new();
my $vars = {
'firstname' => 'John',
'lastname' => 'Smith',
'pri_email' => 'john.smith@example.com',
};
$crm->add($vars);
my $vars = {
'firstname' => 'John',
};
my @contacts = $crm->find($vars);
print $crm->error;
Except where otherwise documented, methods return zero to indicate an error. The error message can be found by calling the error() method.
Creates a new connection to the CRM. If environment is 'prod' or 'test', that environment is used. If environment is omitted, an attempt is made to find the environment from the $ENV{'HTTP_HOST'}
variable.
Returns a Bod::CRM object or undef if unsuccessful. Unsuccessful means either the environment was wrong or the connection to the database failed for another reason.
Return a string detailing the last error.
Finds a list of people in the CRM matching all the fields passed as a hash reference. Empty strings are not matched unless the optional blanks parameter is true. Returns an array of people IDs that match all keys as fields to values as contents.
Get information about the person with given id Returns a hash reference containing keys with the values of the CRM field names.
Add a person to the CRM or update existing person
Given the information in the passed hash reference fields add or update a person. If the email or Twitter fields match then update an existing person, otherwise add a new person. If a new person is being added then the fields source key must be set to the correct value to correspond with the PersonSource table. If the source key is not set or insufficient information is provided, returns zero. Otherwise returns the contact ID of the person created or updated.
Adds the person to the business unit as definded in the BusinessUnit table. Has no effect if the person is already added to the business unit. However, if the optional subscribe is true, the person will be resubscribed to the list if they had previously unsubscribed.
Returns true if the person is in the busines unit, zero if it has failed and undef if an error has occurred.
Set the marketing permissions for a person on the specified business unit. The permission parameter is defined in the MarketingPermissionLookUp table. Normally, this method will grant the permission but can also revoke the permision by passing 'R' as the optional grant parameter