Punchh

Introduction

Punchh is a loyalty and engagement platform that empowers brands to deliver omnichannel customer loyalty programs both in-store and online.

MoEngage <> Punchh

Using MoEngage and Punchh together, you can sync data between the two platforms to empower your loyalty and coupon workflows. With this integration, you can:

  • Forward loyalty data from Punchh to MoEngage in real-time
  • Capture new users inside MoEngage and send them to Punchh to create personalized loyalty programs for them
  • Display dynamic coupon codes generated on Punchh inside MoEngage Campaigns

Integration

library_add_check

Prerequisites

  • Access to your Punchh Dashboard.
  • Access to your Punchh APIs and Webhooks Manager. Contact your Punchh representative if you donot have access to Punchh Webhook Manager. 
  • Access to your MoEngage Dashboard.

Forward events from Punchh to MoEngage

Step 1: Add external_source_id to Punchh users

Before you begin the integration, ensure you have set the external_source_id field when you create new users inside Punchh. This will act as the common identifier between the two platforms and will be synced to the ID field of MoEngage user profiles.

Punchh offers several endpoints for updating your users' external_source_ids. The Punchh help docs explain how to set them up for new and existing users.

Step 2: Get your MoEngage endpoint

Please reach to to your MoEngage Customer Success Manager to help you with get a dedicated endpoint that needs to setup in Punchh.

Step 3: Set up your endpoint as a webhook in Punchh

If you already have access to the Webhooks Manager,

  1. On your Punchh Dashboard's Left Navigation >> Webhook Manager.
  2. In the Webhooks section, an admin needs to click the Base URL button to set up the base URL and name. This base URL will be displayed while setting up the webhook. Your Base URL will depend on your MoEngage Data Center:

Data Center Region Base URL
DC-01 https://api-01.moengage.com
DC-02 https://api-02.moengage.com
DC-03 https://api-03.moengage.com
DC-04 https://api-04.moengage.com
  1.  In the Webhooks section, create a new webhook by clicking the Create Webhook button:
Field Description

Name

Enter an identifiable name and description for this Webhook, example, "MoEngage".

 

Description

Base URL

Select the MoEngage Base URL you created above.

Webhook Endpoint

Enter the rest of the MoEngage Endpoint provided to you by your Customer Success Manager.

Example:

/v1/partner/punchh/events/?configName=xxxx

Authentication

Select "Basic" as the authentication method.

Username

Enter the the Workspace ID of your MoEngage Workspace. It is available in the following navigations in the revamped and old UIs:

  • Revamped UI: Settings -> Account -> APIs -> Workspace ID.
  • 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.

Password

Enter the Secret Key of your MoEngage Workspace. Secret key is the Data API key of your MoEngage account, which is available in the following navigations in the revamped and old UIs:

  • Revamped UI: Settings -> App Settings -> APIs -> API Keys -> Data
  • Old UI: You can find this by navigating to Settings -> App Settings -> APIs -> Data API Settings


Events Selection

Select the events you want to forward to MoEngage.

  1. Click the Submit button to save it. In case of any issue, it will display an error message.
  2. If verification is completed during creation, the webhook will be ready to receive the subscribed events with “Active” status. If verification is not successful, the status will remain “Inactive” and no data will be pushed to that webhook.
  3. From the webhooks list, you can select another operation via the ellipsis button in the Actions column to test with some dummy event samples. You can also edit or delete webhooks from here and see logs specific to the selected webhook.

Events available to export to MoEngage

  1. Users
  2. Loyalty check-ins
  3. Gift check-ins
  4. Redemptions
  5. Rewards
  6. Redeemables
  7. Marketing notifications
  8. Transactional notifications
  9. Coupons

An updated list of events that can be exported is found here.

Step 4: Find your events in MoEngage

Below is the meta data that is added to each of the events coming from Punchh:

MoEngage Event Attribute Punchh Value Description
Event name event_name Name of the event such as user, check-ins, redemption, etc.
event_type event_type Type of the event (e.g., gift or loyalty for check-ins, etc.)
Event time timestamp UTC epoch (in milliseconds) when the message is created
business_id business_id Business identification at the Punchh platform
business_uuid business_uuid UUID of the business configured in the Punchh platform. This code is used for POS integration.
business_slug business_slug Unique identifier or label for a business in the URL set up for iFrame on the Punchh side. The slug is configured in the Punchh platform. Contact your Punchh representative to update this Punchh platform configuration.
action action Operation associated with the event (e.g., create/update/delete for user, POS/console/online for check-ins, etc.)
user user The user properties associated with the Punchh user who performed this action.

Once the events are in MoEngage, you can create segments using MoEngage's powerful Segmentation capabilities and perform Analytics to gain even deeper actional insights. 

Create users in Punchh from MoEngage

To create a connector campaign on MoEngage, 

1. Navigate to Create Campaign > Connectors > Custom and choose the delivery type most suitable to your needs

2. On step 2 of the campaign 

Call the Punchh Signup API

To create a new user on Punchh, use the POST method and configure the payload.

  • Select the method as POST
  • Headers:
    • Accept: application/json
    • Content-Type: application/json
    • User-Agent: {{ UserAttribute['User Agent'] }}
    • punchh-app-device-id: {{ UserAttribute['GAID'] }}
    • x-pch-digest: {% set payload = "{\"client\":\"CLIENT\",\"user\":{\"email\":\"{{UserAttribute['Email (Standard)']}}\",\"password\":\"{{UserAttribute['First Name']}}+xyz123\",\"first_name\":\"{{UserAttribute['First Name']}}\",\"last_name\":\"{{UserAttribute['Last Name']}}\",\"terms_and_conditions\":\"true\",\"zip_code\":\"{{UserAttribute['Last Known Pincode']}}\",\"birthday\":\"{{UserAttribute['Birthday']}}\",\"external_source\":\"customer_id\",\"external_source_id\":\"{{UserAttribute['Email (Standard)']}}\"}}" %}{% set base = "/api2/mobile/users" %}{% set sec = base + payload }{% set sig = sec|convertToSHA256NoSalt() %}{{ sig }}
  • Add the endpoint as Webhook URL: https://<server_name>.punchh.com
    /api2/mobile/users
  • Body:
    Create contact
    {
          "client": "CLIENT",
          "user": {
                "email": "{{UserAttribute['Email (Standard)']}}",
                "password": "{{UserAttribute['First Name']}}+xyz123",
                "first_name": "{{UserAttribute['First Name']}}",
                "last_name": "{{UserAttribute['Last Name']}}",
                "terms_and_conditions": "true",
                "zip_code": "{{UserAttribute['Last Known Pincode']}}",
                "birthday": "{{UserAttribute['Birthday']}}",
                "external_source": "customer_id",
                "external_source_id": "{{UserAttribute['Email (Standard)']}}"
          }
    }

Preview your request 

At this point, your campaign should be ready to test and send. You can also test your connector configuration using the Test functionality available in Step 2 of Create Connector Campaign.Screen_Shot_2022-02-22_at_11.12.42_AM.png

You can go ahead and Publish the campaign.

Previous

Next

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

How can we improve this article?