Discord - Internal (User-Side Integration)

1. Claiming Discord-Based Missions

In the missions list or Get mission API, we send a flag to ensure the user has the account connected to go ahead with the flow. Use this flag to handle accordingly.

{
  "is_prerequisite_met" : false 
}

If the flag is false, connect the user's Discord account as the first step to process the missions. Use the Discord Connect API to connect the Discord account.

1.1. Connect Discord Mission

  • Use Discord OAuth to allow users to connect their discord account to your application.
  • Once connected, the frontend must send the discord_id to the backend API: https://loyaltydocs.getmojito.com/reference/discord-connect#/
  • API Endpoint:
    POST {tenant}/social/discord/user/connect
    Request Body:
    {
      "discord_id": "<USER_DISCORD_ID>",
      "user_reference" : "user-reference"
    }
    Response:
    {
      "message": "Discord Account connected successfully"
    }
  • Once authenticated, the user can claim this mission using the mission claim API.

Notes: For code snippet and examples, reference the Recipes here.


2. Redeeming Discord Rewards

  • In the rewards list or Get reward API, we send a flag to ensure the user has the account connected to go ahead with the flow. Use this flag to handle accordingly
{
  "is_prerequisite_met" : false 
}

2.1. Redeem Server Invite Reward

  • This provides an invite link to a Discord server similar to missions.
  • The user gets the unique server invite link as part of redeem API response and Redeem Status API response.
  • In a few cases, the redeem API returns the response once the redeem gets triggered and the user receives the invite link in status API. It is advisable to rely on the status API for the invite link.
  • {
    "custom_reward":{
      "discord_invite_link":"https://discord.gg/sYh8JQYQWC"
    	}
    }
  • Users can click the link and join to claim the reward.
  • Once joined, the system verifies their presence and completes the reward.
  • Redeeming the reward debits the associated points from the user balance.

2.2. Redeem a Role Reward

  • Users can redeem role assignment rewards using the redeem API.
  • The bot assigns the selected role to the user.
  • The system triggers the bot to grant the role once the user redeems the reward.
  • Redeeming the reward debits the associated points from the user balance.

Notes: For code snippets and examples, reference the Recipes here


What’s Next

For specific code snippet and example, verify the Recipes section..