Quests CLI
Use the Quests CLI to create, list, activate and deactivate your Quests. And also, you can use the CLI to open up the Quests Manager .
Before you can use the Quests CLI, ensure you have all the dependencies installed, and familiarize yourself with Decentraland’s CLI. Read Using the CLI .
Wallet signatures #
Before going into detail about each command, you should know that each command will require your signature (Ethereum Signature). The CLI uses this to generate the authchain and interact with the Quests Server . To do that, the CLI will open the “Linker dApp” in your browser and ask you to sign a message.
Open up the Quest Manager #
The Quests Manager is a web app that allows you to create, edit and handle your quests, all via UI. With this tool you can avoid using the CLI and editing the quest JSON file manually.
To open up the Quests Manager, use the following command:
$ npx @dcl/sdk-commands quests -m
Or
$ npx @dcl/sdk-commands quests --manager
A browser window will open up with the Quests Manager. If you are not logged in, you will be asked to do so. Once you are logged in, you can see all the Quests you created, edit them, activate or deactivate them. You can also create new ones using the Quests Designer .
For more documentation and details about the Quests Manager, read Quests Manager .
Create a new quest #
To create a new quest, you can use two different commands:
Create a new Quest via prompts #
$ npx @dcl/sdk-commands quests --create
The above command runs through a series of prompts to create a new Quest. You will be asked to provide the following information:
- Quest name: type the name for your Quest. It should be longer than 5 chars.
$ ? How do you want to name your Quest? >
- Quest description: type a description for your Quest. It should be longer than 5 chars.
$ ? Give a description to your Quest >
- Quest image: insert an image URL to display your Quest on Explorer. It should be a valid URL.
$ ? Image URL to display your Quest >
- Quest definition: Paste the JSON definition. It should consist of a JSON with valid Steps and a Connections section. For a better experience, it should be minified/compacted.
$ ? Paste the Defintion (Steps & Connections) of your Quest >
💡 Tip: Find more information about the JSON’s required structure here .
An example of this:
{"steps":[{"id":"Step-1","description":"","tasks":[{"id":"Step-1_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_1"}}]}]},{"id":"Step-2","description":"","tasks":[{"id":"Step-2_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_2"}}]}]},{"id":"Step-3","description":"","tasks":[{"id":"Step-3_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_3"}}]}]}],"connections":[{"stepFrom":"Step-1","stepTo":"Step-3"},{"stepFrom":"Step-2","stepTo":"Step-3"}]}
$ ? Paste the Defintion (Steps & Connections) of your Quest > {"steps":[{"id":"Step-1","description":"","tasks":[{"id":"Step-1_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_1"}}]}]},{"id":"Step-2","description":"","tasks":[{"id":"Step-2_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_2"}}]}]},{"id":"Step-3","description":"","tasks":[{"id":"Step-3_0","description":"","actionItems":[{"type":"CUSTOM","parameters":{"id":"CUSTOM_3"}}]}]}],"connections":[{"stepFrom":"Step-1","stepTo":"Step-3"},{"stepFrom":"Step-2","stepTo":"Step-3"}]}
After this, the CLI will ask you if you want to give rewards to the players:
$ ? Do you want to give rewards to the players? > (y/N)
If you type: n
, the creation will be done and the “Linker dApp” will be opened so that you can sign the action with your Wallet.
If you type: y
, you will be asked to provide the following information:
- Quest Reward Webhook URL: Insert the webhook URL to send notifications when a user completes your Quest. It should be a valid URL. The URL can include placeholders as defined in the examples here or in the rewards documentation here
$ ? Insert the Webhook URL of your Rewards Server >
After this, the CLI will ask you if you want a request payload to be sent to your webhook when a player completes your Quest:
$ ? Do you want to send a request body to your webhook? > (y/N)
If you type: n
, you will be asked to provide the reward items information (this is described below).
If you type: y
, you will be asked to provide the following information:
- Quest Reward Webhook’s request body: Insert a JSON to be sent as the payload to your webhook when a player completes your Quest. It should be a valid JSON. For a better experience, it should be minified/compacted.
💡 Tip: You can make use of the placeholders as are defined in the examples here or in the rewards documentation here .
$ ? Insert the request body to send within POST request to your webhook >
After this, you will be asked to provide the reward items information:
First, how many items do you want to give to the user that completes the Quest. It should be a number, greater than 0:
$ ? How many items the user will receive? >
Then, for each item, you will be asked to provide the following information:
- Item name: type the name for your item. It should be 3 chars long or more.
$ ? What is the name of your {THE_ITEM_NUMBER} reward? ›
- Item Image: insert the image URL for your item. It should be a valid URL.
$ ? Provide an image link for your {THE_ITEM_NUMBER} reward >
Once you finish providing the information for each item, the creation will be done and the “Linker dApp” will be opened so that you can sign the action with your Wallet. After you sign the the action, and if all went well, you will see the ID of your new Quest in the SDK console.
Create a new Quest with a JSON file #
To avoid all the prompts, create a full JSON file with all of the information needed to create a Quest. Find more information about the quest definition JSON structure here .
$ npx @dcl/sdk-commands quests --create-from-json <path_to_json_file>
If your JSON file doesn’t have any errors, the Quest will be created and the “Linker dApp” will open to sign the action with your Wallet. After you sign the the action, and if all went well, you will see the ID of your new Quest in the console.
The <path_to_json_file>
should be an absolute path to your JSON file. For example:
$ npx @dcl/sdk-commands quests --create-from-json /Users/username/Desktop/quest.json
List your quests #
To list your quests, use the following command:
$ npx @dcl/sdk-commands quests --list <your_eth_address>
Or
$ npx @dcl/sdk-commands quests -l <your_eth_address>
The command validates that the address is valid. If valid, the command opens the “Linker dApp” to sign the action with your Wallet. After you sign the the action, and if all went well, the command prints out all the Quests you created, each with their names and IDs.
Deactivate a Quest #
To stop players from starting your Quest, you can deactivate it. The Players who have already started the Quest, can keep playing it, as long as the Scene where the Quest takes place keeps having the logic to do so.
So to deactivate it, use the following command:
$ npx @dcl/sdk-commands quests --deactivate <quest_id>
The <quest_id>
should be a valid UUID, that you can obtain from the --list
command.
📔 Note: You can only activate or deactivate a quest if you are signing with the same wallet that signed when creating the quest.
Activate a Quest #
To activate a Quest that was previously deactivated, use the following command:
$ npx @dcl/sdk-commands quests --activate <quest_id>