Adding save quote for later

There are two ways of implementing this feature. One is slightly more complex than the other.

  1. Querystring prefill

  2. Lead Challenge

Querystring prefill

The most simple and straightforward solution is to prefill the webapp via querystring parameters. This can be achieved via providing all of the customer's input in the email template.

This method CANNOT be used if there are a lot of variables as it will build a long URL that some browsers cannot handle.

{%
set dataObject = {
  'email': lead.quote.data.email,
  'first_name': lead.quote.data.first_name,
  'last_name': lead.quote.data.last_name
}

set leadUrl = "https://integration-url.com/?kdata=" ~ { 'data': dataObject } | kdata
%}

<a href="{{ leadUrl }}">Open webapp</a>

Lead Challenge

Using lead challenge is a much more versatile way of retrieving lead data. Though it requires more work up front.

Field definition

First, the webapp must know that a "challenge" exists for this product and the fields associated with the challenge. This can be done by defining the lead_challenge field definition.

{
  "lead_challenge": [
    {
      "name": "access_pin",
      "validation": "required|string|size:8"
    }
  ]
}

Challenge screen flow manifest

Next, a screen where the customer will be able to provide their challenge information (fields) must be created.

{
  "path": "access-pin",
  "components": [
    {
      "type": "title",
      "config": {
        "content_key": "flow.access_pin.title"
      }
    },
    {
      "type": "form",
      "config": {
        "components": [
          {
            "type": "form-input",
            "config": {
              "show_label": true,
              "field_name": "access_pin"
            }
          },
          {
            "type": "error-list"
          }
        ],
        "footer_components": [
          {
            "type": "form-button-next"
          }
        ]
      }
    }
  ],
  "next": {
    "type": "jsonlogic",
    "schema": {
      "if": [
        {
          "===": [
            {
              "var": "flags.lead_token_valid"
            },
            true
          ]
        },
        "summary",
        "welcome"
      ]
    }
  }
}

Initial screen definition

The initial screen must be set to the challenge screen if lead_token_valid flag exists.

{
  "type": "jsonlogic",
  "schema": {
    "if": [
      {
        "===": [
          {
            "var": "flags.lead_token_valid"
          },
          true
        ]
      },
      "access-pin",
      "welcome"
    ]
  }
 }

Email template

The feature must be enabled in the email template via lead.token.

{%
set leadUrl = "https://integration-url.com/?kdata=" ~ { 'config': { lead_token: lead.token } } | kdata
%}

<a href="{{ leadUrl }}">Open webapp</a>

Contents

Finally, don't forget to set the new contents.

"flow.access_pin.title","Please provide your PIN"
"form.access_pin.label","PIN"
"form.access_pin.placeholder","xxxxxxxx"
"form.access_pin.errors.required","This field is required"
"form.access_pin.errors.size","This field must be exactly 8 characters long"
"form.access_pin.errors.invalid_value","Invalid Access pin provided. Please try again."

Last updated