Passkit

Introduction

Passkit enables you to extend your mobile reach by integrating Apple Wallet, and Google Pay passes into your customer’s experience. Easily create, manage, distribute, and analyze the performance of digital coupons, loyalty cards, membership cards, tickets, and much more; without your customers needing another app.

MoEngage <> Passkit

The MoEngage and Passkit integration can help extend your loyalty or coupon program by sending passes generated by Passkit to your audience through MoEngage campaigns. 

With this integration, you can - 

  1. Send Pass Interaction Events from Passkit to MoEngage.
  2. Create passes on the fly using Passkit's SmartPass Links.

Integration Prerequisites 

  • Ensure you have access to your Passkit account. 
  • Ensure you have your MoEngage Data API keys. 
  • We have revamped our dashboard settings UI. The Data API ID and Data API Key are available in the following navigations in the new and old UIs.
    • Revamped UI - You can access the Data API ID  in Settings -> Account -> APIs . The Data API ID is the same as the Workspace ID. The Data API Key is available in the same screen in the API Keys -> Data section.
    • Old UI -> You can access the Data API ID and Data API Key in Settings -> App Settings -> APIs -> Data API Settings.

Send Pass Interaction Events from Passkit to MoEngage

You can enhance your customer's mobile wallet experiences by opting to pass data to MoEngage from within your Passkit dashboard. The example of data points that can be shared: 

  1. Pass created : Will track an event when a new pass is created.
  2. Pass updated: Will track an event when a pass is updated.
  3. Pass installed : Will track an event when a user adds a pass into their digital wallet.
  4. Pass deleted : Will track an event when a member record is deleted.
  5. Pass uninstalled : Will track an event when a user removes a pass from their wallet.
  6. Pass invalidated : Will track an event when a pass record is invalidated.

Once the data is passed into MoEngage, you can create segments, send personalized content and trigger campaigns once these actions have been performed.

Step 1: Retrieve MoEngage Data API credentials

From the MoEngage Dashboard, make a note of your Workspace ID and Data API Key.

Field Description 
Workspace ID

The Workspace ID of your MoEngage account is available in the following navigations in the revamped and old UIs:

  1. Revamped UI:  Settings -> Account -> APIs -> Workspace ID.
  2. Old UI: You can find this by navigating to Settings -> App Settings -> APIs -> Data API Settings.

The Data API ID and the Workspace ID of your MoEngage account are the same.

Data API Key The Data API key of your MoEngage account is available in the following navigations in the revamped and old UIs:
  1. Revamped UI:  Settings -> App Settings -> APIs -> API Keys -> Data
  2. Old UI: You can find this by navigating to Settings -> App Settings -> APIs -> Data API Settings.

Step 2: Configure MoEngage Integration on Passkit

  1. Login to your Passkit Dashboard. Navigate to the campaign whose events you want to track.
  2. Inside the campaign, go to Settings >> Integrations tab (next to Campaign Details).Step1.png
  3. Select MoEngage from the list. Click the Configure button. Step2.png
  4. Fill in the form: 
    • Enter API key (copied from Step 1) 
    • Enter Workspace ID (copied from Step 1) 
    • Provide a name to identify your MoEngage account
    • Select data center- Read more about MoEngage data centers 
      Screenshot_2022-06-24_at_12.19.43_AM.png  
  5. Enable Integration toggle
  6. Select the Pass events what you can to use in MoEngage to trigger or personalize your campaigns with.
  7. Click "Save". 

Step 3: Tracking Events in MoEngage

Now you can create custom segments based on Passkit events or use them in MoEngage campaigns.  

Step5.png

Create passes on the fly using Passkit's SmartPass Links

You can create passes for your users dynamically using MoEngage's Templating Language and calling the SmartPass Links provided by Passkit which is then used to create on-the-fly passes using specially hashed URLs. To read more about how these links work, visit Passkit's Generating hashed SmartPass links.

Prerequisites

In order to build your SmartPass Links, you will need the following:

  1. Passkit URL - You can get this from Distribution >> SmartPass Settings in PassKit Dashboard.
  2. PassKit Secret - Each PassKit project has a unique secret that is used for creating a signature HMAC hash of the link. You can find this under the Distribution tab >> Generate Pass Links >> Commmand Line Tool inside your Passkit Dashboard.
  3. Program (or project) ID - Your PassKit Program ID will be under the Settings tab of your project or program.

Step 1: Get your Passkit Program/Project URL

Your Passkit Program/Project URL will be on the distribution tab of your Passkit project. Make a new variable with the value being this URL:

{% set projectUrl = "https://pub1.pskt.io/c/a4hrop" %}

Step 2: Generate your payload

The payload can contain the coupon / member, PII & meta data that needs to go into the pass record:

JSON
{ 
    "person.externalId": "UserAttribute['MoEngage_ID']",
    "person.forename": "UserAttribute['First Name']", 
    "person.surname": "UserAttribute['Last Name']", 
    "person.emailAddress": "UserAttribute['Email (Standard)'] ",
    "person.displayName": "UserAttribute['First Name']" + " " + "UserAttribute['Last Name']", 
    "person.mobileNumber": "UserAttribute['Mobile Number (Standard)']"
}

For a full list of supported fields have a look here: https://github.com/PassKit/smart-pass-link-from-csv-generator#available-field-names

For this tutorial, we will use the above payload. We now need to convert this payload into the JINJA -compatible format and store it inside a separate variable:

JINJA
{% set passData = "{\"person.externalId\": \"" + UserAttribute['MoEngage_ID']|default('12345') + "\",\"person.surname\": \"" + UserAttribute['Last Name'] + "\",\"person.forename\": \"" + UserAttribute['First Name'] + "\",\"person.emailAddress\": \"" + UserAttribute['Email (Standard)'] + "\",\"person.displayName\":\"" + UserAttribute['First Name'] + " " + UserAttribute['Last Name'] + "\",\"person.mobileNumber\":\"" + UserAttribute['Mobile Number (Standard)'] + "\",}\"" %}

Double-check the quotation marks as well as the syntax to ensure the email is correctly parsed.

Step 3: Encode your payload

The next step is to encode your payload into a base64 format:

{% set base64JsonPayload = passData|base64encode %}

Step 4: Create your URL string

Once you have the encoded payload, your final URL string should be in this format:

https://pub1.pskt.io/c/{programId or campaignId}?data={base64JsonPayload}&sig={signatureHash}

To do this, make use of our templating language:

{% set url = projectUrl + "?data=" + base64JsonPayload %}

Step 5: Generate a hash for the entire URL

Each PassKit project has a unique secret that is used for creating a signature HMAC hash of the link. You can find this under the Distribution tab in your Passkit Dashboard.

Step11.png

For the above sample let's create a SHA256 HMAC of the sample link:

{% set sig = url|convertToSHA256('{YOUR-PROJECT-SECRET}') %}

Step 6: Create the final SmartPass URL

Now all you need to do is stitch all the above variables together to form the SmartPass URL:

{% set longURL = projectUrl + "?data=" + base64JsonPayload + "&sig=" + sig %}

Step 7: Use this link in your campaigns

Your final code will look something like this:

JINJA
{% set projectUrl = "https://pub1.pskt.io/c/a4hrop" %}
{% set passData = "{\"person.externalId\": \"" + UserAttribute['MoEngage_ID']|default('12345') + "\",\"person.surname\": \"" + UserAttribute['Last Name'] + "\",\"person.forename\": \"" + UserAttribute['First Name'] + "\",\"person.emailAddress\": \"" + UserAttribute['Email (Standard)'] + "\",\"person.displayName\":\"" + UserAttribute['First Name'] + " " + UserAttribute['Last Name'] + "\",\"person.mobileNumber\":\"" + UserAttribute['Mobile Number (Standard)'] + "\",}\"" %}
{% set base64JsonPayload = passData|base64encode %}
{% set url = projectUrl + "?data=" + base64JsonPayload %}
{% set sig = url|convertToSHA256('0WfoVtZ7MrJSfrHVuiESxZ') %}
{% set longURL = projectUrl + "?data=" + base64JsonPayload + "&sig=" + sig %}

Add a Save Pass Button according to your design specifications from Google (Android) and Apple (iOS) respectively.

  1. Insert a new image inside your template. 
  2. In our File Manager, click on "Import" and then select URL.
    importimage.png

For your reference, here are the URLs:

For Android,

https://messagecontent-public.s3.amazonaws.com/wallet/add-to-wallet-buttons/Save_to_Google_Pay.svg

For Apple,

https://messagecontent-public.s3.amazonaws.com/wallet/add-to-wallet-buttons/Add_to_Apple_Wallet.svg

3. Select the appropriate image to show.

4. In the URL section, type:

{{longURL}}

Step12.png

Now you are all set. You can test the campaign and verify.

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?