A customer journey

Using the Wallet App API's we allow easy to use tools to interact with your members. In this Guide we will start of by signing up new members. To these new members we will assign a new storecard so they can start saving points. We will add some starting points to their storecard and send them a custom email template with the link to where the storecard can be downloaded.

Prerequisites

  • A Wallet App account

  • A Wallet App API key The API key will need the following scopes to complete this guide:

    • members.store
    • storecards.store
    • templates.get
    • templates.store
    • members.get
    • coupons.get
  • A List of email addresses that you want to use.


Step 1.a: Create a new template

The Wallet App API does not allow you to create an email template using the API. You will need to create the template in the Wallet App dashboard. You can find the template editor in the Wallet App dashboard under Marketing > Email templates. For this tutorial you need to include the *|link_to_storecard|* variable in the template. This will be replaced with a link to the storecard when the email is sent.

Step 1.b (optional): Create a new coupon

If you want to add a coupon to the email you can create a new coupon in the Wallet App dashboard under Products > Coupons. You can also create a coupon using the API. You can find the documentation for this endpoint here.

Step 2: Signing up the members

To sign up a block of new members we will use the bulk member import API.

Your request will look something like the following:

$client = new \GuzzleHttp\Client();
$client->get('https://api.walletapp.co/members/signups', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'Authorization' => 'Bearer <your_token>'
    ],
    "body" => [
        "brand_id" => "<brand_id>",
        "users" => [
            [
                "email" => "<email>",
                "first_name" => "<first_name>",
                "last_name" => "<last_name>",
                "unsubscribed" => "<unsubscribed>",
                "subscribed_at" => "<subscribed_at>"
            ]
        ]
    ],
    'timeout' => 5
]);

The Wallet App platform will validate if a member already exists if so, it will be skipped. So you dont have to worry about duplicate members.

Step 3: Assigning a storecard to the members

To assign a storecard to a member we will use the assign storecards API.

In the request you can provide some custom data to the storecard. You can add a custom qr_code and title on the pass.


$client = new \GuzzleHttp\Client();
$client->post('https://api.walletapp.co/bulk/storecards', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'Authorization' => 'Bearer <your_token>'
    ],
    "body" => [
        "brand_id" => "<brand_id>",
        "storecard_id" => "<storecard_id>",
        "webhook_url" => "<your_endpoints>",
        "users" => [
            [
                "identifier" => "<member_id>",
                "qr_code" => "<qr_code>",
                "pass_title" => "<custom_tilte>"
            ]
        ]
    ],
    'timeout' => 5
]);

Storecard webhook

The storecard webhook will be called when the storecards have been created. It is best practice to only continue to the next step when you received a webhook from the Wallet App platform. This will make sure that the storecards are created before you add / update points.

Step 4: Adding points to the storecard

To add points to the storecard we will use the add points API.

For this request you can provide a specific qr code to which the points need to be added or subtracted. If you dont provide a qr code the points will be added to the first storecard that is found for the member.


$client = new \GuzzleHttp\Client();
$client->post('https://api.walletapp.co/bulk/points', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'Authorization' => 'Bearer <your_token>'
    ],
    "body" => [
        "brand_id" => "<brand_id>",
        "storecard_id" => "<storecard_id>",
        "webhook_url" => "<your_endpoints>",
        "users" => [
            [
                "identifier" => "<member_id>",
                "qr_code" => "<qr_code>",
                "points" => "<points>"
            ]
        ]
    ],
    'timeout' => 5
]);

// once the webhook is received by you and handled accordingly you can continue to the next step

Step 5: Sending the email

To send the email we will use the send email API.

For this request you can provide custom merge tags These merge_tags will be replaced with the data that you provided in the request. To specify merge tags you can add the individual merge tag to the user object in the request. in the example below we have an email template with the following merge tags: *|first_name|*, *|last_name|*, *|link_to_storecard|*, *|coupon_code|*, *|coupon_code|*.

The coupon_code is a custom merge tag. This merge tag will be replaced with the coupon code that is provided in the request.


$client = new \GuzzleHttp\Client();
$client->post('https://api.walletapp.co/mails', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'Authorization' => 'Bearer <your_token>'
    ],
    "body" => [
        "brand_id" => "<brand_id>",
        "template_id" => "<template_id>",
        "webhook_url" => "<url>",
        "coupon_id" => "<coupon_id>",
        "users" => [ 
            [
                "identifier" => "<member_id>",
                "coupon_code" => "<tag>"        
            ],
            ...
        ]
    ],
    'timeout' => 5
]);

Conclusion

Managing members and sending mails can be easily done with our API's. If you have any questions or need help with the API's feel free to contact us at: support@walnutloyalty.com.