cancel
Showing results for 
Search instead for 
Did you mean: 

Constant Contact Integration

SOLVED
Occasional Contributor

Constant Contact Integration

 

I have been using the ConstantContact.dll to integrate Constant Contact into my asp.net program. This has been working fine for past few years. And now suddenly I am getting an error (400: Bad request) when I try to add a contact using the same dll.

I have made no change in code. I am trying to find help on your site for the past 2 weeks and I cant seem to find a proper place where there is any reference to this dll that Iam using. All support documents show the RestApi and the XML post, which I am not using at all.

 

Basically the following line of code is returning me an error:

 ConstantContactUtility.Utility.CreateNewContact(AuthenticationData, contact);

 I can provide more code details if required.

 

Can someone pls help me urgently here, as we have already lost several contacts over the past few weeks.

 

Thanks!

9 REPLIES 9
CTCT Employee

Re: Constant Contact Integration

Hi, 

 

Sorry for the trouble trying to find the right place for support.  Any developer/API inquiries should come to developer.constantcontact.com, or you can email us directly at webservices@constantcontact.com.

 

It sounds like you are using our .NET wrapper library, which I have linked to here.  You can try replacing your wrapper files with the ones there, to see if we made any updates on our side to account for what you are running into.  Is there any way you could post here (removing your email address and username from the XML) or send me the XML that your code is sending to us when adding the contact?  I can take a look at the XML to determine the reason for the 400 error (400's are almost always caused by something missing or invalid in the XML that is sent to us).  I'm not aware of what would have changed on our side recently to cause this, but looking at the XML will likely shed light on the situation.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Contributor

Re: Constant Contact Integration

Hi,

 

Many thanx for your response.

 

Matter of fact, we do not use any XML.  As I said we use the ConstantContactUtility.dll , which gives us the Contact object.

We fill the data into the properties of this Contact object. And then we invoke the CreateNewContact method exposed by the dll, passing the Contact object in it.

 

Here's the code snippet...

--------------------------------------------------------------------------------------------------------
Contact contact = GetContactInformation(myUser.users_id);
ConstantContactUtility.Utility.CreateNewContact(AuthenticationData, contact);


private Contact GetContactInformation(string xUserID)
    {
        Contact contact = new Contact();

        #region contact information
        contact.EmailAddress = Server.HtmlEncode(txtEmail.Text.Trim());
        contact.FirstName = Server.HtmlEncode(txtFirstName.Text.Trim());
        contact.LastName = Server.HtmlEncode(txtLastName.Text.Trim());
        contact.HomePhone = Server.HtmlEncode(txtPhone.Text.Trim());
        contact.City = Server.HtmlEncode(txtCity.Text.Trim());
        contact.PostalCode = Server.HtmlEncode(txtZip.Text.Trim());
        contact.CustomField1 = xUserID;
        #endregion

        #region contact list in which contact would go
        // retrieve from web.config
        ContactOptInList contactOptInList = new ContactOptInList();
        contactOptInList.ContactList = new ContactList(ConfigurationManager.AppSettings["listID"]);
        contact.ContactLists.Add(contactOptInList);
        #endregion
        return contact;
    }

----------------------------------------------------------------------------------------------------

 

FYI:

Username = _____

List Id = 3

 

I hope the above helps, I await your response.

 

Thanks!

CTCT Employee

Re: Constant Contact Integration

Hi,

 

Could you try adding a trim to the state code and country code values?  That has been an issue in the past.

 

Your program is ultimately sending us XML, as that is the only way our API accepts data--the code just builds that XML for you, so you weren't aware that was what it was doing.  If you can isolate the XML that your program is ultimately sending us, it would help us troubleshoot on our end, but we are looking into this as well to see if we can determine what the issue is.  

 

The error you are getting indicates that our system is finding some problem with the XML you send to us, so looking at your XML (with your username and email removed for security) would be most helpful. Fiddler is a program that can tell you what your http requests send and what is returned, or drilling into Visual Studio (if that's what you're using) can also show you the XML you send.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Contributor

Re: Constant Contact Integration

 

SInce we just have the dll and not the source code, VS cant show us the step in it that prepares the xml.

 

Today I tried to connect to constantcontact with other test credentials that I have, instead of the live account used ont he cupidscoach.com site. 

And the same code of CReateContact seemed to work perfectly fine with these. For your reference the test credentials that work are:
username ="______"

listId="2"

 

So obviously the XML wont be incorrect, since it works for a certain account.

Is it possible that the LIST under the cupidscoach account has some issues, or is it possible that account gets expired or something? The live account of cupidscoach has...

username="______"

listId = "3"

 

Thankyou

CTCT Employee

Re: Constant Contact Integration

Hi,

 

For the username that is having issues (the second one your referenced), there is no list 3 (it must have been deleted somewhere along the way in that account).  That is why you are getting an error--the list ID you reference has to exist in the account.

 

I am going to redact the usernames you referenced in your post for your security.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Contributor

Re: Constant Contact Integration

 

How can I find out the ListId for a list on the Admin console ?

 

thx

Anjali

CTCT Employee

Re: Constant Contact Integration

Hi Anjali,

 

 

You can view the list ID through the console by clicking on any list name in the Contacts tab of your account.  The resulting URL will look something like this:

 

https://ui.constantcontact.com/rnavmap/em/contacts/browse?listId=11&srchwithinlst=true

 

You can see above that the List ID is 11.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Contributor

Re: Constant Contact Integration

Hi Shannon,

 

Thnx much for your constant help!

Some administrative person had deleted the list I was using. Client has created a new list and I have its ID from the url, as mentioned by you. Registration now works fine. Thankyou very much for your continuous support !!

(I wish the constantcontact service could give a more relavant message in response to this kind of an error!)

 

Regards,

Anjali

Highlighted
CTCT Employee

Re: Constant Contact Integration

Hi Anjali,

 

You're quite welcome.  Just FYI, we are working on better error messaging in the future!

 

Best Regards,

Shannon W.

API Support Specialist