With the recent update with the Roblox HttpService, developers on the Roblox platform are now able to take advantage of all the Trello API services through their game. In this tutorial, we will cover the use cases of Trello and how to connect your Roblox game with Trello. With a ready-to-use module on the Roblox library by @nstrike159, you will be able to use Trello to achieve maximum benefit for your Roblox games.
Before you can begin with the tutorial, you will need the following resources to successfully follow the tutorial.
- A free account on Trello. https://trello.com/
- The Trello API Module. https://www.roblox.com/library/214265621/Trello-API-Original
- Basic understanding of Lua.
The following link/s can guide you further if needed:
- Trello API Reference. Redirecter
- Roblox Trello API Module Reference. https://getenveloped.com/trelloapi/ [SSL Expired at the moment]
The Trello API module gives you the general instructions to help you start. You can safely follow the instructions from Line 40 to 47 to set up your Trello API key and token. There is a script under the module that shows you an example of how to use the API. However, in this guide, we will not be making use of the example script.
A good practice is to store your Module Script into ServerScriptService as to prevent exploiters accessing your Trello API, should they manage to find a way.
There is a function within the comment section of the API that allows you to view the contents of a table, should it be returned. You can run the function whenever you need to know the contents of the table and view it in your console.
function printTable(tab)
local recrlimit=20--Sets recrusive limit so you do not crash studio if u want this off set it to some rediculous value like 10000
local inarray=false
local rep=0
local function printArrInfo(arr)
if #arr>recrlimit and inarray then
return
end
for i,v in next,arr do
if type(v)=="table" then
print(string.rep("\t",rep)..tostring(i).."={")
inarray=true
rep=rep+1
printArrInfo(v)
else
print(string.rep("\t",rep)..tostring(i).."=".."\""..tostring(v).."\"")
end
end
if inarray then
rep=rep-1
print(string.rep("\t",rep).."}")
inarray=false
end
end
printArrInfo(tab)
end
Please be sure to have HttpService enabled before going further.
To begin using the API (after successfully entering your key and token), you should begin with requiring the module.
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
You have now successfully gained access to your module to which you can run any http requests it supports. To start off, we will need to determine which board you want to access. You can do so by running the GetBoardID function.
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = TrelloAPI:GetBoardID("Board Name Here")
Generally, you want to keep your board names unique as it grabs the board via the name. If you want to use the ShortLink option as they will always be unique, you can change that setting on Line 699 of the Main Module. The line would say
if p=="shortUrl" and it==name then
After successfully grabbing your BoardID, you can now choose what you want to do with the board. For the sake of this guide, we will be adding a card to a specific list on the board called “The List.” To grab the List ID, you need to use the GetListID function.
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = TrelloAPI:GetBoardID("Board Name Here")
local ListID = TrelloAPI:GetListID("The List",BoardID)
You have now successfully gotten the list id and posted it to the variable ListID. To add a card to that specific list, you use the AddCard function. Because it will return a table with the card information, we will assign the return to a variable called NewCard.
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = TrelloAPI:GetBoardID("Board Name Here")
local ListID = TrelloAPI:GetListID("The List",BoardID)
local NewCard = TrelloAPI:AddCard("Card Name","Card Description",ListID)
Now there are more parameters you can add to the NewCard including what position you want it, what labels to assign, but for the sake of this guide, we will keep it simple. You are able to refer to the documentation on adding more specific parameters.
You have successfully added a new card to a specific list on a specific board. You are able to run more functions using the Trello API, to which you can refer to via the documentation.
https://getenveloped.com/trelloapi/
You can find the API references in there. At this moment in time, I am actively adding and updating, therefore you may not see the full list until later.
Side note: All functions are currently in progress of being added to the module including PUT and DELETE requests. When the documentation comes out, it will be updated to the latest version every so often.