Manage game data
Create new Game Objects

You can quickly create Game Objects through the Console. Simply navigate to Game Objects, enter the name of your Game Object using shift
+enter
.
Group objects into Tags
Next, you'll need to organize our Game Objects into Tags, which are collections of Game Objects. Group objects into Tags to input them into Games later on.
You can then load your Tags as inputs into games. Let's create a Tag under Tags page

shift
+ enter
Input tagged objects into game
After creating our Tag, tag them by returning to the Game Objects page, bulk selecting, selecting the Hobbies
tag, and then load them as inputs into our hobbies-ranker
game.
Importing data
Prepare your records
Your data must be in a format the 2bttns platform can understand. Once you've decided on your game objects, we'll need to prepare your records for import.
Format your JSON
Already have data you'd like to input into 2bttns? Let's walk through how to format your data to import through API or the Console interface.
Your JSON must contain a name
equivalent field. These values are loaded as choices within your Game buttons. Fields not represented in the Game Objects model are ignored. See Example for more information.
const outputShape: OutputShape = { gameObjects: [
{
id: '',
name: '', // REQUIRED
description: '',
tagIds: []
}
],
tags: [
{
id: '',
name: '',
description: ''
}
]
};
interface GameObject {
id: string;
name: string;
description: string;
tagIds: string[];
[key: string]: any;
}
How 2bttns Helps
We've got you covered. 2bttns comes with a Formatter to effortlessly transform any JSON into the specified data model.
Using the formatter
Example: Personalize Coffee Shop Drinks to Moods ☕️ 😁
You're building a creative coffee shop experience where the menu dynamically adapts to how customers are feeling. Using 2bttns, we can categorize menu items by mood, ensuring each customer finds the perfect drink to match their current state of mind.
{
"coffee_shop_drinks": [
{
"mood": "Energetic",
"drinks": [
"Espresso",
"Iced Coffee",
"Cold Brew"
]
},
{
"mood": "Focused",
"drinks": [
"Espresso",
"Latte",
"Iced Coffee"
]
},
{
"mood": "Relaxed",
"drinks": [
"Cappuccino",
"Latte"
]
},
{
"mood": "Content",
"drinks": [
"Cappuccino",
"Iced Latte"
]
},
...
]
}
Run the following script anywhere to use the Formatter
npx @2bttns/objects

After selecting Format Data, pass in your JSON
? 📁 Enter the path of the input JSON file:
› /Users/you/Downloads/drinks-mood.json
Input the path to the list object in your JSON containing your Game Objects. In this case, coffee_shop_drinks
is the object containing our list of Moods objects:
✔ 🔍 Select the path in JSON where the data to be converted is located:
· coffee_shop_drinks
The Formatter will ask you questions to create a ready-to-upload JSON. Here's how it works:
✔ ⭐️ Which key in your JSON corresponds to "id" with value type "string"?
👉 Enter "none" if none exists.
· none
✔ ⭐️ Which key in your JSON corresponds to "name" with value type "string"?
👉 Enter "none" if none exists.
· mood
✔ ⭐️ Which key in your JSON corresponds to "description" with value type "string"?
👉 Enter "none" if none exists.
· none
✔ ⭐️ Which key in your JSON corresponds to "tagIds" with value type "object"?
👉 Enter "none" if none exists.
· none
✔ 📁 Enter the path where you want to save the output JSON file (e.g., /your/path/name/):
press ENTER for current directory
· /Users/you/Downloads
✔ 📁 Enter the output file name (e.g., my-output.json):
· output.json
✅ Output JSON file saved successfully! ✅
Here's an outline of each field and its corresponding data mapping:
id
string
A unique uuid representing a game object. Formatter will generate one if none.
name
string*
The name of game object. This is what users see and score when playing a round of 2bttns.
description
string
A description of the game object
tagIds
object
Each ID corresponds to the parent collection that a game object is part of. You can group Game Objects into Tags using the Console.
*Required
Viola! 🪄 And here's the resulting output JSON:
{
"gameObjects": [
{
"id": "clso4o94h0001xk9sfsjwdf0q",
"name": "Focused",
"description": "",
"tagIds": []
},
{
"id": "clso4o94h0004xk9sgbw84w0i",
"name": "Comforted",
"description": "",
"tagIds": []
},
{
"id": "clso4o94h0007xk9shfrm4izk",
"name": "Reflective",
"description": "",
"tagIds": []
},
...
],
"tags": [
{
"id": "",
"name": "",
"description": ""
}
]
}
How to import
You can import your data either through API/SDK or the Console interface.
Import with Console
You can drag and drop your JSON of Game Objects in. Navigate to your Console and click on the Actions button.

Import with API
You can also import your JSON through the API using the following endpoint:
Import 2bttns data from a JSON file.
Base64 encoded JSON file to import
If true, the import will fail if any part of it fails.
If false, the import will continue even if some parts fail.
false
Generate new IDs for imported data and remap all references to them, instead of using existing IDs.
This may result in duplicate entries with similar content but different IDs.
false
POST /api/import-data HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 65
{
"jsonBase64": "text",
"allOrNothing": false,
"generateNewIds": false
}
{
"results": {
"tags": {
"successes": 1,
"failures": 1
},
"gameObjects": {
"successes": 1,
"failures": 1
},
"games": {
"successes": 1,
"failures": 1
}
},
"allOrNothingFailed": true,
"logMessages": [
{
"type": "info",
"message": "text"
}
]
}
Last updated
Was this helpful?