diff --git a/composer.json b/composer.json index cb129f4..8b48e24 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { - "name": "mediatoolkit/activecampaign-v3-php", - "description": "PHP Wrapper for ActiveCampaign", + "name": "adrennialbarrett/activecampaign-v3-php", + "type": "library", + "description": "PHP Wrapper for ActiveCampaign (forked from mediatoolkit)", "require": { "guzzlehttp/guzzle": "~6.3" }, @@ -12,6 +13,10 @@ { "name": "Mediatoolkit", "email": "info@mediatoolkit.com" + }, + { + "name": "TB", + "email": "thomas.barrett@adrennial.global" } ], "autoload": { diff --git a/src/lists/Lists.php b/src/Lists/Lists.php similarity index 100% rename from src/lists/Lists.php rename to src/Lists/Lists.php diff --git a/src/contacts/Contacts.php b/src/contacts/Contacts.php index 169ffb8..bbad9c0 100644 --- a/src/contacts/Contacts.php +++ b/src/contacts/Contacts.php @@ -141,6 +141,44 @@ public function listAutomations(int $id) return $req->getBody()->getContents(); } + /** + * Add contact to automation + * @see https://developers.activecampaign.com/reference#create-new-contactautomation + * + * @param int $contact_id + * @param int $automation_id + * @return string + */ + public function addToAutomation( int $contact_id, int $automation_id ){ + $req = $this->client + ->getClient() + ->post( '/api/3/contactAutomations', [ + 'json' => [ + 'contactAutomation' => [ + 'contact' => $contact_id, + 'automation' => $automation_id + ] + ] + ]); + return $req->getBody()->getContents(); + } + + /** + * Get contact custsom field values + * @see https://developers.activecampaign.com/reference#retrieve-contact-field-values + * + * @param int $contact_id + * @return string + */ + public function getCustomFieldValues( int $contact_id ){ + $req = $this->client + ->getClient() + ->get( '/api/3/contacts/' . $contact_id . '/fieldValues' ); + + return $req->getBody()->getContents(); + } + + /** * Add a tag to contact * @see https://developers.activecampaign.com/reference#create-contact-tag