Archive > API > hcapthca verification SFMC implementation

Step by Step Process

  • Form data gets passed with the captcha_score into a holding table
  • A guid gets created and ties to the holding table, conversion pixel, captch_score, and guid. This information gets stored in the DE Hcaptcha_Verification_Data
  • If the score is less the 70 the submission is treated normally
  • If the score is greater then 80 the submission is ignored
  • If the score is between 70 and 80 then the submission goes throught the email verification process.

Verification Process

If the submission needs verified before sending the TY and conversion email, the conversion pixel stops executing and the pixel redirects to the cloud page in the shared BU with the confirmation  id in the query string like this: https://pages.upmc.com/create-confirmation-email?confirmation_id=4865984d-3747-436a-b36d-5820bc2cfe98

The Cloud page will fire a confirmation email in the UPMC BU called “hcaptcha verification email”

The email has a link with a verification button. Once the person clicks on the confirmation, the form conversion pixel resumes execution of the record.

Flowchart

Data Extensions

Holding Table
Triggered Send Data Extension(s)
Journey Entry Data Extension(s)

Implementation Code in Conversion Pixels

  1. Set the Holding DE Name
    1. SET @HOLDING_DATA_EXTENSION = ‘Ent.Sports_Medicine_Contact_Us_HOLDING’
    2.   SET @override_score = ‘false’
  2. Include Confirmation LookupRows override instead of just unprocessed leads
    1. SET @confirmation_id = RequestParameter(“confirmation_id”)
      IF(Length(@confirmation_id) < 1) THEN
      SET @LookupData = LookupRows(@HOLDING_DATA_EXTENSION ,’has_processed’,”false”)
      ELSE
      SET @LookupData = LookupRows(@HOLDING_DATA_EXTENSION ,’confirmation_id’, @confirmation_id )
      ENDIF
      SET @DataRowcount = RowCount(@LookupData)
  3. Get Chaptcha Score of unprocessed lead
    1. SET @captcha_score = Field(@row, “captcha_score”)
  4. Update has processed and override scoer
    1. IF(Length(@confirmation_id) < 1) THEN
              UpsertData(@HOLDING_DATA_EXTENSION, 2, ’email_address’, @EmailAddress,’date_created’,@date_created, ‘has_processed’, ‘true’)
            ELSE
              UpsertData(@HOLDING_DATA_EXTENSION, 2, ‘confirmation_id’, @confirmation_id,’date_created’,@date_created, ‘has_processed’, ‘true’, ‘override_score’, @override_score)
            ENDIF
  5. Include Shared chaptcha evaluation code
    1. ]%% %%=ContentBlockById(“32412”)=%% %%[

Triggered Emails

UPMC BU>Content Builder>Emails>_Hcaptcha>hcaptcha verification email

Sports Med Code Example

Sports Medicine BU – Cloud Pages – External Conversion Pixels – Yates [API] Sports Medicine Contact Us

 

<script runat=”server”>
Platform.Load(“Core”,”1″); // Required for Platform functions

 

try {

 

</script>

 

%%[
/*** HCAPTCHA Set the holding data extension ***/
SET @HOLDING_DATA_EXTENSION = ‘Ent.Sports_Medicine_Contact_Us_HOLDING’
/*** HCAPTCHA Set the holding data extension ***/

 

/*** HCAPTCHA Lookup Rows by either has processed or confirmation id ***/
SET @confirmation_id = RequestParameter(“confirmation_id”)
IF(Length(@confirmation_id) < 1) THEN
   SET @LookupData = LookupRows(@HOLDING_DATA_EXTENSION ,’has_processed’,”false”)  
ELSE
  SET @LookupData = LookupRows(@HOLDING_DATA_EXTENSION ,’confirmation_id’, @confirmation_id ,’override_score’,’false’)
  SET @override_score = ‘true’
ENDIF
/*** HCAPTCHA Lookup Rows by either has processed or confirmation id ***/

 

SET @DataRowcount = RowCount(@LookupData)

 

IF @DataRowcount > 0 THEN
FOR @y = 1 TO @DataRowcount DO

 

 SET @row = Row(@LookupData , @y)
 SET @EmailAddress = Field(@row, “email_address”)
 SET @first_name = Field(@row, “first_name”)
 SET @last_name = Field(@row, “last_name”)
 SET @phone_number = Field(@row, “phone_number”)
 SET @zip_code = Field(@row, “zip_code”)
 SET @location = Field(@row, “location”)
 SET @interest = Field(@row, “interest”)
 SET @interest_hamot = Field(@row, “interest_hamot”)
 SET @category = Field(@row, “category”)
 SET @subcategory = Field(@row, “subcategory”)
 /* SET the date_created field to pull into the DOMO_025_CampaignLeads DE */
 SET @date_created = Field(@row, “date_created”)
 /* SET the UTM fields to pull into the DOMO_025_CampaignLeads DE */
 SET @utm_source = Field(@row, “utm_source”)
 SET @utm_term = Field(@row, “utm_term”)
 SET @utm_content = Field(@row, “utm_content”)
 SET @utm_medium = Field(@row, “utm_medium”)
 SET @utm_campaign = Field(@row, “utm_campaign”)
 SET @utm_advertiserid = Field(@row, “utm_advertiserid”)
 SET @utm_adgroup = Field(@row, “utm_adgroup”)
 SET @captcha_score = Field(@row, “captcha_score”)

 

/*** HCAPTCHA Update has processed HCAPTCHA ***/
IF(Length(@confirmation_id) < 1) THEN
 UpsertData(@HOLDING_DATA_EXTENSION, 1, ’email_address’, @EmailAddress, ‘has_processed’,’true’)
ELSE
 UpsertData(@HOLDING_DATA_EXTENSION, 1, ’email_address’, @EmailAddress, ‘has_processed’,’true’,’override_score’,”true”)
ENDIF
/*** HCAPTCHA Update has processed HCAPTCHA ***/

 

/*** HCAPTCHA verification process is located at Shared Content\_CorkPages\API\External Conversion Pixels Header  ***/
]%% %%=ContentBlockById(“32412”)=%% %%[
/*** HCAPTCHA verification process is located at Shared Content\_CorkPages\API\External Conversion Pixels Header  ***/
/************ if Cranberry and/or South Side location selected ************/
IF @location == ‘UPMC Lemieux Sports Complex (Cranberry Township)’ OR @location == ‘UPMC Rooney Sports Complex (South Side)’ THEN

 

/** BEGIN THANK YOU EMAIL cranberry/southside **/

 

 SET @ts = CreateObject(‘TriggeredSend’)
 SET @tsDef = CreateObject(‘TriggeredSendDefinition’)
  SetObjectProperty(@tsDef, ‘CustomerKey’, ‘5211’)
  SetObjectProperty(@ts, ‘TriggeredSendDefinition’, @tsDef)
 
 SET @ts_sub = CreateObject(‘Subscriber’)
 SetObjectProperty(@ts_sub, ‘EmailAddress’, @EmailAddress)
 SetObjectProperty(@ts_sub, ‘SubscriberKey’, @EmailAddress)
 AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub)

 

 SET @de_col = CreateObject(“Attribute”)
 SetObjectProperty(@de_col, “Name”, “category”)
 SetObjectProperty(@de_col, “Value”, @category)
 AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

 SET @de_col = CreateObject(“Attribute”)
 SetObjectProperty(@de_col, “Name”, “subcategory”)
 SetObjectProperty(@de_col, “Value”, @subcategory)
 AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

 SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
 IF @ts_statusCode != ‘OK’ THEN
  RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
 ENDIF

 

/** END THANK YOU EMAIL cranberry/southside **/

 

/** BEGIN SERVICE EMAIL cranberry/southside **/

 

 SET @ts = CreateObject(‘TriggeredSend’)
  SET @tsDef = CreateObject(‘TriggeredSendDefinition’)
  SetObjectProperty(@tsDef, ‘CustomerKey’, ‘5212’)
  SetObjectProperty(@ts, ‘TriggeredSendDefinition’, @tsDef)
  SET @ts_sub1 = CreateObject(‘Subscriber’)
  SetObjectProperty(@ts_sub1, ‘EmailAddress’, ‘myates@flyingcork.com’)
  SetObjectProperty(@ts_sub1, ‘SubscriberKey’, ‘myates@flyingcork.com’)
  AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub1)
 
    /*
  SET @ts_sub1 = CreateObject(‘Subscriber’)
  SetObjectProperty(@ts_sub1, ‘EmailAddress’, ‘Sportsmedicine1@upmc.edu’)
  SetObjectProperty(@ts_sub1, ‘SubscriberKey’, ‘Sportsmedicine1@upmc.edu’)
  AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub1)
   */

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “first_name”)
  SetObjectProperty(@de_col, “Value”, @first_name )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “last_name”)
  SetObjectProperty(@de_col, “Value”, @last_name)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “user_email”)
  SetObjectProperty(@de_col, “Value”, @EmailAddress )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “phone_number”)
  SetObjectProperty(@de_col, “Value”, @phone_number )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “zip_code”)
  SetObjectProperty(@de_col, “Value”, @zip_code)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “location”)
  SetObjectProperty(@de_col, “Value”, @location)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “interest”)
  SetObjectProperty(@de_col, “Value”, @interest)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )
       
        SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “category”)
        SetObjectProperty(@de_col, “Value”, @category)
        AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

        SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “subcategory”)
        SetObjectProperty(@de_col, “Value”, @subcategory)
        AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
  IF @ts_statusCode != ‘OK’ THEN
   RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
  ENDIF

 

/** END SERVICE EMAIL cranberry/southside **/
/************ if Erie location selected ************/
ELSE

 

/** BEGIN THANK YOU EMAIL erie **/

 

 SET @ts = CreateObject(‘TriggeredSend’)
 SET @tsDef = CreateObject(‘TriggeredSendDefinition’)
  SetObjectProperty(@tsDef, ‘CustomerKey’, ‘5213’)
  SetObjectProperty(@ts, ‘TriggeredSendDefinition’, @tsDef)
 
 SET @ts_sub = CreateObject(‘Subscriber’)
 SetObjectProperty(@ts_sub, ‘EmailAddress’, @EmailAddress)
 SetObjectProperty(@ts_sub, ‘SubscriberKey’, @EmailAddress)
 AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub)

 

 SET @de_col = CreateObject(“Attribute”)
 SetObjectProperty(@de_col, “Name”, “category”)
 SetObjectProperty(@de_col, “Value”, @category)
 AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

 SET @de_col = CreateObject(“Attribute”)
 SetObjectProperty(@de_col, “Name”, “subcategory”)
 SetObjectProperty(@de_col, “Value”, @subcategory)
 AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

 SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
 IF @ts_statusCode != ‘OK’ THEN
  RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
 ENDIF

 

/** END THANK YOU EMAIL erie **/

 

/** BEGIN SERVICE EMAIL erie **/

 

 SET @ts = CreateObject(‘TriggeredSend’)
  SET @tsDef = CreateObject(‘TriggeredSendDefinition’)
  SetObjectProperty(@tsDef, ‘CustomerKey’, ‘5214’)
  SetObjectProperty(@ts, ‘TriggeredSendDefinition’, @tsDef)
  SET @ts_sub1 = CreateObject(‘Subscriber’)
  SetObjectProperty(@ts_sub1, ‘EmailAddress’, ‘myates@flyingcork.com’)
  SetObjectProperty(@ts_sub1, ‘SubscriberKey’, ‘myates@flyingcork.com’)
  AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub1)
 
    /*
  SET @ts_sub1 = CreateObject(‘Subscriber’)
  SetObjectProperty(@ts_sub1, ‘EmailAddress’, ‘HamotSportsMed@upmc.edu’)
  SetObjectProperty(@ts_sub1, ‘SubscriberKey’, ‘HamotSportsMed@upmc.edu’)
  AddObjectArrayItem(@ts, ‘Subscribers’, @ts_sub1)
   */
 
  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “first_name”)
  SetObjectProperty(@de_col, “Value”, @first_name )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “last_name”)
  SetObjectProperty(@de_col, “Value”, @last_name)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “user_email”)
  SetObjectProperty(@de_col, “Value”, @EmailAddress )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “phone_number”)
  SetObjectProperty(@de_col, “Value”, @phone_number )
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

   SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “zip_code”)
  SetObjectProperty(@de_col, “Value”, @zip_code)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “location”)
  SetObjectProperty(@de_col, “Value”, @location)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “interest”)
  SetObjectProperty(@de_col, “Value”, @interest)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )
 
  SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “interest_hamot”)
  SetObjectProperty(@de_col, “Value”, @interest_hamot)
  AddObjectArrayItem(@ts , “Attributes”, @de_col )
       
        SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “category”)
        SetObjectProperty(@de_col, “Value”, @category)
        AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

        SET @de_col = CreateObject(“Attribute”)
        SetObjectProperty(@de_col, “Name”, “subcategory”)
        SetObjectProperty(@de_col, “Value”, @subcategory)
        AddObjectArrayItem(@ts , “Attributes”, @de_col )

 

  SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
  IF @ts_statusCode != ‘OK’ THEN
   RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
  ENDIF

 

/** END SERVICE EMAIL erie **/

 

ENDIF

 

 /* add to journey entry DE */
 /*UpsertData(‘Ent.’, 1, ’email_address’, @EmailAddress , ‘category’, @category ,’subcategory’, @subcategory)*/
 
 /* add to newsletter DE */
 UpsertData(‘Ent.Sports_Medicine_Master’, 1, ’email_address’, @EmailAddress , ‘subscriber_key’, @EmailAddress , ‘first_name’,  @first_name , ‘last_name’,  @last_name, ‘phone_number’,  @phone_number, ‘zip_code’,  @zip_code,  ‘category’, @category ,’subcategory’, @subcategory)

 

 UpsertData(‘Ent.Orthopaedics_and_Sports_Medicine_Master_DE’, 1, ’email_address’, @EmailAddress , ‘subscriber_key’, @EmailAddress , ‘first_name’,  @first_name , ‘last_name’,  @last_name, ‘phone_number’,  @phone_number, ‘zip_code’,  @zip_code,  ‘category’, @category ,’subcategory’, @subcategory)

 

/****** ALL APIs WRITE TO THE FOLLOWING DATA EXTENSIONS ******/

 

  /* pulls data into the DOMO_025_CampaignLeads DE — update this code accordingly per API */  
   SET @DE_HOLDING_NAME = ‘Sports_Medicine_Contact_Us_HOLDING’
   SET @DEBU = ‘ENT.Data_Extension_Business_Unit’

 

   IF AuthenticatedMemberID() == 7200479 THEN SET @DEBU = ‘Data_Extension_Business_Unit’ ENDIF
   SET @MRID = Lookup(@DEBU,’mrid’,’data_extension’, @DE_HOLDING_NAME)

 

   UpsertData(‘Ent.DOMO_025_CampaignLeads’, 2, ’email_address’, @EmailAddress , ‘date_created’, @date_created, ‘first_name’,  @first_name , ‘last_name’,  @last_name, ‘zip_code’, @zip_code, ‘phone_number’, @phone_number, ‘interest’, @interest, ‘category’, @category ,’subcategory’, @subcategory,’form_id’, @DE_HOLDING_NAME,’mrid’, @MRID,’utm_source’, @utm_source,’utm_term’, @utm_term,’utm_content’, @utm_content,’utm_medium’, @utm_medium,’utm_campaign’, @utm_campaign,’utm_advertiserid’, @utm_advertiserid,’utm_adgroup’, @utm_adgroup)

 

 /* add to causeway */
 UpsertData(‘Ent.Causeway Export Holding SDE’, 1, ’email_address’, @EmailAddress , ‘first_name’,  @first_name , ‘last_name’,  @last_name, ‘phone_number’, @phone_number, ‘zip_code’, @zip_code, ‘category’, @category ,’subcategory’, @subcategory)

 

 /**** Not HCAPTCHA but new Shared Footer Block ***/
  ContentBlockById(“32447”)
 /**** Not HCAPTCHA but new Shared Footer Block ***/
 
 
NEXT @y
ENDIF
]%%

 

<script runat=”server”>

 

} catch (e) {
    // Handle the error caught from the AMPscript execution
    Write(“An error occurred during AMPscript execution: ” + e.message);
    Write(“An error occurred during AMPscript execution: ” + e.message);
    Write(“An error occurred during AMPscript execution: ” + e.message);
    // You can also log the error to a Data Extension, send an email, etc.
}
</script>

UPMC Sitecore Form URL (Dev)

Development version of the UPMC form used for testing.

UPMC Sitecore Form URL (Prod)

Production version of the UPMC form.

Internal API Checklist

A (google sheet) checklist utilized by the flying cork team to keep track of API tasks and deliverables.

Notes/Comments:

Your email address will not be published. Required fields are marked *