Quest verification API for in-app quests
Verify if your users completed your in-app or social quests across 20 chains and platforms.
Introduction
Setting up on-chain and social quests for your app can be tough, especially when dealing with APIs and verification. Take the example of adding a quest like "Follow us on Twitter to earn 10 points":
API Integration Challenges: It's tricky to connect with Twitter's API and figure out what their endpoints allow for.
Verification Complexity: Making sure users actually follow you on Twitter can be hard to manage.
The Domino Advantage:
Domino makes things much easier:
Automated API Integration: Domino handles the technical side of connecting to Twitter, saving you from figuring it out yourself.
Simplified Verification: A Domino Automation can take care of verifying user actions, like following on Twitter, without you needing to waste dev time.
With Domino, you save time and avoid mistakes, making the quest setup process smoother and more reliable.
Basics
Before you create an Automation, think about what type of quest you want to verify.
As always, start by breaking down the problem you're trying to solve into the following:
What apps do I want to use? (Webhooks, Twitter, Discord Etc.)
What event will trigger my Zap? (When my app calls a Webhook)
What action will my Zap perform? (Check if the user follows on Twitter)
What information do I want to move between those apps? "(Twitter usernames of my app and the user who needs to follow it)
Domino works with dozens of apps, but available triggers and actions vary by app. To learn more about what's possible with an app on Domino, search for the app in our Explore page.
We'll walk you through how to set up your Automation with our Verify if a user Follows on Twitter example. Here are the steps:
Set up your trigger step: Select your trigger app and event, connect to your app account and customize your trigger event, and test your trigger.
Set up your actions: Select your action app and event, connect to your app account and customize your action event, and test your action.
Need help setting up automation for your business? We'd love to help. Contact us directly on the support chat or at support@domino.run
Set up your trigger
The Automation builder is where you'll create new Automations and edit existing ones.
Remember: A trigger starts your Automation. (Think of it as the WHEN of any automation.)
Select your trigger app and event
When you open the Automation builder, you'll be prompted to pick an app as your trigger.
You'll see popular apps integrated into Domino and built-in apps from the team. You can select from one of these, or look for the app you want to use in the search bar. If you're starting from an Automation template, what we call a pre-made Automation , both the trigger and actions will be selected for you. In this case we want to trigger our automation with a Webhook.
What makes Domino's webhooks special?
Regular webhook allow very limited responses, e.g. "ok".
Domino lets you send back any response to the webhook, with data pulled from your Automation.
Next, you'll be asked to choose a trigger event. This is the event that happens in your trigger app that signals Domino to start your Automation. In this case, it's when an event is received on Webhook.
Customize your webhook trigger
Next, you'll customize your Webhook setup. As we want to receive a success/fail response based on whether the user is following us on Twitter, you want to pick Send Response Yes.
The Inputs will be the data you pass on to the Automation with the webhook. In our example this will be our Twitter username (e.g. get_domino) and the user's Twitter username (E.g. Vkalnoky). Add myTwitterId and userTwitterId as inputs. Both are String (text) type inputs.
Conditions would limit the trigger to only trigger when some conditions are met, as we want our automation to always trigger when the Webhook is called, we skip this part.
Next, take note of your webhook URL in the Sample section. You will call this Webhook, passing the myTwitterId and userTwitterId as inputs.
Before calling the webhook, you need to update and turn on your Automation.
Test Trigger
Update and turn on your Automation in the top right corner, and call your Webhook passing on the input data as specified earlier. This will give your automation sample inputs to use when testiing your Actions.
Set up your Actions
Select your first action app and event
Just like you did with your trigger, select your action app—this time by clicking the dropdown menu and searching for your app. Once you've selected your app, choose your action event—which is what you want your Automation to do—in the second dropdown menu. If you're using an Automation template, your action app and event will be pre-filled.
In our example, we want to check whether the user follows us on Twitter. That way we can decide to send back Success/Fail as a response to the Webhook call. Select the Twitter app, and then choose the Check Follower event. When you're done, click Continue.
Just like with trigger events, action events vary between different apps and app types. For example, one chat app might have an action event to "check follower" while another's event is called "get member".
Customize your action
Next, the Automation builder will prompt you to further customize your action event. Click on Setup to start customizing the Action.
In our example you'll have to input userTwitterId and myTwitterId from the Webhook trigger event into the Username and Target Username input fields in the Check Twitter follower Action. To do this, click on the Username input, select Event data, and click on userTwitterId. Repeat the same process for Target Username.
Note: The User ID and Target User ID fields take the numeric ID versions of Twitter usernames, you can use these if you have numeric user IDs.
Test the Check Follower Step
Click on Test step to see whether the User is following the Target User or not. The output of this Action is isFollowing true/false.
Set up Success and Fail Responses
Next we'll have to send back a Success or Fail response based whether isFollowing is true or not. To do this we need to set up and if/else logic:
If isFollowing is true, send back a Success response. If isFollowing is false, send back a Fail response
To create our if/else logic we need to add two Groups to our Automation. We'll name these the Quest Succeeded Group and the Quest Failed Group. The Quest Succeeded Group will contain a send success response action. To make sure the success response is only sent when isFollowing is true, we'll add an only continue if action in front of the send success response action inside the group.
We'll set up the Quest Failed Group the same way.
Create the Quest Succeeded Group
Set up the Quest Succeeded Group:
Click New Action and search for Group
Inside this group, add an Only Continue If action with the condition set to
isFollowing (Boolean)true
.Follow this action with a Send Response action to return a success message as a response to the Webhook call. The Status Code can be 200 and the Json body can return the user's Twitter Id:
Repeat the same steps for the Quest Failed Group but instead sending back Status Code 400 if isFollowing is (Boolean) false.
GIF 24 Setting up Fail Group
By setting up these groups in your automation, you will effectively be able to handle both scenarios where the user is following (success) and not following (failure).
Test the Automation
Now that everything is set up, Update and Turn-on your Automation. Once turned on, you can call the Webhook URL, passing on the payload and monitor runs in the Automation history by clicking the clock icon in th top right corner in the Automation builder.
Last updated