Giter Site home page Giter Site logo

php-sdk's People

Contributors

ameagher avatar csciuto avatar daveberard avatar dsjellz avatar egaiter avatar ewaltman avatar huebs avatar jcoby avatar narkiss333 avatar nganivet avatar ropotam avatar shannon7wallace avatar woogienoogie avatar xpavp03 avatar zackkatz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-sdk's Issues

handle error code

hi,I hope it's ok to ask questions here instead at the dev forum.I would like to ask how to get success or error status code and display it on page?thanks.

addOrUpdateContact.php

I'm attempting to use the addOrUpdateContact example you guy have, and it is throwing a catchable error:

Catchable fatal error: Argument 1 passed to Ctct\Components\Contacts\Contact::create() must be of the type array, object given, called in /home/saveinju/public_html/wp-content/themes/childress-new/functions.php on line 642 and defined in /home/saveinju/public_html/wp-content/themes/childress-new/vendor/constantcontact/constantcontact/src/Ctct/Components/Contacts/Contact.php on line 147

It works fine when I try add a new user, but when one already exists, it starts throwing errors like the one above. Any ideas?

sync from constant contact to local database

hi,it's me again.I would like to ask if there are any examples about sync contact list with local database,check the contat status and then update the local database.And is it a best practice if I iterate all contacts and check their status and if their status was removed or optout,then the database will be updated.I need your suggestions please.Thanks a lot.

getContactByEmail returning exception

I'm getting an exception thrown by ConstanctContact when using getContactByEmail:

PHP Fatal error:  Uncaught exception 'Ctct\Exceptions\CtctException' with message '[{"error_key":"query.param.invalid","error_message":"The query parameter email[0] is not supported."}]' 

Near as I can tell, it's passing the e-mail parameter as email[0]= and the API is expecting email=.

The calling code:

require './php-sdk-master/src/Ctct/autoload.php';
use Ctct\ConstantContact;
use Ctct\Components\Contacts\ContactList;
use Ctct\Components\Contacts\Contact;

$ConstantContact = new ConstantContact($apikey);

if ($sEmail != "") { // only process if we have an actual e-mail address
    $search = $ConstantContact->getContactByEmail($apitoken, $sEmail); // error caused by this line

Can't add named custom field

I have a custom field in my account called "comment" however when I try to create a new contact like this:

$contact = new Contact();
$contact->addEmail($email);
$contact->addList($list);
$contact->first_name = $first_name;
$contact->last_name  = $last_name;
$contact->custom_fields = array(array('name' => 'comment', 'value' => $comment));

$cc->addContact(CC_TOKEN, $contact);

I get the following error:

array (size=1)
  0 => 
    array (size=2)
      'error_key' => string 'json.regex.mismatch.custom_fields' (length=33)
      'error_message' => string '#/custom_fields/0/name: This attribute value must be of the format 'CustomFieldNN'' (length=82)

It looks like the API expects the custom field name to be "CustomFieldNN" and it looks like my "comment" field is getting assigned as "CustomField0" but even if I change my code to:

$contact->custom_fields = array(array('name' => 'comment', 'value' => $comment));

I still get the same error, is it not possible to add/update named custom fields?

Noob support?

I integrated the addOrUpdateContact.php into my Wordpress as a page template. Now I get sitename/new-template-name/addOrUpdateContact.php - page not found...

I know... I'm dumb with this stuff but I was able to atleast get the mage and content to show up but the submit will not work because of this... Help?

/account/info

There does not seem to be a method in the SDK for retrieving account information associated with an access token. However, this information is accessible via the API's '/account/info' endpoint. Should I submit a pull request or is there some method I haven't noticed?

File retrieval endpoint

I can't seem to find any method for retrieving export files via the v2 /activities/<activity_id> endpoint (after receiving an activity id from addExportContactsActivity()). Am I missing something/Is there a best practice for retrieving these files through the SDK?

Ctct\ConstantContact is getting too unwieldy

Ctct\ContantContact is too large, and is not scalable going forward. I have been working with GuzzlePHP (http://guzzlephp.org) in hopes to move to that framework. Unfortunately due to guzzle/guzzle#398 I have been unable to complete this work.

At this point the GuzzlePHP bug needs to be resolved, or I will trim down the ConstantContact class into being a factory for the underlying services/clients.

Ctct\Components\Activities\AddContacts does not take passed column_names

Ctct\Components\Activities\AddContacts($contacts, $lists, $columnNames) asks for $columnNames as an optional parameter. If $columnNames is blank, the function auto-calculates the column_names. However, if $columnNames is passed, nothing happens; it doesn't set AddContacts->column_names, it does nothing.

As a result, if I don't want the columns auto-calculated, I need to pass column_names as the third parameter AND then do a call after instantiation of the class to set AddContacts->column_names.

Path to autoload

I'm trying to integrate this into a wordpress theme. Currently I have the folder "src" in the root of the site's theme (/wp-content/themes/dailey-method/src...).

Here is the email form code that calls the autoload.php file:

<?php
// require the autoloader
require_once  '/_main_site/wp-content/themes/dailey-method/src/Ctct/autoload.php';

use Ctct\ConstantContact;
use Ctct\Components\Contacts\Contact;
use Ctct\Components\Contacts\ContactList;
use Ctct\Components\Contacts\EmailAddress;
use Ctct\Exceptions\CtctException;

// Enter your Constant Contact APIKEY and ACCESS_TOKEN
    // I've XXX'd out the keys and tokens, but they are correct on the live site.
define("APIKEY", "xxxx");
define("ACCESS_TOKEN", "xxxx");

$cc = new ConstantContact(APIKEY);

// attempt to fetch lists in the account, catching any exceptions and printing the errors to screen
try {
    $lists = $cc->getLists(ACCESS_TOKEN);
} catch (CtctException $ex) {
    foreach ($ex->getErrors() as $error) {
        print_r($error);
    }
}

// check if the form was submitted
if (isset($_POST['email']) && strlen($_POST['email']) > 1) {
    $action = "Getting Contact By Email Address";
    try {
        // check to see if a contact with the email addess already exists in the account
        $response = $cc->getContactByEmail(ACCESS_TOKEN, $_POST['email']);

        // create a new contact if one does not exist
        if (empty($response->results)) {
            $action = "Creating Contact";

            $contact = new Contact();
            $contact->addEmail($_POST['email']);
            $contact->addList($_POST['list']);
            $contact->first_name = $_POST['first_name'];
            $contact->last_name = $_POST['last_name'];

            /*
             * The third parameter of addContact defaults to false, but if this were set to true it would tell Constant
             * Contact that this action is being performed by the contact themselves, and gives the ability to
             * opt contacts back in and trigger Welcome/Change-of-interest emails.
             *
             * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in
             */
            $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, false);

            // update the existing contact if address already existed
        } else {
            $action = "Updating Contact";

            $contact = $response->results[0];
            $contact->addList($_POST['list']);
            $contact->first_name = $_POST['first_name'];
            $contact->last_name = $_POST['last_name'];

            /*
             * The third parameter of updateContact defaults to false, but if this were set to true it would tell
             * Constant Contact that this action is being performed by the contact themselves, and gives the ability to
             * opt contacts back in and trigger Welcome/Change-of-interest emails.
             *
             * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in
             */
            $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact, false);
        }

        // catch any exceptions thrown during the process and print the errors to screen
    } catch (CtctException $ex) {
        echo '<span class="label label-important">Error ' . $action . '</span>';
        echo '<div class="container alert-error"><pre class="failure-pre">';
        print_r($ex->getErrors());
        echo '</pre></div>';
        die();
    }
}
?>

I have confirmed that autoload.php is in the right place:
http://www.thedaileymethod.com/_main_site/wp-content/themes/dailey-method/src/Ctct/autoload.php

But the script dies. I may be doing something wrong, but there isn't any documentation with integrating this with a Wordpress theme that I can find, so any help would be appreciated.

problem with php older version

In one of my existing project i m using PHP version 5.3 but the constantcontact/php-sdk requires 5.4+ but i need to integrate this constantcontact service in a subscribe form. when someone subscribe our site i want to add the email address into constantcontact contact list. Can anybody help me?

create campagin throwing http.status.bad_request error

i am trying to use this sdk following the examples downloaded with sdk. insertion of contact example is working fine
but when i am trying to use create campaign example it is throwing the below error..
Array
(
[0] => Array
(
[error_key] => http.status.bad_request
[error_message] => Please enter an address
)

)
every required thing i am posting but still this error showing cant figure out it any help will be higly appreciated..

Error creating ContactList

When trying to create a new contact list, I get the following error:
PHP Fatal error: Class 'ContactList' not found

The code being used:

require './php-sdk-master/src/Ctct/autoload.php';
use Ctct\ConstantContact;

$apikey = 
$apitoken = 

$ConstantContact = new ConstantContact($apikey);
$lists = $ConstantContact->getLists($apitoken);

if ($cc_seminar_list_id == -1) {
    // Main list not found, create it.
        $newList = new ContactList();
        $newList->name = $sListName;
        $list = $ConstantContact->addList($apitoken, $newList);
        $cc_seminar_list_id = $list->id;
    }

 if ($cc_seminar_confirmation_list_id == -1) {
    // Confirmations list not found, create it.
        $newList = new ContactList();
        $newList->name = $sConfirmationListName;
        $list = $ConstantContact->addList($apitoken, $newList);
        $cc_seminar_list_id = $list->id;
    }

Both of these create list sections fail (code snipped to show relevant sections). Is there something I'm missing? (Also, apologies if this is not the proper forum to ask for help! Please direct me if so!)

Issue with Creating a New Contact List - addList() function

Hi,
We are using the PHP SDK provided for creating a new contact list but are facing problems in that. The values are getting submitted and created on the ConstantContact server but there is no reply that we receive and so we cannot find out if it is successful or not and a blank page is show. Here is the code that we use ...

$ccListOBJ=new ConstantContact($_REQUEST['API_KEY']);

$access_token=$_REQUEST['access_token'];

$listObj = new ContactList();
$listObj->name = $_REQUEST['txtListName'];
$listObj->status = "ACTIVE";
$returnListVal=$ccListOBJ->addList($access_token,$listObj);

And if we try to print / echo $returnListVistVal, then there is a error show which is ...
"Catchable fatal error: Object of class Ctct\Components\Contacts\ContactList could not be converted to string in"

Please let me know if I am doing something wrong or is anything missing.

Thanks
Inwinder

Expected params and documentation

I've built out my integration with constant contact, and after digging through some things, I have a couple suggestions or points of confusion to bring up.

It's difficult to tell which objects are accepted by some factory methods or constructor params without looking at the code itself. Most arguments are just an array (which is nice for flexibility), but it's not documented what is expected in those arrays. For example, in Contact::create(), the email_addresses property is expected to be an array of props to pass to EmailAddress::create(). That's not obvious, since when you look at the documentation for the email_addresses property, it's expecting an array of EmailAddresses.

Also some classes don't have a factory method, leading to further digging through those classes to find what the constructor is expecting (AddContacts as an example).

I think all is well in the way it's designed but it just took a bit to dig through each class and find out how each property is used on factory methods and constructors.

I'm happy to add things to this. Do you accept pull requests?

json.field.lists.value.invalid

$action = "Creating Contact";
$contact = new Contact();
$contact->addEmail('[email protected]'); //hgere
$contact->addList('valuelistname');
$returnContact = $cc->addContact(ACCESS_TOKEN, $contact, true);

I am getting error:
[error_key] => json.field.lists.value.invalid
[error_message] => The contact list xxxx does not exist.

when i debugged more and echo'ed request, i see

,"lists":[{"id":"xxxx","name":null,"status":null,"contact_count":null}],

Any idea whats really causing?

Why?

Why is this api so complicated? Is it necessary for devs to be able to manipulate your entire data model from a remote website? Why has it changed so drastically form version one to version two? Why does it say in the Contact object that the RENAMED property of email_addresses from emailAddress should be an array, and the API gives me this error [ #/email_addresses/0: Value is of a disallowed type. Allowed types are: Object. ] when I submit an add request?

Unexpected Exception - And getErrors() returns correct JSON content

Hello guys,
I'm having a huge problem here. My api key and access token are all set up and working on the website (testing requests) and it's also authenticating on the php lib.

The problem is that any request I made result in a exception with no error message. The error message is actually the content I was expecting to get from the API call.

Here is an example:

public function add_email($email) {
$response = $this->cc->getContactByEmail($this->ACCESS_TOKEN, $email);

if(empty($response->results)) {
  $contact = new Contact();
  $contact->addEmail($email);
  $contact->addList($this->main_list);
  $cc->addContact($this->ACCESS_TOKEN, $contact, true);

  return true;
}

return false;

}

Is throwing this (uncaught by purpose)

Fatal error: Uncaught exception 'Ctct\Exceptions\CtctException' with message '{"meta":{"pagination":{}},"results":[]}' in /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php:94 Stack trace: #0 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php(22): Ctct\Util\RestClient::httpRequest('https://api.con...', 'GET', Array) #1 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Services/ContactService.php(28): Ctct\Util\RestClient->get('https://api.con...', Array) #2 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/ConstantContact.php(143): Ctct\Services\ContactService->getContacts('9c91e23c-4c19-4...', Array) #3 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/constantcontact.php(30): Ctct\ConstantContact->getContactByEmail('9c91e23c-4c19-4...', 'jpaulo.motta@gm...') #4 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/page-article-download.php(38): TbtConstantContact->add_email('j in /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php on line 94

The expected result was this

{"meta":{"pagination":{}},"results":[]}

When I catch the exception in other part of the code when getting a contact list, I'm still having the same error... but the Exception Message actually contains all the ContactLists it was supposed to return:

private function get_main_list() {
    try {
      $lists = $this->cc->getLists($this->ACCESS_TOKEN);

      foreach ($lists as $list) {
        if(strcasecmp($list->name, 'General Interest') && $list->status === 'ACTIVE') {
          return $list;
        }
      }
    } catch(CtctException $ex) {
      print("Exception on list ");
      print_r($ex->getErrors());
    }

  }

Outputs:

Exception on list Array ( [0] => Array ( [id] => 1982645563 [name] => Just Liz [status] => HIDDEN [created_date] => 2014-05-24T20:38:28.000Z [modified_date] => 2014-05-24T16:38:28.000-04:00 [contact_count] => 1 ) [1] => Array ( [id] => 1 [name] => General Interest [status] => ACTIVE [created_date] => 2011-01-27T02:02:06.000Z [modified_date] => 2013-07-22T04:07:46.000-04:00 [contact_count] => 203 ) [2] => Array ( [id] => 1309207977 [name] => Communication Series [status] => HIDDEN [created_date] => 2014-04-06T13:25:35.000Z [modified_date] => 2014-04-06T09:25:51.000-04:00 [contact_count] => 19 ) [3] => Array ( [id] => 1731330293 [name] => Windsor Workshop Autoresponder [status] => HIDDEN [created_date] => 2014-09-24T16:15:25.000Z [modified_date] => 2014-09-24T12:15:25.000-04:00 [contact_count] => 32 ) ) 

I would appreciate any help since I believe this is an issue with this library.

Exception when using getBounces

This is very likely due to some copy/paste. The contacts variables has nothing to do here...

$bounces = array();
foreach ($body['results'] as $bounceActivity) {
$contacts[] = BounceActivity::create($bounceActivity);
}
return new ResultSet($contacts, $body['meta']);

Fatal Error

Fatal Error Error: Class 'GuzzleHttp\Client' not found in [/Library/WebServer/Documents/crm/vendor/constantcontact/constantcontact/src/Ctct/Services/BaseService.php, line 51]

What do I need to do to have it recognize the class?

I ran composer install and update
I am using cake as my framework

ACTION_BY_VISITOR is not reliably working

Hi - seems like ACTION_BY_VISITOR flag (true) in the addContact() and updateContact() methods is not reliably working. Just tried adding a new contact (not in the list or any list per the account management portal) via a form on my site and the out put was:

Ctct\Components\Contacts\Contact Object
(
[id] => 1258331846
[status] => ACTIVE
[first_name] => John
[middle_name] => 
[last_name] => Smith
[confirmed] => 
[source] => API
[email_addresses] => Array
    (
        [0] => Ctct\Components\Contacts\EmailAddress Object
            (
                [id] => 7b68ea60-2e67-11e4-b594-d4ae527b895a
                [status] => ACTIVE
                [confirm_status] => NO_CONFIRMATION_REQUIRED
                [opt_in_source] => ACTION_BY_VISITOR
                [opt_in_date] => 2014-08-28T03:57:51.000Z
                [opt_out_date] => 
                [email_address] => [email protected]
            )

    )

[prefix_name] => 
[job_title] => 
[addresses] => Array
    (
    )

[notes] => Array
    (
    )

[company_name] => 
[home_phone] => 
[work_phone] => 
[cell_phone] => 
[fax] => 
[custom_fields] => Array
    (
    )

[lists] => Array
    (
        [0] => Ctct\Components\Contacts\ContactList Object
            (
                [id] => 1
                [name] => 
                [status] => ACTIVE
                [contact_count] => 
            )

    )

[source_details] => Website Contact Sign-Up
)

I'm using the code straight out of the example. Notice I'm setting the third parameter to true.

    // check to see if a contact with the email addess already exists in the account
    $response = $cc->getContactByEmail(ACCESS_TOKEN, $_POST['email']);

    // create a new contact if one does not exist
    if (empty($response->results)) {
        $action = "Creating Contact";

        $contact = new Contact();
        $contact->addEmail($_POST['email']);
        $contact->addList($_POST['list']);
        $contact->first_name = $_POST['fname'];
        $contact->last_name = $_POST['lname'];

        /*
         * The third parameter of addContact defaults to false, but if this were set to true it would tell Constant
         * Contact that this action is being performed by the contact themselves, and gives the ability to
         * opt contacts back in and trigger Welcome/Change-of-interest emails.
         *
         * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in
         */
        $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, true);

        // update the existing contact if address already existed
    } 

Any thoughts?

An iterator for paginated ResultSet

How cool it would be to write this:

$service = new \Ctct\Services\ListService($apiKey);
$resultSet = $service->getContactsFromList($accessToken, $listId, $params);
$iterator = new \Ctct\Util\ResultSetIterator($resultSet);
foreach ($iterator as $contact) {
  print "First name: " . $contact->first_name . "<br>";
}

The iterator would traverse all items, fetching remaining results via the "next" parameter in the background if needed.

This should work for all ResultSets, not only for sets of Contacts.

What do you think? Should be easy to implement. Do you want me to?

The capitalization of references to CTCTExceptiona are inconsistent

Because the capitalization of references to CTCTExceptiona are inconsistent, a php file not found error is generated on certain exceptions.

Below are the inconsistencies:
src\Ctct\Exceptions\CtctException.php class CtctException extends Exception
src\Ctct\Util\RestClient.php use Ctct\Exceptions\CTCTException;

capture

Custom Fields

Does the API have support for custom fields? I couldn't find an example us pulling the list of fields, and adding a contact with the custom fields.

Add Metering

I have modified the SDK to add call metering, to conform with QPS limits of the API. Is there any interest in me providing those changes?

Relax Guzzle Constraint

Requiring a singular dependency version in Composer is inflexible and should be avoided. As a semver-compliant library Guzzle will not make breaking API changes within a major version. The current dependency definition makes the SDK incompatible with other libraries that require newer versions of Guzzle. Use wildcards or carets to allow for a wider array of dependency versions.

sync from constant contact to local database

hi,it's me again.I would like to ask if there are any examples about sync contact list with local database,check the contat status and then update the local database.And is it a nice way if I iterate all contacts and check their status,if their status was removed or optout,then the database will be updated.Please give suggestions if it's not a good option.Thanks a lot.

Class not loaded: Ctct\ConstantContactClass in magento onepage checkout

I have integrated constant contact into our magento site. Its working fine in customer account creation and newsletter signup form.
But in onepage checkout billing information block which subscription checkbox, Its not working as expected.
After enter Billing information details , and click continue button, In ajax response, I got an error like

Class not loaded: Ctct\ConstantContactClass not loaded: Ctct\Services\ContactServiceClass not loaded : Ctct\Services\BaseServiceClass not loaded: Ctct\Util\RestClientClass not loaded: Ctct\Util\RestClientInterfaceClass not loaded: Ctct\Services\EmailMarketingServiceClass not loaded: Ctct\Services\ActivityServiceClass not loaded: Ctct\Services\CampaignTrackingServiceClass not loaded: Ctct\Services\ContactTrackingServiceClass not loaded: Ctct\Services\CampaignScheduleServiceClass not loaded: Ctct\Services\ListServiceClass not loaded: Ctct\Services\AccountServiceClass not loaded: Ctct\Util\ConfigClass not loaded: Ctct\Util\CurlResponseClass not loaded: Ctct\Components\Contacts\ContactClass not loaded: Ctct\Components\ComponentClass not loaded : Ctct\Components\Contacts\EmailAddressClass not loaded: Ctct\Components\ResultSetClass not loaded: Ctct \Components\Contacts\ContactListClass not loaded: Ctct\Exceptions\CtctException

Email has registered to constant contact,But Can't able to move shipping information block.
Have any idea, how to resolve this issue!
I'm sure, Listed class files were called fine!

Can't include constant contact class file

Been working on this issue for the last couple of hours. When using this code that you've provided, using the appropriate path to the file on my server:

require '/src/Ctct/autoload.php'

Seems to do nothing. As far as I can tell the class ConstantContact is not available for use.

Second, when I manually include the Constant Contact class file I just run into errors. It seems that all of the "use" statements cause some serious errors. I'm not entirely sure how to include any of the necessary files as it seems all of the php files contain at least one use statement in it.

If I manually include ConstantContact.php and then re-try to submit a request, I receive an error:
Fatal error</b>: Class 'ConstantContact' not found in <b>/nas/wp/www/cluster-1784/site/wp-content/themes/site/functions.php</b> on line <b>592</b><br />.

Not sure what's going on, but it seems a little unnecessarily difficult just to include the main class file.

The instructions in the readme file of this repo don't seem to work, and my server meets all minimum requirements.

I'm running PHP v5.3.2 and CURL is enabled, not sure if that makes a difference.

Thanks,
Evan

Set additional contact fields via the SDK/API

Is it possible to set additional contact fields via the SDK? such as; social accounts, and websites?

Currently you can set these per contact once logged into constant contact. I've looked at the various responses from: https://constantcontact.mashery.com/io-docs Account Services Method, but I do not see a way to retrieve or set the fields for social accounts.

For example, I've created a contact via the cc admin that has; Website (work), Website (blog), Additional (twitter), and Additional (LinkedIn). These do not seem to be accessible via the API and/or the SDK.

Having Trouble with addOrUpdateContact.php

Hello, I haven't changed anything except for the APIKEY and ACCESS_TOKEN environmental variables, and I'm getting this error message:

Catchable fatal error: Argument 1 passed to Ctct\Exceptions\CtctException::setErrors() must be of the type array, string given, called in /srv/http/php-sdk/src/Ctct/Util/RestClient.php on line 93 and defined in /srv/http/php-sdk/src/Ctct/Exceptions/CtctException.php on line 19

I'm wondering about the reason for this.

AddContacts Activity object does not allow for explicitly set column names

In the constructor of the AddContacts Activity class, the third parameter is an array of column names and it is optional. On line 34, there is an empty() check to determine whether this array was provided or not. If the array is not provided, the subsequent block will determine the column names automatically.

However, when this parameter is provided, the resulting AddContacts instance has an empty column_names array and the contact is created with email alone.

This is confusing behavior, so the solutions are either to remove the optional columnNames parameter from AddContacts entirely, or to allow the user to pass in column names and then actually use them. I can make a PR if I have some time, and the first solution would obviously be faster to implement.

Allow multiple Contact Notes via the API

The web interface allows for multiple Contact Notes, but the API is limited to add/updating 1 note per Contact: #/notes: 2 items were contained, but the maximum number of items allowed is 1.

Please allow multiple notes!

Fatal error on ContactService->getContacts() when request throws an error

Last night, when the Mashery API was down, the result of the getContacts REST request was an error.

The ContactService->getContacts() method decodes the JSON and assumes a successful request and that $body['results'] and $body['meta'] exist. This results in a fatal error instead of an exception.

See here for what I mean:
https://github.com/constantcontact/php-sdk/blob/development/src/Ctct/Services/ContactService.php#L29-L34

This is also an issue for other services, such as the Email Marketing Service: https://github.com/constantcontact/php-sdk/blob/development/src/Ctct/Services/EmailMarketingService.php#L41-L46

There should be better handling when the JSON response is an error.

ArchiveURL, Archivestatus still in SDK Test Docs

A developer brought up the issue in this community post:
https://community.constantcontact.com/t5/Developer-Support-ask-questions/ArchiveURL-missing-from-Campaign-details-in-API-v2/m-p/229439#M9145

They always return null, but it's raising questions with developers, causing confusion, hesitation.

We have by design removed support for email campaign archive_url and archive_status in AppConnect, but the functions still exist in one of our test documentation

https://github.com/constantcontact/php-sdk/blob/cbfbedb6eb6e068d3d8c35ebb8e8c51ac7487bc5/test/Json/Campaigns/get_campaign.json

Using HTTPS in REDIRECT_URI causes invalid redirect mismatch

This works:
define("REDIRECT_URI", "http://example.com/constant-contact/?user=" . $user . "&optin-action=build&optin-type=" . $type . "&optin-config=true&email-id=$uniqid&label=$label");

This causes the error:
define("REDIRECT_URI", "https://example.com/constant-contact/?user=" . $user . "&optin-action=build&optin-type=" . $type . "&optin-config=true&email-id=$uniqid&label=$label");

Any reason why? The only thing I changed (literally) is http:// to https://.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.