Posts Tagged ‘API’

The ABCs of APIs and ERP

Enterprise Resource Planning (ERP) systems are the lifeblood of many companies. Since the Gartner Group first coined the term in the 1990s, ERP has evolved from its base of managing manufacturing operations to business processes in general, ranging from procurement and supply chain management to areas such as human resources, sales and customer service.

Application programming interfaces, or APIs for short, play a central role in ERP systems nowadays. In this article, we take a look at how API tools – including ours and others – extend the power of your business automation platforms.

What APIs do for you

If you have a satellite radio in your car, you know that it serves as a portal to hundreds of stations, curated by a service provider. In much the same way, APIs serve as a portal between your ERP system and external applications and data resources, particularly cloud-based ones.

In the case of ERP systems, API interfaces play a number of important roles: according to this article, common applications include things like real-time dashboard visualization of ERP data, E-commerce capabilities, mobile applications, and much more.

As the ERP market itself has continued to expand, with a projected market size of US $47 billion by 2022, major players such as SAP, Epicor, Sage and others have truly become a base for enterprise-wide software capabilities.

All of this happens because of a capability that lies at the core of APIs: the ability to pass data and add capabilities from external applications to your in-house automation platforms. In the process, API tools can save massive amounts of programming, add capabilities that would be impossible for most businesses to develop in-house, and – perhaps most importantly – greatly extend the functionality of your software tools.

An example of APIs and ERP: FastTax

Recently two of our customers implemented our DOTS FastTax sales tax API in their ERP systems, for very different reasons:

  • California-based AdvancedWare Corporation provides E-commerce capabilities for customers who use legacy ERP systems.
    • Accurate tax calculations are central to the service they provide to their clients, and they replaced a previous tax solution for the express purpose of improving their quality and response times. According to AdvancedWare’s President, Michael Serrato, “[Our] motto is delivering exceptional services and software every time, and our level of service is what differentiates us from our competition. Our customers look to AdvancedWare to be their one-stop custom eCommerce platform, and FastTax is an important part of that solution.”
  • Georgia’s TenCate Geosynthetics is the world’s largest provider of geosynthetics and industrial fabrics.
    • In their case, escalating support costs for a legacy tax solution on an aging system led them to try their first API-based interface with a cloud-based solution like FastTax. According to Steve Huster, TenCate’s global IT director, this turned out to be a very painless implementation process: “if there’s a company out there running a legacy technology and they want to take advantage of cloud-based capabilities, there’s no technical reason they shouldn’t pursue it.”

In general, clients turn to API-based products because they need rapid solutions to pressing data quality problems such as improving deliverability, maximizing the ROI of their contact data assets, or increasingly, ensuring compliance with a growing range of consumer data privacy legislation such as the US Telephone Consumer Protection Act (TCPA) or the European Union’s strict new General Data Protection Regulation (GDPR).

Learn more about APIs for your ERP

We are always happy to discuss your specific ERP system needs: contact our friendly and knowledgeable technical team anytime to learn more about adding value to your business automation platform.

What is an API?

API stands for Application Programming Interface. But what does that mean?

Basically, APIs are a way for applications to communicate with each other across the web through specific inputs and outputs. In an abstract way, APIs and webpages have similar functionality. They both take input(s) that get processed on a server, which may or may not involve other APIs or databases, and return data back to the requesting browser.

The difference is that APIs will return data in the form of, typically, XML or JSON with the purpose of being processed behind the scenes, whereas webpages will return data back to the browser and display it in the form of text and images and other familiar webpage components.

With an API, you can build the power of web-based resources – such as expert and proprietary logic coupled with datasets – right into your applications. A programmer can quickly write integration code for a webpage, a desktop application, a script or a phone (or many other devices) that can request information based on a specific set of inputs. Once the application gets the response back it can be processed in several ways, such as formatting and displaying the response back to the screen, or processed with additional logic.

To paint a better picture of how APIs work, let’s use our DOTS Address Validation – US service as an example of a common use case.

Using a data validation API

Consider an organization that is collecting address information on their website in a process where a user signs up for an account. Down the road, this address is going to be used to ship a product or perhaps marketing material to the user. For many reasons, particularly when shipping is involved, it is incredibly important to have the address correct.

In this case, using our address validation API, they will be able to automate the real-time validation of addresses entered in their web form. To start, a developer will add logic to their code that will take the address inputs entered by the user, and package them in a way so they can send that information over to our  Address Validation – US API. Then, in a fraction of a second, we will return the results of their address validation along with other important address data points that the service returns.

Depending on the business need, the developer can take our results, add additional logic and/or formatting, and even display the results back to the user in real-time for correction. Or, if the address does not need any additional intervention, allow the user to continue with the process they were following on the webpage, with the confidence that the address provided is correct.

Benefits of APIs

API’s can be used in countless situations to solve small and large problems, some more technical than others. The concept of APIs espouses one of the core tenets of programming which is code reuse.

For example, if an organization wanted to build their own address validation, it would need to become experts in all things address related. Which we can tell you, is a complicated, unregulated, and deeply detailed subject that requires in-depth knowledge of each country’s postal system, nuances and idiosyncrasies.  You would likely end up focusing far too much time and resources making it work, while being distracted from your core business.

This is a case where build versus buy is not realistic and, as I discuss in another blog, why recreate the wheel? Our APIs allow organizations to focus on what they are experts in while leveraging our decades of expertise in data validation in simple sub-second calls.

In addition, it is our business to stay on top of the ever-changing validation landscape, constantly performing updates and rolling out improvements. These are automatically delivered simply by being connected to our services.

Good documentation = Easy Integration

Although APIs are generally simple to integrate, they should be accompanied by detailed documentation on the available operations, inputs, outputs and responses that can be expected.  For our services, that information can be found in our comprehensive developer guides.

Testing APIs

Taking an API for a test drive is one of the first steps to determining if the service will work for your needs. We make this simple by offering a Free API test key for each of our services and are happy to help with integration and answer any questions.

API Integration: How Much Time to Set Aside

The question of ”how long does it take for someone to integrate your API?’ has come up a lot lately in various situations. In this article, I wanted to paint a better picture of what that looks like.

There are a mix of factors that should be considered for your integration, including available resources, what solution you are plugging the API into, and whether you have someone who can do the work of the integration. For example, where you want to plug in our API will have a direct impact on the resources you are going to need when integrating. Do you need someone who knows Java or .net, or do you need someone familiar with Salesforce or Marketo?

If you need to integrate an API into code, then you or your resources should have at least a familiarity of the programming language currently deployed in your solution. However, if you need to inject our API into a platform such as Salesforce or Marketo, then you may be looking at perhaps a marketing technologist or more admin skill level person that can handle more of a plug and play scenario that involves adjusting settings.

Depending on what you are integrating with, there are three main types of personas you can group people into, each of which require different amounts of time and assistance in getting an integration project done. In any case, however, these people will all need to have a good degree of knowledge about the surrounding process and business rules that will need to be implemented.

Let’s look at each of these three groups:

Group 1: The super knowledgeable

This person has done this before many times over and is going to need little help with the integration. They may just want to look at our development guide so they can see the endpoints they need to hook up to and the format and field names coming back from the web service API. For setting up the call to the API, this person is going to need little more than 20 minutes.

Group 2: Strong coder or strong platform admin

This person doesn’t call APIs that often, but has done it before. In this category the person will be integrating into code, plugging into a platform, or both. They will have a few questions about the API and may request a guide or overview to help them with integrating into a platform. We have materials that will help with both code and plugging into many platforms which they will want to look through. This person is going to need closer to a couple of hours to get our API integrated into their system.

Group 3: Relatively new to coding or platform administration

This person has never really dealt with APIs before. This situation is more of a grey area because it depends on how hands-on the person is. These people will generally need more guidance and may even need professional services to accomplish the job. The time it will take in this category will depend on this person’s inclination to learn something new.

We have many resources to help show someone like this how to integrate our services, and this will make the process much smoother. For example, we have sample code for web forms that can be dropped into several scenarios and can also be repurposed to fit most applications. Someone with very little experience calling web APIs should be able to navigate our documentation and get rolling in a day.

Customizing these estimates to your situation

There will certainly be other groups beyond the categories I have simplified here. So, if you find that you don’t fit into one of these specifically, you can still use them as a guide for evaluating the time it will generally take to integrate our API services. As you can see, the amount of time involved is typically very short.

Another part of the integration, not to be forgotten, is more about implementing your business logic and what you do with your data before you send it to our API for validation, as well as when the results come back.

We can give you recommendations and best practices based on what we have seen in the industry as to how certain situations are typically handled, so you can have a good idea for how to set up your solution. The time it takes to do this end of the implementation is a lot more variable and is based on the complexities of what solution(s) you are trying to achieve. We here to work through the process with you by providing our cutting-edge solutions along with our recommendations.

How we can help

Here is a link to a search of our blogs that will display various documents on integration along with several tutorials. If you can’t find something you need, let us know and we’ll do our best to put it together. Along with this, I have additional links to our developer guides, sample code and quick look-ups. We work to make every integration as smooth as possible and will go a long way to help, including offering our professional services to get you across the finish line. Let us know what we can do to help make your implementation a success.

Service Objects integrations can help improve your contact data quality, help with data validation, and enhance your business operations.

How to Pull and Update in a SQL Database with a DOTS Web Service

The Applications Engineering team at Service Objects prides itself on being integration experts. We are here to assist our clients and prospects in getting the most out of our services. Whether it is dealing with the actual coding, integration, and call to our web services or if it is intelligently dealing with the response from the web service, we’re here to help. Part of that means putting out guides and helpful information for our clients to highlight typical uses cases.

Validate records in a database

A common scenario that our clients run into is the need to clean, validate or scrub a list of records that may be in a database. From this, arises another question of what to do with the validated data afterward. There are a lot of different technology stacks that can be used to do the implementation but in this example, we’ll use SQL Server, C# and the .NET framework.

Connecting and pulling records from a database

There are a few ways to retrieve records from a database and put them back into C#, but arguably one of the easiest ways, in C# and the .NET framework, is through the Entity framework. Adding an entity connection is super simple! The entity framework is a source object relational mapper that allows developers to work with a database while using .NET objects. The steps can vary slightly depending on the type of database you are connecting to. In this example, we’re connecting to a Microsoft SQL Server database, so the connection details and processing may be a bit different if you use another database.

For this example, we’ll create a simple console app. After the project has successfully created, right-click the project, Select Add, then New Item and then select the ADO.NET Entity Data Model item to add the entity connection. Input your specific connection details and add the connection.

Screenshot 1

The database that we’re connecting to in this example has two tables in it. The first holds the input addresses that we will be pulling out to validate against the DOTS Address Validation – US web service. The image on the left (screenshot 2) is the design of our DB and the image on the right (screenshot3) are two address examples that we’ll be validating. One is our office address, and the other is clearly a bad address that will not return validated address information from the service.


Screenshot 2 and 3

We also have a table that will hold some of the validated output information from the validation service. For this example, we’re just using a few fields that are returned: the validated address information that is returned from the service, (Address1, Address2, City, State, Zip) DPV, Corrections, and the error description from the service.

Below is a screenshot of the table design for the output table. But you can use any other fields described in the developer guides.

Screenshot 4

Now that the entity connection is set up, we can add the code that will actually retrieve the records from the DB, process them through our Address Validation – US service.

Adding code to retrieve records from the database

To start this, we’ll add the service reference to the project so we can easily call the Address Validation – US service and validate our addresses.

To do this, right click the project, select Add, then “Service Reference…”. On the dialogue box that appears enter in the WSDL for the Address Validation – US service and add an appropriate name into the Namespace field. Then select OK.

Screenshot 5

Instantiating three objects

We’ll instantiate three objects: the entity connection we’ll use to connect to the database, a list of addresses we’ll pull back from the database, and a list of objects that we will use to update the database with the validated address information. After this, we will use the entity connection to fill our list of unvalidated addresses that we’ll pull back from the database. The objects we’re creating are based on the table structure from our entity connection.

Screenshot 6

Screenshot 7

Now that we have the unvalidated addresses, we’ll want to process them through the Address Validation – US service and update the database.

Below is the method we will add and call.

Screenshot 8

As seen in the screenshot above, we use the Address Validation – US service reference that we’ve made to validate the input addresses. We do this by looping through the list of tblAddress objects, calling the Address Validation – US service, and then adding an tblValidatedAddress objects to the table that will hold the validated data with the entity connection.

Parallel processing

In our example, we’re only processing two addresses, but the code still uses a Parallel.ForEach statement, as typical use cases may want to process large volumes of addresses in a shorter time. The Parallel.ForEach statements in C# can have a max degree of parallelism set to ensure that the processing power of the machine isn’t exceeded. Use the max degree of parallelism option to best suit the needs of your specific application.

An important thing to note is that the ID for the input addresses is assigned as the ID for the objects being put into the tblValidatedAddresses table so that the non-validated address record and the validated address record can be linked by ID. Your system may vary in how you want to link your address records so modify it accordingly.

Below is a screenshot of the validated data in our tblValidatedAddresses table

Screenshot 9


Note that for record #1, the fields have the validated address information, as well as provided the DPV_Out value and Corrections_Out notes for the input address. For record #2, all the fields are blank except for the Error_Out field, which indicates that the input address was not able to be validated.

Hopefully, this tutorial helped provide an idea of how to retrieve records, process them through a validation service and then update a database with the validated records. We’re always happy to help provide any assistance or recommendations on your specific use case so please reach out to us and we’ll help you get the best out of your Service Objects service.

The API Economy: What Does it Mean for You?

The 2010s have been the decade of the fill-in-the-blank economy: for example, the gig economy (where people are increasingly contractors instead of employees), the sharing economy (where Uber and AirBnB put you in other people’s cars and homes), and even the hipster economy (don’t ask). Lately we can add a new one to the list: the API economy.

Many of you reading this already know what an API is – but just in case, it stands for Application Programming Interface. Its formal definition from Wikipedia is “a set of subroutine definitions, communication protocols, and tools for building software … a set of clearly defined methods of communication among various components.”

In plain English, APIs are interfaces linking your software and data to other people’s software and data. In this blog, we are going to look at why they have become so important – and more importantly, what they can do for you.

The impact of APIs

Why are APIs being seen as an economic phenomenon? Because they are dramatically changing the way software is being produced – and more importantly, how it is consumed.

First, APIs dramatically extend the reach and capabilities of your software environment. Here at Service Objects, for example, we can put the entire United States Post Office into the address entry fields of your marketing automation software to validate and complete addresses – or even fix ones that are horribly wrong. We can link your prospects or customers to US Census data for demographic analyses. We can tell you which email addresses in your contact list are known spam traps. And much more.

Second, APIs are fueling the next generation of inexpensive, cloud-based computing. Remember the days when implementing tools such as CRM and ERP required months of planning, and seemingly a cast of thousands? For many businesses, those days eventually gave way to easy-to-install browser-based applications with their own user interfaces. Today, the next step has often been towards “headless” capabilities: specific web services with no UI that can be easily plugged into your own business computing environment via APIs.

The other key benefit of APIs is that they are upgradeable component technology. At Service Objects, we are constantly adding new capabilities to our services, with no change in programming required from our users on the front end. This flexibility and ability to evolve quickly has changed the game for business applications today.

Putting APIs to work for you

Most Service Objects’ services are designed to plug in to your applications environment, including marketing and sales force automation platforms and CRMs. We also offer other options, ranging from batch list processing to a PC desktop app and done-for-you data cleaning services, but we are first and foremost an API company – and we devote a lot of our efforts to API resources and ease of integration, so you can seamlessly put these services to work in your platform.

This starts with an architecture that is designed API-first, beginning with our request and response interfaces. We support REST, SOAP, GET and POST requests over HTTP/S outputting in JSON and XML formats.

For example, here is a sample web URL request from our flagship DOTS Address Validation – US 3 service, together with the response fields returned in JSON.

API compatibility

Our API web services are compatible with all major programming languages, including Java, PHP, Ruby on Rails, C#, Python, and much more. To help developers integrate our services quickly, we have extensive documentation along with over 200 pieces of sample code to help with your integration. We are developers ourselves, and we live and breathe API integration. And we are always more than happy to help your implementation go smoothly or troubleshoot issues, with an industry-leading support team that is always on call.

Where we are headed

According to IBM, “’API Economy’ is a general term related to the use of ‘business APIs’ to positively affect the company.“ This is truly the rationale for the growth of APIs, particularly economic benefits such as lower development costs and greater capabilities. And at a deeper level, it speaks to how software capabilities are increasingly becoming component parts of streamlined platforms.

Nowadays the label “API Economy” is far from an overstatement, with the use of APIs growing more than 10,000% over the last decade. We are always working hard to stay ahead of the curve and bring more and more data quality capabilities that can be easily integrated into your business platforms.

To try out any of our 24 data validation APIs, visit our web site to request your free trial key.

Service Objects integrations can help improve your contact data quality, help with data validation, and enhance your business operations.

Salesforce Data Quality Tools Integration Series – Part 4 – Lightning App

We are back now with the fourth blog in our Salesforce Data Quality Tools Integration Series.  In previous blogs,  we covered various topics like; creating a plug-in that could be dropped on a flow, a trigger and Apex classes.  From these blogs, you can learn how  Service Objects APIs will help improve your data quality and in turn,  the performance of your Salesforce instance. Like the VisualForce app demonstration, this demo shows how you’ll be able to extend our services for your own purposes in Salesforce’s Lightning framework.  By the end of this blog, you’ll have all the code you’ll need to get started, so don’t worry about implementing this step by step.

This Lightning app is going to serve as a quick email contact input and validation tool.  We will use separate custom objects and custom fields to make this app stand alone from your other objects in Salesforce.  With that said, please note that everything I demonstrate is totally customizable.  For the purposes here, that means you can adjust which objects and fields (standard or custom) you want to use.  You will also be able to customize the call to our Email Validation API and insert your own business specific logic.  There are a lot of code files in this project but do not be discouraged.  This only means that the code is broken down into byte size parts and abstracted to keep the logic a UI separate.

First things first, we are going to start with some basic setup.  Unlike VisualForce, before we can work with the Lightning framework, we will need to turn on My Domain in Salesforce.  You need to have your own sub domain for your Salesforce org, and that is what My Domain does, it allows you to create a custom sub domain.  You can find the settings under Company Settings when using the Lightning Experience.  This link will take you through the details on setting it up.  After you have activated it, you may need to wait several minutes before it is ready. Salesforce will email you when it is done.

The next part of the setup is setting up the Service Objects endpoint.  I am not going to go over it this time because I go over it in the first and second parts of this series.  So, if you need help with setting this up or want a description of what this is, then I would refer you to those blogs.  If you have been following along from the first two blogs, then you would’ve had completed this part already.

In the VisualForce demo, we jumped right into creating the custom fields, however, this time we need first to create the custom object that will house our custom fields.  In the Object Manager, click on Create and select Custom Object.  From there, you will be prompted to fill in several details of our new custom object.  Here is what you will need to add:

  • Label
    • Email Contact
  • Plural Label
    • Email Contacts
  • Starts with vowel sound
    • Check
  • Record Name
    • Name
  • Launch New Custom Tab Wizard after saving this custom object
    • Check

That last check for launching the New Custom Tab Wizard will create a custom tab for you to be able to add/edit/delete during testing before we create the final home for our app.

Next, you will need to add the following custom fields to the newly created Email Contact object.  If you are customizing this for your own purposes, you will want to add these fields to the object you are working with.  If you want to map more of the fields that we return from our service, you’ll have to create the appropriate fields on the object if there isn’t an existing field at your disposal.  If you are using existing objects for these fields, you will want to take into consideration the names of the fields, to prevent conflicts or confusion in your system.

  • Field name
    • Internal Salesforce name
    • Type
    • Service Objects field name
  • Email
    • Email__c
    • Email (Unique and required)
    • EmailAddress
  • Status
    • Status__c
    • Picklist
      • Review (Default)
      • Accepted
      • Rejected
    • None
  • Score
    • Score__c
    • Number (1,0)
    • Score
  • Notes
    • Notes__c
    • Text (255 and default set to “None”)
    • NotesDescription
  • Warnings
    • Warnings__c
    • Text (255 and default set to “None”)
    • WarningDescriptions
  • Errors
    • Errors__c
    • Text (255 and default set to “None”)
    • Type, Error.Description
  • Is Deliverable
    • Is_Deliverable__c
    • Picklist
      • Unknown (Default)
      • True
      • False
    • IsDeliverable
  • Is Catch All Domain
    • Is_Catch_All_Domain__c
    • Picklist
      • Unknown (Default)
      • True
      • False
    • IsCatchAllDomain
  • Is SMTP Server Good
    • Is_SMTP_Server_Good__c
    • Picklist
      • Unknown (Default)
      • True
      • False
    • IsSMTPServerGood
  • Is SMTP Mailbox Good
    • Is_SMTP_Mailbox_Good__c
    • Picklist
      • Unknown (Default)
      • True
      • False
    • IsSMTPMailBoxGood

Ok, so I didn’t promise some of this wasn’t going to be tedious, but at least it wasn’t hard.  This time around, we are adding more custom fields with default values and picklists.  Do not skip the default values; they are key in some of the ways the code works.

Now that we have that out of the way, let’s take a look at what we are going to build (I fudged some of the values so we could see all states of a validated email on the interface).

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Below is a better view of the functionality.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Simply put, we will be building out a UI that with take a name and an email as an input and validate the email against Service Objects’ Email Validation API and display the results to the screen.  The validation portion will automatically evaluate the score of the email from the service and assign the appropriate status flag to the record.  In our scenario, I decided to let all the emails with scores of 0 and 1 automatically be accepted and all those with scores of 3 and 4 automatically be rejected.  The emails that scored 2, I left in the review state for the status field so that the end user can make the final analysis and assign the appropriate status flag.

In order to figure out all the different components we are initially going to need, we will re-examine the layout from above.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Taking a closer look, there are five parts identified from the UI that need to be created.  There are a couple more parts beyond what I have highlighted in the screenshot, but I will get to those as we go.  At this point we have identified the following components are needed:

  • Email Contact Container
    • A place to put all the parts
    • Filename
      • cmp
    • Email Contact Header
      • Self explanatory
      • Filename
        • cmp
      • Email Contact Form
        • Somewhere to add information
        • Filename
          • cmp
        • Email Contact List
          • A place to add the results
          • Filename
            • cmp
          • Email Contact Item
            • A single result
            • Filename
              • cmp

From there, the UI could be broken down into even smaller parts, but for this demo, this is as far as we will need to go.  Note, in retrospect, I would have used different filenames that don’t start with “Add” but what is done is done.  Next, I am going to go through each of these and briefly talk about the code.

I am actually going to start with a file I didn’t mention above.  It is the file that the app will run through:  It is simply three lines of markup that says what resources (slds for styling the page) the page is going to use and an element which is our app container, the AddEmailContactContainer component.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Well, that makes an easy transition to the next page, the AddEmailContactContainer.cmp page.  The first thing you will notice is that we assigned the EmailContactUtil as the controller for this component.  The EmailContactUtil.apxc is the Apex class file that will act as the server side controller where, in contrast, a page called AddEmailContactContainerController.js will serve as the client side controller for the component.  Another important thing to note is the list after “implements.”  I am not going to go into it here, but you will need this if you expect to drag and drop this component in the Lightning App Builder in the future.  Be sure to set access to global as well.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

This component takes in a list of EmailContact custom objects in the first attribute element and the list will be used to display the current EmailContact records.  After the attribute element, we have three handler elements named init, updateEmailContactItem and createNewEmailContactItem. Those handlers are used for initializing/updating the page (init) and registering two events that will occur later on in the other components.  This component will listen for creating a new EmailContactItem and updating an EmailContactItem.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

The init handler is important to mention now because it is how the app gets the list of EmailContacts to display.  The init handler calls the doInit method in the AddEmailContactContainerController.js page.  Asynchronously, the method creates an action to call the server side controller to pull back the needed records.  It makes sense that we are calling the server side controller since we need to be retrieving stored records.  So this method makes a call to the getEmailContacts method on the server side controller and creates a callback that will update our emailContactItems attribute on the main controller so that we can display the records found.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

This process will be called on the page being loaded initially and whenever there is some sort of post back, which is useful since we want to display the latest list when new items are added.  And that’s it for the init functionality.

I mentioned the two controller files earlier, but there is one more file associated to the AddEmailContactContainer component, a helper file called AddEmailContactContainerHelper.js.  I will run through these associated files later.  The remainder of this markup page simply references the other components that this page is composed of: AddEmailContactHeader, AddEmailContactForm, and AddEmailContactList.  The AddEmailContactList component takes the input list from this page as a parameter as we will see coming up.

Next, I will quickly run through the header page.  There really is not much to it.  Besides some out of the box styling and accessing an icon from the Salesforce predefined set of icons, it is not much more than a title.  Which makes sense since this is a simple header component.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

The AddEmailContactForm is a simple form component.  The parts of this page are the attribute or parameter that we will save the input data, registering an event and the form input section itself.  The attribute will be the variable that holds the input data and will be of the EmailContact type even though we are only populating the Name and Email portions of the object.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Next, we register the event that this component will be firing off whenever the button is clicked. This is the same event that the AddEmailContactContainer component was set to listen for and to handle.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Events need an event file, something that I would describe more as a signature for the event.  It’s a very basic file, so I am going to pop in and out of it quickly.  It is defined within the event element and has an attribute defined with a type, which is our EmailContact object, and a name.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Now back to the form file.  The form section will have input areas for the Name and Email of the contact followed by a button to submit the entry to the system.  In this case, both inputs are required and will provide errors when they are missing or if the email is not in the proper email format.  This component also has a controller and a helper file, AddEmailContactFormController.js and AddEmailContactFormHelper.js respectively.  Both files are there to do basic form validation, help setup and fire the button click event and clear the form.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

AddEmailContactFormController first checks to see if the inputs to the form had basic validity.  You’ll notice that the inputs in the form had the same aura:id, which is allowing us, at this point, to pull all of the inputs back at once in an array.  Upon the inputs being valid, we pull the newEmailContactItem variable that was populated with the inputs and send it off to the helper page.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

The helper file instantiates the event and sets the parameter for it, which, in this case, is the newEmailContactItem.  Then the event is fired, and the input attribute that fills the form is reset to make the form ready to take in more contacts from the user.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

In order to continue with the flow of what is happening with the event, I am going to jump back to the main component and look at its controller and the helper files.  At this point, the user has entered data in the form, clicked the button and the code has setup and fired the event.  Now, the AddEmailContactContainer takes over because it has been listening for this event and is ready to handle it with the createNewEmailContactItem handler mentioned earlier.  The action on the handler is to pass control to the handleAddEmailContactUpdate method in the client side controller.  AddEmailContactContainerController, which pulls in the EmailContact variable from the event that was fired, sends the EmailContact variable off to the addEmailContact method in the helper file.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Now on to the AddEmailContactContainerHelper.js file.  This app is going to both create email contacts and update them.  Since updating and creating are very similar in our scenario, we will have both update and create functions call the one save function.  Much of the code is the same, so it makes sense to reuse code here. Since we are following the path of the create event, we will look at it from that perspective here.  The two methods we will run through are the addEmailContact method and the saveEmailContact method.  The addEmailContact method immediately calls the saveEmailContact method, but it provides parameters for indicating if we are doing an update or create and it also supplies a callback function.  The callback gets the list of new records and sends them to the AddEmailContactContainer after the new EmailContact record is created.  The new Email Contact record is created in the server side controller and is called from the saveEmailContact method.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

And that completes the code flow of creating a new Email Contact record.  Next, I am going to jump into the last portion of the code, and that starts with the AddEmailContactList component, where we will look at the displaying of the Email Contact items and the event to update the Status field when there is a button click.

The AddEmailContactList component is another simple and straight forward page.  It handles displaying the list of Email Contacts sent to it through the emailContactItems attribute.  The code iterates over the emailContactItems attribute dynamically displaying the AddEmailContactItem to the screen.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Moving to the AddEmailContactItem, we see that it is a little longer than the reset of the code but in its parts, it is still pretty straightforward.   So what are the parts?  We see there is a graphic and a title, a couple of fields, some buttons, a status and, finally, some fine details.  We could have broken this out into smaller components, but for this demo, this is enough.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

In the code two things happen before the header markup is added.  First, just like the event we registered for the button that adds a new contact, we need to register an event for the buttons specific to each EmailContactItem on the page.  The purpose of these buttons will be to allow the user to accept or reject an email based on the information from the Service Objects Email Validation API operation.  The buttons should not be visible unless the score returned from the service is 2.  Scores of 0 are no-brainers, we can, without hesitation, mark those as accepted.  Those are valid emails.  A score of 1 has a very high certainty to be valid, so we will also automatically set their status as accepted.  Those with a score of 4 are bad emails, again, we automate these, but this time we set the status to be rejected.  And 3’s are near certainty that they are bad emails, so those are also automatically marked as bad.  The grey area is those that get validated with a score of 2.  This score represents unknown for various reasons, and we suggest some kind of manual review or inspection.  For more information about the score field and deeper details about service, you can check out our developer guides here.  After we register the event, we setup the attribute element, creating a local variable input that takes a single EmailContactItem.  This should be familiar by now based on some of the other pages we discussed.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Now we get to the graphic/icon and title code.  Nothing too interesting here really, so I am going to skip over it.  But I do want to mention; this code will display our item icon and the title, you will notice that it actually houses the item parts.  All of the rest of the items components will go in here.  If you want to change the icon, you can see a list of what is available at this link.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

The next bit of code does several things.  First, it displays the contact name and the associated email.  Then, based on the score determined by Service Objects’ Email Validation operation, we will, in the markup, decide if we should display the buttons used for accepting or rejecting the email address.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Next, a similar markup and logic is used to determine the background color on the status and score sections.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

There are several techniques to do this dynamic display instead of using the if/else markup elements but I just learned about them, and I wanted to give them a shot.  I would have probably used a different solution involving Javascript, and this code would have been much shorter.

The last part of this component is the Lightning accordion section.  I added a two-part accordion, so I had a place to display some details that came back from the Email Validation operation without consuming too much space on the screen.  I have it default to opening the second section of the according first.  The first part contains the warnings, notes and/or errors.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

The second part contains other various details like if the email is deliverable or is the email on a catch-all domain, as well as, is the SMTP Mailbox good or is the SMTP Server good.  If you wanted to adjust the code and display more data returned from the Email Validation operation, I would recommend adding those fields to these sections or adding more accordion sections with more fields to display.  This is the code for the second section.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

That does it for the markup pages.  Now, let’s just follow through the code for when either one of the buttons is clicked.  The rest of the functionality rests on the controller and helper of the AddEmailContactItem page but also some of the pages we already went through from the first event we discussed.

The accept and reject buttons each have their own method they call when clicked.  I could have used just one method here and checked the name or id of the calling event, but I thought this would keep things clear.  These are really just pass-through methods that indicate if the accept or reject button was clicked by passing the true or false to the updateEmailContactItem method in the helper file.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

In the AddEmailContactItemHelper.js file, the method updateEmailContactItem starts by setting the status field for the contact item based on the input parameter.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Once that is set, we create the event, fire it and hide the buttons from the screen.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

You may have noticed that we are not creating a new event file.  Since the signature for the create and update events are the same, we are able to reuse the one we already have.  Now, like before, the AddEmailContactContainer is listening for the event, but this time it is listening for the update event.  When the event is fired, the main controller will catch the event and call the handleUpdateEmailContactUpdate method in the AddEmailContactContainerController.  The handleUpdateEmailContactUpdate method pulls out the EmailContactItem that was passed in the event and sends it along to the updateEmailContact method in the helper.

Service Objects Salesforce Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

Earlier, when we were running through the create functionality, we came to a point where we wrote one save method because we knew that the save method could server both the save and update purposes.  Now we get to utilize what we setup earlier and piggyback off of the save code.  In the AddEmailContactContainerHelper the method for updating, the updateEmailContact method, will call our saveEmailContact from before but this time we are not sending along a call back method.  The saveEmailContact method then sets up a couple of parameters and calls the saveEmailContact on the server side controller, and that controller saves or updates the record.

Now that we have gone over all the code you can see that none of this is terribly difficult to understand, but there are a lot of files for a simple app.  We could have reduced the file count if we put all the helper code back up into the controller code.  We also could have reduced the number if we created fewer components and grouped everything together.  And though you can do all that, there are reasons I didn’t.  One reason to break the application out this way is so that we can focus on smaller parts and make each page more basic.  Another reason is that as you extend this solution to meet your own requirements you may be adding a lot more code and keeping the code compartmentalized like this will help with code readability and maintenance.  When you look at the files for this project, you will see that there were several CSS files that we didn’t go over here.  You can review those as you see fit.  Another thing that I didn’t do, is add more error checking which you will certainly want to do, as well as, writing your own unit tests.  The last thing you need to make sure of, is to get a license key (live or trial) from us and add it to the EmailContactUtil.apxc file, otherwise you will not be able to validate email addresses against our API.  If you get a trial key, you need only update the key in the code.  However, if you get a live key, then you will want to update the endpoints in the code in addition to the key.  With the live key, you will want the first endpoint to be and the second to be  In the example below, I changed the key to contain X’s instead of real values.

Salesforce Data Quality Tools Integration can help improve your contact data quality, help with data validation, and enhance your business operations.

So, where do you go from here?  One thing you will likely want to do is customize the solution.  Maybe your want to incorporate some of the standard objects in Salesforce or perhaps you want to use or create your own custom objects.  Maybe there is additional business logic that you want to apply to the results our Email Validation.  After that, you will likely be adding this component to a Lightning app.  Or maybe you’ll just use the code for the Email Validation alone for something completely different.  A side note to make here is that you can even apply this demonstration to many of our other services like Address Validation, Address Detective, Lead Validation, Name Validation and more.  When you look at this solution, you should notice that though the part of the code that dealt with calling our Email Validation API was very short, it had a huge impact on the utility of the app.  If you want some specific code that can help with this solution or applying this solution to our other services then simply reach out, and we’ll do our best to accommodate.

The Difference Between Webhooks and APIs

The word “webhook” sounds really cool, and it is, but what exactly is it? What does a webhook do and how is it different from an API? What do webhooks have to do with Service Objects’ APIs?

What is an API?

In order to better understand webhooks, let’s first define API, or “application program interface.” APIs are pieces of code developed to execute some sort of logic. They are building blocks used to create other software, which can include creating other APIs. They serve as a common interface between two separate applications, allowing them to interact by sending and receiving data.

APIs can be used internally to support other processes within a company or they can be provided to the public as a paid or unpaid service. Google Maps API, for example, makes it possible to embed a Google map on a webpage. By using the Google Maps API, a web developer has a simple way to include an official Google map pinpointing their business’s exact location. There’s no need for any special coding or reinventing of the proverbial wheel.

Another example would be Service Objects’ address validation API, which makes it possible for our customers to input an address and receive standardized and corrected address information from our USPS CASS Certified database engine.

What is a webhook?

Webhooks, for the most part, use APIs. Applications that have a mechanism for webhooks will often use a webhook when an event requiring custom logic has been triggered. Events are typically triggered by a workflow or some type of data entry, but other event types exist.

Webhooks give external developers opportunities to implement some sort of custom logic that either executes and returns results or executes custom logic for processes or purposes outside of the given application or both.

Using Marketo marketing automation software and Service Objects’ data validation APIs as an example, when an address is saved or added to a contact in Marketo, a webhook could be used to automatically validate the address using one of our address validation APIs such as our DOTS Address Validation – US 3 API. When the data is available, it is sent to an API call. In this case, there’s no polling from an external application of the host to check back periodically for data to validate.

So, from the standpoint of providing a webhook to a third party such as Service Objects, the intent is to enable that third party to push data back into your Marketo instance or trigger other operations outside of it. In our example, Marketo can send address data to Service Objects and trigger the address validation API thanks to the webhooks that provide this ability. Learn more about Service Objects for Marketo here.

In contrast, from the standpoint providing an API without webhooks, the intent is to enable others to trigger responses from your API to use strictly in their own applications.

There is no purpose to a webhook without an API, but the reverse is not true.

What does all of this mean to you?

It means that data validation is easy! Sign up for a free trial and find out just how easy and effective our webhook-powered APIs are.