Here you’ll integrate your backend web application with Trophy and start building your first gamified feature.

1

Create your Trophy account

First, create a new account if you don’t already have one and head into the Trophy dashboard.

Head through onboarding to get your account set up.

2

Add the Trophy SDK to your backend

We have SDK libraries available in most major programming languages but if you don’t see yours listed, let us know and we’ll make one!

npm install @trophyso/node

Alternatively, you can directly call the API using any server-side HTTP library.

3

Set up environment

Add your API key that you created during onboarding (or create a new one) as an environment variable in your backend application:

TROPHY_API_KEY='*******'

Make sure to pass this API key to the Trophy SDK or to your API client to authenticate.

4

Create your first metric

All gamification features, like Achievements, Streaks and Emails, are driven by user interactions. In Trophy, you use Metrics to define those interactions and Events to track them.

Here you’ll create your first metric to get started. In thr Trophy dashboard, head into the metrics page and hit the New Metric button:

Give the metric a name and hit Save.

5

Integrate the metric into your backend

Once you’ve created your metric, head to the configure tab and copy it’s unique API reference key.

To track an event against this metric when a user interacts with your product, call the metric change event API, passing along details of the user that made the interaction. In this example the metric key would be words-written:

curl -X POST https://app.trophy.so/api/metrics/words-written/event \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "user": {
    "id": "18",
    "email": "user@example.com",
    "tz": "Europe/London"
  },
  "value": 750
}'

By making this call, you’re telling Trophy that a specific user made an interaction with your product. As a result, Trophy will process any gamification features that you’ve configured against the metric automatically.

6

Continue building your gamification experience

With a metric integrated into your backend, you’re ready to start adding gamification features to your product.

Follow the links below to learn more about each feature you can build with Trophy:

Or, explore our ready-made APIs that support building any in-app gamification UI you want.

Get Support

Want to get in touch with the Trophy team? Reach out to us via email. We’re here to help!