04. Training – Part 1 [10:50]

**This product has been discontinued as of May 10, 2016.**

Description: This video explains the following:

  1. The difference between a contact and a list in Constant Contact.
  2. How to add, edit or remove a contact.
  3. How to add a new list.


In this video we’re going to discuss the integration steps for these following actions:

  • How to authenticate with Constant Contact
  • How to add and update contacts from FileMaker Pro to Constant Contact
  • How to remove or opt out contacts
  • How to add and remove lists from FileMaker Pro to Constant Contact

0:38 Let’s navigate to our demo file and here I’m just going to enter my credentials; we’ll begin with the authentication. And what I’ll do before I call the authenticate function is we’ll actually go ahead and open Script Debugger and we’ll put the Data Viewer back to back here so we can watch what’s happening, and let’s just minimize these here so it’s a little more user friendly in our screen. And I’ll go ahead and select the Authenticate button, there we go, and we’re going to perform the script called “Authenticate”, now you do need to authenticate once per FileMaker session. Basically what we’re doing here at the beginning of our script is just performing some plug-in checker scripts, deleting all our records so we can start fresh since this is a demo file.  So I’m going to put our marker all the way down to the first plug-in function call which is “PCXP_Authenticate”, just going to play through right to this function, and as you can see you can authenticate using the authenticate function, passing the user name and the password to your Constant Contact account. And authenticating really is that simple; once you’ve successfully authenticated you will get a result of “0” here.

2:01 The next script we’re going to look at is how to actually add or update your contacts. So what we’re going to do instead of opening Debugger and walking through all of the script steps; let’s just go right into our scripts here, and we’ll just pop open the script called “Add New Contact”; and we’ll take a look at this script first. So the first thing we’re doing in all of our demo files are just some basic validation and plug-in checker scripts. Then the very first plug-in function call is right here, it’s called “PCXP_NewContact” in order to create an new contact you pass the email address in the first parameter here, and then you pass the List ID that the contact is going to belong to, and these are two required parameters. After you call the new contact function and pass the email address and list ID, then you can begin to set all of your contact fields such as, “First Name”, “Middle Name”, “Last Name” and any additional fields that you would like to set. This is accomplished using the “SetContactField” function here. And lastly what we’re going to do is we’re going to save the contact using the PCXP_SaveContact function right here. Of course we have our error trapping just to make sure that everything happens successfully. And at the very end, not required, but we do recommend it and do it in our demo file, is we actually get some of the contact fields such as the “InsertTime” as well as the “ContactList” here. So we’re just retrieving those and populating them back in our demo file and storing them in FileMaker for later use. And if you had any questions as to the exact field names here that you needed to pass in the “SetContactField” function, simply navigate to our functions guide, and all that you would do is go to the Table of Contents here, and at the very end of the Functions Guide you’ll see an “Available Constant Contact Fields” section.  And if we go into there you can see these are all of the available fields that you would pass to the “SetContactField” function, and so that’s where those actual field names are coming from. So for reference here, this is going to be a handy guide to use. Let’s navigate back to our FileMaker demo file, and adding a new contact really is that simple. So again, the steps are, “New Contact”, “SetContactField”, set all of your fields, and then “SaveContact”.  Of course proper error trapping and then get any contact fields that you want to bring back in to FileMaker.

4:34 Now updating a contact is very similar, and lets go ahead and look at the “Update Contact” script. Instead of calling the “NewContact” function you’re going to call the “OpenContact” function. When you call the “OpenContact” function you’re actually going to pass the ID of the contact or the email address of the contact, either one are accepted in this parameter, and of course we have error trapping. Then we are retrieving the Contact List by calling the “GetContactField” function, not required; just something we’re doing in the demo file, but more importantly in order to update all of your fields, you’re going to call the “SetContactField” to set all of your contact fields, and lastly call the “SaveContact” function to actually save the contact. And that is basically how you update a contact. So again you call the “OpenContact”, “SetContactField”, and then “SaveContact”; pretty simple here.

5:30 Now we’re going to move on to remove or opt out a contact. So here at the bottom we have two scripts called “Opt Out Contact” and “Remove From List” if we go to the “Opt Out contact” script we can see the very first plug-in function call begins with the call to “OpenContact”. And again you’re going to pass the email address or contact ID; we do some error trapping here. Then we actually do get the status by calling the “GetContactField” and specifying the status field that we want to get, we actually want to make sure it doesn’t equal “Do Not Mail”, we show the dialog here and then we call the actual “OptOutContact” function, and this function opts the open contact out in Constant Contact. And lastly we do need to call the “SaveContact” function in order to save that opt out option. And of course we have our error trapping, and then we do bring in a few of the fields by calling the “GetContact” field. So just like you set a contact field, you can call the “GetContactField” to go the reverse direction and that’s further explained in the developer’s guide. And that’s it to opt out a contact. Very similar to remove a contact from the list, and again here we are calling the “OpenContact” function, trapping for errors, and then calling the “PCXP_RemoveFromList” function. And in the “RemoveFromList” function we are passing the List ID that we want to remove the open contact from, calling the “SaveContact” function to save the changes, we have some error trapping for good measure.  And those are the simple function calls in order to remove a contact from your list.

7:09 Lastly we wanted to talk about how to add and remove lists. Now add and remove lists are very similar to adding and removing contacts. Let’s go ahead and take a look at those scripts here, we have an “Add New List” and a “Delete List” script. We will look at the “Add New List” script first.  Here we’re going to go right down to the plug-in function calls, so the first plug-in function call we have  is the “PCXP_NewList” function, and the “NewList” function we have a parameter of “Name”. So in order to create a new list you do have to give it a unique name such as Sales, or Support, or Monthly Flyer, or whatever you want the name of your list to be, we pass that to the parameter here, and then we simply call “SaveList” and trap for errors. And in our demo file we do also call the “GetListField” function at the end in order to bring in some of the list fields. And again in order to find out all of the available field names for Lists you would simply go to our Functions Guide and at the end here, we have an “Available List Fields” and this tells you all of the available fields right here, the method if you can get or set them, and acceptable values and notes and so forth. So let’s go back into FileMaker close the “Add New List”.

8:26 And let’s go in to the “Delete List” function. In order to delete a list it’s quite simple, except instead of opening a list all you do is immediately call, let’s go down to the first plug-in function here which is “PCXP_DeleteList” and all you’re going to do is call the “DeleteList” function, you’re going to pass the List ID of the list that you want to delete, and trap for errors, and that’s it. It’s really that simple, with how you add a contact, add a list, and if you want to see these in action, let’s actually go to the Lists tab. And what I’ll do is open up Debugger, go ahead and select “New List” here, and let’s open the Data Viewer side by side. And why don’t we skip over all of our authentication and checking here and we’ll just play right down to this point. And then what we’ll do is we’ll just step right in to this script, and I’m going to go ahead and call this list “Test List A”. And as you can see we’re just calling the “NewList” function here, passing the list name “Test List A” to that function, saving that list, checking for errors, and then we go back and we get the fields for the list once the list has been put into Constant Contact. There are fields such as “OptInDefault” which by default is going to have a value of “false” unless you specify that field, we’re going to grab the short name, the sort order, check for errors for good measure. And that’s it – adding, updating, removing contacts and lists from FileMaker Pro to Constant Contact is really that simple.

10:12 Now we can begin to integrate the plug-in into your FileMaker solution rather than the demo file. Please make sure you utilize all available tools we provide such as additional training videos, documentation, and reverse engineer our demo file. Please contact us via email, phone, or browse our forum if you have any additional questions. We look forward to hearing from you and assisting you with email marketing and connecting FileMaker Pro and Constant Contact.