backBack

Employee program guide

Piggy loyalty software is also quite suitable for creating employee loyalty programs. Instead of equating credits to money spent, you can get creative with how you'd like to motivate your employees.

The first thing to ask yourself is: what behaviour do you want to reward? What's the goal of your loyalty program? Once you've answered that question, all you need to do is find a good metric to measure that goal or behaviour. You can then award credits based on those metrics.

We've drawn up a (by no means exhaustive) list of possible metrics which you might want to consider:

  1. Time with the company: If your main goal is decreasing turnover, rewarding your employees for sticking with your company, then simply adding credits to their balance every week or month might suit your needs. You can also consider awarding bonus credits for anniversaries and such.
  2. Hours worked: Rewarding the number of hours worked serves the same goal as time with the company, but it segments the workers by the number of hours worked. It can make sense to have fulltime workers rewarded more heavily than parttime workers.
  3. Feats & achievements: Boosting performance and motivation could be achieved by rewarding certain feats and achievements, such as previously set goals being accomplished, extraordinary feats or maybe stuff like 'Employee of the Month'.
  4. Kilometers: If your aim is to reward environmentally sound behaviour, metrics like kilometers travelled by bicycle or on foot can serve your goal.
  5. Calories burnt: Promoting healthy behaviour can be done by awarding points based on exercise, like calories burnt.



Building the integration

Follow these steps to set up your integration with our Loyalty product. Please note that the Marketing and Giftcards aspects are not (yet) included in these steps.

Create a Piggy account

You can create a Piggy account free of charge, if you don't have one already. Testing for integrations is done on our production environment, so you can go ahead and first create a User via this link.

After creating a user, you're automatically asked to create a business account after logging in. You can now setup some basics, such as creating shops (the first one will already be created for you) if needed, or inviting more users to join the account.


Modules

To do really anything in the Piggy Business Dashboard, you need to have (some) modules enabled. It depends entirely on the scope of your envisioned integration which you need. Do you want to integrate with our loyalty product only, or with marketing and giftcards as well? Either way, you can just ask us for the modules, we'll turn them on for you so you can start testing. Simply send us an email to partners@piggy.eu. We'll let you know once the modules are turned on so you can get going.


Create a Loyalty program

For the sake of this guide, we'll stick with loyalty only. You can checkout our marketing and giftcards guides later.

To create a loyalty program, go to Loyalty where you can create a new program. Don't forget to link it to the appropriate shops, it's required for creating transactions later on. After creation, we recommend you create a couple of rewards to test with later. Of course, you can skip this for now and come back to this once you've arrived at the 'rewards' step.


Creating an OAuth Client

For OAuth authentication, log into your account in the Piggy Business Dashboard and go to Integrations, then OAuth Clients. You can create a new OAuth client here. The Client ID and Secret will be generated for you. You give it a name of your own if you like. The redirect URL can be disregarded, as this will be deprecated in the near future.


Request an Access Token

Using the Client ID and Secret obtained before, you can now do an API call to the Piggy server to receive an Access Token: https://api.piggy.nl/oauth/token. Use the following payload:

1 2 3 4 5 { "grant_type": "client_credentials", "client_id": "{{ your-client-id }}", "client_secret": "{{ your-client-secret }}" }

Manage token expiration

As our access tokens expire at some point, your application will need to manage this and request new access tokens to keep the application operational. You can either calculate the expiration time yourself, which is given in the initial credit credentials response, or use proper error handling to request a new access token on receiving a invalid_token error.


Build the authentication into your back-office / dashboard

In case you're not building this integration just for yourself, you need not bother with this. If, however, you're building this integration to be used and installed by other users, you'll probably need to build a way of doing the authentication as explained above in the back-office. Say you're building a specific application for this, we recommend having the first step of the application be the authentication part, in which simply two form fields.

back-office-1

Adding Members to your loyalty program

Getting your employees into your member list can be done in several ways, one of which is using our import function directly in the Business Dashboard. In your loyalty program, go to Members and click 'Add' to import a CSV file containing your employees.

You can also add your employees through API, using the Create MemberAPI call. Of course, this may be more cumbersome than using an initial import and manually adding any new employees.

Custom Attributes

When you create a new loyalty program, some initial basic attributes in there. For any other attributes you may want to document and use, such as 'department', 'Fulltime/Parttime' et cetera, you can create your own custom attributes. The creation of these are done in the Business Dashboard in your loyalty program. They can then be used both in imports and API calls.

Logic behind awarding credits

In most of our retail loyalty programs, the basic logic behind awarding credits is to equate every euro spent to one credit. You can use the same set of rules, basically awarding one credit per hour worked or day with the company. You can also, however, think of any other rule to awarding credits. What this logic is, is up to you. Where you define the rules, is also up to you.

You can either create a rules system on your own, in your own system, or you can use our ready-made system. In the Business Dashboard, you can create your own set of rules, with filters. These are usually extensive enough for your uses.

Creating credit receptions

Once you've defined your loyalty rules and have members in your loyalty program, you can start awarding credits by creating credit receptions, using the Create Credit Reception API call. If you've defined your loyalty rules in your own system, you can simply set the 'credits' in the API call. If you've defined your loyalty rules in the Business Dashboard, you'll want to set the 'purchase amount' instead. By doing so, the loyalty rules will be applied to calculate the number of credits to be added to the mamber in question. Please note: we are developing custom units at the moment. This will mean that you can set your own units of measurement, which is especially helpful if you want to issue credits based on more than one metric (e.g. both on hours worked and calories burnt). Once this has been implemented, 'purchase amount' will be replaced by a 'value' variable and a 'unit' variable. For the time being, please use 'purchase amount' instead, even if this does not accurately reflect your metric.

Option 1: Rely on the Piggy Customer App

The functionality to display rewards and have your users claim those rewards once they've saved up sufficient credits, is already built into the Piggy Customer App. For a proof of concept, or if you want to keep things simple, we recommend relying on the app.

Options 2: Build the claim functionality into your system

You may also choose to build the rewards into your own system. Using the Get Rewards API call, you can build up a list of the rewards and output them to your members. You can then use the Create Reward Reception API call to have your members claim a rewards in exchange for credits. We do highly recommend you have some sort of authentication built into your system, to make sure the person in question is actually the member who's claiming the reward. Of course, if you have this system put behind a log in barrier, you're already there.

Optional

Most employee administration already has some sort of profile built in. If this is the case, you can use the Update Member API call to update their attributes in the loyalty program anytime they (or HR) change something in their profile.

In case you don't have something of the sort just yet, but you'd like to have it, you can also display the member's profile defined in the loyalty program, using a Get Member API call and outputting these. If you render them as a form, they can then be updated as stated above.