1.Introduction #

This document will guide you through integrating a .NET website with the MyMedLeads Web API.   The document will describe the different properties/attributes of a Lead and how to populate this and send to MyMedLeads

Intended Audience

This document is outlined for a .NET Developer.   This document assumes that you do know .NET and that you currently manage the website.

Requirements

You will need a few things from our team to get started.   We have a zip file that contains some javascript, configurations and a dll.  The use of these are outlined below.
You will also need a Transaction Key to represent the LeadSource of the website.  The LeadSource can vary between page to page, so this should be a dynamically rendered value (possibly in a Hidden Field on the form)
Optionally, you will also need a List of Procedures from our team.  This list will include the Procedure Name and an ID that must be passed into our system.

2.Steps To Integrate #

Our .NET client is easy to use. Simply reference the mmlclient.dll and start using our prebuilt classes to integrate your forms.

  1. Include the javascript on each page of the site
  2. Update the .sln or web.config to include a reference or binding to the MyMedLeads API
  3. Instantiate your MMLClient, using one of your Transaction Keys (listed below).
  4. Create a MMLLead and populate it.
  5. For custom data, that is outside the scope of properties of a Lead, use the AddCustomField() method to append the data within the Comments Section of a Lead
  6. Post the Lead
  7. Check the Response

Optionally, you may want to capture Procedure Data.  In those instances, it is best to write a function that you can pass in the ProcedureOfInterest field, OR the comments to parse them for potential Procedures.  Below we give you a direct example of this.

The MyMedLeads Web API can accept Procedure of Interest data. Your logic will need to know the appropriate IDs to pass into the API. For sites or APIs that manage more than a single client, you will need to think about storing the data within a database and retrieve it and loop through it similar to the below example.You and your team can request the Procedure Ids from MyMedLeads and we can produce an Excel file containing the name of the Procedure and the ID to pass in.Overall Strategy:

  1. Produce a list of Name/Value pairs and populate with the ProcedureName as the Key and the ProcedureId as the Value
  2. You are able to update this list to better match the Procedure of Interest select (EX: in the MyMedLeads Account we have IPL Treatments, however on the website you list Intense Pulse Light/Laser Treatments).
  3. For multiple selection, you will need to send in a list of strings (should be the selected Names)
  4. Populate the Lead.ProcedureData with the procedure value

We can provide the Procedure Functions. We are currently writing some generic APIs to retrieve this data programmatically.

3.Source Code #

The below code demonstrates how the logic will populate the MMLLead object.   Please presume that the front end code is all correct and in place for the example to work.

  var mmlClient = new MMLClient("The Transaction Key");
  var procId = GetProcedureId(ddlProcs.SelectedValue);
  if (string.IsNullOrEmpty(procId))
  {
   mmlClient.AddCustomField("Proc:", ddlProcs.SelectedValue);
  }
  // instantiate a new Lead
  var mmlLead = new MMLLead()
  {
     FirstName = txtFirstName.Text,
     LastName = txtLastName.Text,
     EmailAddress = txtEmailAddress.Text,
     PhoneNumber = txtPhone.Text,
     ProcedureData = procId
  };
  var response = mmlClient.PostLead(mmlLead);
  if (response.LeadId > 0)
  {
     // success
  }


    ...


private string GetProcedureId(string procedureName)
{
   var terms = new Dictionary<string, string="">();
   terms.Add("acne treatment", "365");
   terms.Add("anti-aging treatments", "173");
   terms.Add("blepharoplasty", "69");
   terms.Add("body contouring", "15");
   terms.Add("botox", "22");
   terms.Add("brachioplasty", "68");
   if (string.IsNullOrEmpty(procedureName))
      procedureName = string.Empty;
   procedureName = procedureName.ToLower().Trim();
   foreach (KeyValuePair<string, string=""> term in terms)
   {
      if (procedureName.Contains(term.Key.ToLower()))
         return term.Value;
   }
      return string.Empty;
}

 

Suggest Edit