Trello board to room
This integration retrieves the name of a Trello board and creates a new room in ONLYOFFICE Apps with the same title. It's helpful for mirroring Trello project structures into your document collaboration environment.
How it works
- Fetch Trello board name - Get the board title using Trello's API.
- Create ONLYOFFICE Apps room - Create a private collaboration room with the board name as the title.
Full example
import requests
# ONLYOFFICE Apps configuration
ONLYOFFICE_API_HOST = "your-docspace.onlyoffice.com"
ONLYOFFICE_API_KEY = "your_onlyoffice_api_key"
# Trello configuration
TRELLO_API_KEY = "your_trello_api_key"
TRELLO_TOKEN = "your_trello_token"
TRELLO_BOARD_ID = "your_board_id"
ONLYOFFICE_HEADERS = {
"Authorization": f"Bearer {ONLYOFFICE_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json"
}
# Step 1: Get Trello board name
def get_trello_board_name(board_id):
url = f"https://api.trello.com/1/boards/{board_id}"
params = {"key": TRELLO_API_KEY, "token": TRELLO_TOKEN}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()["name"]
else:
print(f"Trello board fetch error: {response.status_code}")
return None
# Step 2: Create an ONLYOFFICE Apps room with board name
def create_docspace_room(room_title):
url = f"https://{ONLYOFFICE_API_HOST}/api/2.0/files/rooms"
payload = {
"title": room_title,
"roomType": 2, # Collaboration room
"private": True
}
response = requests.post(url, headers=ONLYOFFICE_HEADERS, json=payload)
if response.status_code == 200:
print(f"Room created: {room_title}")
return response.json()
else:
print(f"ONLYOFFICE Apps room creation error: {response.status_code}, {response.text}")
return None
# Run integration
if __name__ == "__main__":
board_name = get_trello_board_name(TRELLO_BOARD_ID)
if board_name:
create_docspace_room(board_name)
Before you start
- Replace
your-docspace.onlyoffice.comandyour_onlyoffice_api_keywith your actual ONLYOFFICE Apps portal host and API key. Ensure you have the necessary permissions to perform user operations. - Before you can make requests to the API, you need to create an ONLYOFFICE Apps API key. Check out the API keys article to learn how to obtain and use API keys.
- Create a Trello Developer App to obtain an API key and token. Grant read access to cards and attachments by authorizing with
readscope. - Replace
your_trello_api_key,your_trello_token, andyour_board_idwith your actual Trello API key, token, and board ID.
Step 1: Retrieve a Trello board name
Use a Trello API GET /boards/{board_id} request to get the board's title by its ID. This name will be used as the room title in ONLYOFFICE Apps.
# Step 1: Get Trello board name
def get_trello_board_name(board_id):
url = f"https://api.trello.com/1/boards/{board_id}"
params = {"key": TRELLO_API_KEY, "token": TRELLO_TOKEN}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()["name"]
else:
print(f"Trello board fetch error: {response.status_code}")
return None
Step 2: Create an ONLYOFFICE Apps room
Use POST /api/2.0/files/rooms to create a private collaboration room in ONLYOFFICE Apps.
Retrieve metadata about the file attachments (name, ID, download URL) for further processing.
# Step 2: Create an ONLYOFFICE Apps room with board name
def create_docspace_room(room_title):
url = f"https://{ONLYOFFICE_API_HOST}/api/2.0/files/rooms"
payload = {
"title": room_title,
"roomType": 2, # Collaboration room
"private": True
}
response = requests.post(url, headers=ONLYOFFICE_HEADERS, json=payload)
if response.status_code == 200:
print(f"Room created: {room_title}")
return response.json()
else:
print(f"ONLYOFFICE Apps room creation error: {response.status_code}, {response.text}")
return None
# Run integration
if __name__ == "__main__":
board_name = get_trello_board_name(TRELLO_BOARD_ID)
if board_name:
create_docspace_room(board_name)