What Are Messages? What types messages exists?
Learn how to build blocks of the quest/course
A message is the smallest blocks of content within a quest. Messages can contains:
-
Instructions(e.g Markdown blocks)
-
Questions
-
Media (images/videos)
-
Validation criteria
-
Interactive quizzes
-
Coding tasks
-
etc
You can mix and match message types to create an engaging and dynamic user experience. You can build any storytelling to make more engaging content.
Message Types on BuilderGym
Messages are the foundational elements of quests. Each message type serves a specific purpose, enabling you to design interactive and engaging experiences for users. Below are the key message types and how to configure them:
1. Dialogue
Dialogue messages are typically used to simulate communication between the user and a persona, such as Vitalik. These messages create a conversational and immersive experience. Steps to Create a Dialogue Message:
-
Add a Meta User:
-
Goto: https://admin.buildergym.xyz/courses/**\[course-id]**/users-meta
-
Add a new meta user. This meta user will act as the “author” of the dialogue messages (e.g., Vitalik).
-
-
Link the Meta User to Your Quest:
- Select the meta user in your quest editor.
-
Add the Dialogue Message:
- Compose the dialogue text as if it were coming from the meta user.
2. Deploy Contract
This message type allows users to deploy a custom Solidity smart contract. It adds interactivity by letting each user deploy a contract tailored to their quest experience.
Steps to Create a Deploy Contract Message:
-
Provide Solidity Code:
- Paste the Solidity code into the provided field.
-
Configure Contract Deployment:
-
Add an initial balance (must be less or equal than 0.001 ETH). Ensure the code is valid and contains a **
transfer()
**function. -
Select the network where the contract will be deployed.
-
-
System Behavior:
-
The platform will compile the Solidity code into bytecode and ABI, then store it in the database.
-
Each user gets their own instance of the contract deployed for them.
-
3. Task
The Task Message is the core message type, representing an actionable challenge for the user to complete.
Steps to Create a Task Message
-
Set Completion Rewarding Points:
- Define the number of points a user earns for completing the task.
-
Assign a Code Task:
- Link the task to a Code Task (explained later).
-
Add Additional Checks (Optional):
-
If you need custom logic to validate user input, enable “Need additional checks?”:
-
Additional Check Message ID: Enter the ID of a related Deploy Contract message. This ID links the task to the deployed contract, enabling custom validations.
-
Additional Check Code: Write a TypeScript function to verify the user’s solution.
-
-
Data Available in Check Code(you have jsonData object, that BuilderGym gives you to work):
-
jsonData.userMetaMaskAddress
: User’s MetaMask wallet address. -
jsonData.contract
: address of thecontract deployed for theuser by BuilderGym. -
jsonData.userData
: User’s input from the “Checktheanswer” field. -
Libraries available for use -
Ethers
andAxios
(soon planning to addweb3.js
andviem.sh
)
Check Code Functionality:
-
The code is executed when the user clicks “Check the answer”.
-
Use the provided data to validate user actions, such as checking contract interactions or submitted values.
-
The functions should return {result: boolean, message:string}, message will be shown to the user if the result is false.
Example Use Case:
You should add ()
to the function’s end to ensure it is being called. This given example checks the deployed contract’s balance and returns true if it is 0.
General Tips for Using Messages
-
Combine Messages Effectively: Use dialogue messages to introduce tasks and guide users, deploy contract messages to set up challenges, and task messages to evaluate their progress.
-
Leverage Meta Users: Adding personas like Vitalik makes the experience more engaging and relatable.
-
Test Thoroughly: Ensure Solidity code, additional checks, and validations work as intended before publishing the quest.