Discord Integration
Reward users with points when they receive Discord roles
Example: Automatically issue points to users when they are assigned specific roles in your Discord server using Zapier and Absinthe’s API. Simply modify the Zapier Trigger from Discord Role to any other Discord Trigger to award points for other discord events
Setting Up Discord Role Assignment Listener
To reward users with points when they receive a specific role in your Discord server, you’ll need to set up a Zap in Zapier that listens for role assignment events and then triggers a point issuance through Absinthe’s API.
Create a New Zap in Zapier
Log in to your Zapier account and click on “Create Zap”.
Choose Discord as the Trigger App
Search for “Discord” in the app selection and choose it as your trigger app.
Select the 'New Role Assigned to Member' Event
From the list of Discord events, select “New Role Assigned to Member”.
Connect Your Discord Account
If you haven’t already, you’ll need to connect your Discord account to Zapier. Follow the prompts to authorize Zapier to access your Discord server.
Choose the Discord Server
Select the specific Discord server you want to monitor for assignments.
Test the Discord Trigger
Zapier will attempt to find a recent role assignment to test the trigger. If successful, proceed to the next step.
Add a 'Run JavaScript' Action
For the action step, search for and select “Run JavaScript” by Zapier.
Set Up the JavaScript Action Data
In the Input Data field of the Run JavaScript action, you’ll set the key name to a recognizable name of your choice, for example: user_discord_id and the value to the User Id from the value field dropdown. Then you will create another Input Data field, set the key to role_granted, and the value to “Changes New Value Name” which holds the role name.
Set Up the JavaScript Action Code
In the Code field of the Run JavaScript action, you’ll paste and modify the provided JavaScript code to issue points through Absinthe’s API. Insert the API KEY we provided you to the “bearerToken” variable in the code where it says “your_api_token_here”. Then, set up the amount of points you want to assign for conditions such as the role granted, under the section “set up points based on conditions”.
Custom JavaScript Action
Use the given JavaScript code in your Zapier “Run JavaScript” action to issue points when a Discord role is assigned:
Customizing the Action
Modify the JavaScript code to suit your specific needs:
Adjust the amount of points issued for each role assignment. Customize the event_name to distinguish between different Discord events.
Ensure you’re passing the necessary data (Discord user ID, role name, server name) from the Discord trigger step to the JavaScript action in Zapier.
Best Practices When setting up this Discord role assignment integration:
Use a clear and consistent event_name (e.g., “discord_role_assigned_moderator”) for easy tracking.
By following this guide, you can create a seamless integration between Discord role assignments and your Absinthe points system, automatically rewarding users for their engagement and roles within your community.