Loyalty Point System: A Step-by-Step Guide

Create, manage, and distribute rewards using API and Discord commands.

Operation Team avatar
Written by Operation Team
Updated over a week ago

Galxe's Loyalty Point System offers a variety of features to incentivize and reward community engagement, including a point-based reward system, customizable rewards, gamification techniques, analytics and reporting tools. The benefits of implementing such a system include increased engagement, improved retention rates, enhanced brand advocacy, and better insights into user behavior.

This user guide covers creating, managing, and distributing points for customized loyalty program tasks using Galxe's API and Discord bot commands. However, it is important to note that the verification of users' call-to-actions must be completed before distributing points.


How to use

To use the following APIs, you'll need an access token. The API endpoint is located at https://graphigo.prd.galaxy.eco.

In order to retrieve information about a "space", such as its "space id", you can use the "query" parameter.


Prerequisite

Before accessing the API for task management and point distribution, you must generate an access token. To do this, go to the Galxe user setting page.

The access token must be included in the header of your API requests using the following format:

{ 
"access-token": "your_token_here"
}

Task Creation

Creating a task is an essential step to enable users to earn points by completing a specific action. To award points to a user, you must provide the task ID. Here's how you can create a custom task for your Space:

Required Parameters:

Title: The title of the task.

Description: A brief description of the task.

Link: A link to the task.

Points: The number of points to be awarded upon task completion.

Tag: The task's associated tag or category.

StartTime: The date and time when the task becomes available.

Example API Request:


mutation createTask {
createTailoredTask(input: {
title: "Connect to Galxe"
description: "A user who connected to Galxe.com"
link: "your_link"
spaceId: 2
tag: Once
points: 10
startTime: 0
}) {
id
title
description
link
spaceId
tag
points
startTime
}
}

Example API Response

{
"data": {
"createTailoredTask": {
"id": "26",
"title": "Connect to Galxe",
"description": "A user who connected to Galxe.com",
"link": "your_link",
"spaceId": 2,
"tag": "Once",
"points": 10,
"startTime": 0
}
}
}


Task Modification

If you need to update a task's information, you can make a graphigo API request with the task's unique identifier and the updated parameters. This allows you to change the task's title, points, description, tag, or start time. Make sure you include all the required parameters when making the request.

Example API Request:

mutation updateTask {
updateTailoredTask(input: {
id: 26
title: "update task title"
description: "desc"
link: "your_link",
points: 10
tag: Once,
startTime: 0
})
}

Example API Response:

{
"data": {
"updateTailoredTask": true
}
}


Task Deletion

To delete a task from your Space, you can make a graphigo API request with the task's unique identifier. This request will remove the task permanently and its associated points from the Space. Make sure you have the correct task ID before proceeding with the deletion.

Example API Request:

mutation deleteTask {
deleteTailoredTask(id: 26)
}

Retrieving All Tasks for a Space

To retrieve a list of all tasks associated with a specific space, you can use the graphigo API by making a request that includes the space ID. The API will then return a list of all the tasks associated with that space, including their titles, descriptions, links, and other details. This can be useful for analyzing the performance of your space and the engagement of your users.

Example API Request:

query tasks {
space(id: 2) {
tailoredTasks {
list {
id
title
description
link
tag
points
spaceId
startTime
}
}
}
}

Example API Response:

{
"data": {
"space": {
"tailoredTasks": {
"list": [
{
"id": "25",
"title": "test task",
"description": "desc",
"link": "your_link",
"tag": "Once",
"points": 10,
"spaceId": 2,
"startTime": 0
}
]
}
}
}
}


Distributing Points via API

To distribute points to users, you can make an API request using a GraphQL mutation with your access token. In the mutation, you must include the task ID and a list of addresses to which points will be distributed. Please note that the list of addresses should not exceed 200.

Example API Request:

mutation {
claimTailoredTaskLoyaltyPoints(id: 25, addresses:["0x447D24B00937BCc3fE5768c828fb2fae52c3e8C5", "0xaC1F963Ed7454d0D3295786E4Bcc47B961918C63"])
}

Example API Response:

{
"data": {
"claimTailoredTaskLoyaltyPoints": true
}
}

Distributing Points via Discord Bot Commands

Distributing points to users via Galxe Discord bot commands is a straightforward process. However, before using this method, you must first create some tasks through our API. Here are the steps to follow:

  1. Invite the Galxe bot to your server using the provided invitation link based on your environment.

    https://discord.com/oauth2/authorize?client_id=947863296789323776&permissions=2417034321&scope=bot%20applications.commands

  2. Set up the bot commands by executing the following command:

    /add-galxe-bot-commands

  3. Use the /give-task-points command to distribute points to users by specifying the task ID and the user's Discord handle as parameters. An example command is:

    /give-task-points task-id:2 handle:@user
Did this answer your question?