The official Trophy .NET library.
Trophy provides APIs and tools for adding gamification to your application, keeping users engaged through rewards, achievements, streaks, and personalized communication.
Using the .NET Core command-line interface (CLI) tools:
dotnet add package Trophy
Using the NuGet Command Line Interface (CLI):
nuget install Trophy
Using the Package Manager Console:
Install-Package Trophy
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "Trophy".
- Click on the Trophy package, select the appropriate version in the right-tab and click Install.
The package needs to be configured with your account's API key, which is available in the Trophy web interface. Set the API key with the following:
using TrophyApi;
var trophy = new TrophyApiClient("YOUR_API_KEY");
Then you can access the Trophy API through the trophy
client. For example, you can send a metric
event:
var user = new EventRequestUser {
Id = "18",
Email = "[email protected]"
};
var request = new MetricsEventRequest {
User = user,
Value = 750
};
await trophy.Metrics.EventAsync("words-written", request);
See the Trophy API Docs for more information on the accessible endpoints.