integration_trello cards - #370
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
""" WalkthroughA new Trello app integration is introduced with two files: a JSON file defining the app's metadata, authentication scheme, and categorization, and a functions file specifying four REST API endpoints for managing Trello cards. These endpoints enable creating, retrieving, updating, and deleting cards, each with detailed parameter requirements and descriptions. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TrelloApp
participant TrelloAPI
User->>TrelloApp: Initiate card operation (create/get/update/delete)
TrelloApp->>TrelloAPI: Send REST API request with API key and token
TrelloAPI-->>TrelloApp: Return API response (card data or status)
TrelloApp-->>User: Display result of operation
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
backend/apps/trello/functions.json (3)
95-197: Duplicate: authentication parameter alignment applies here too
The same mismatch between"key"inapp.jsonand"token"in this function occurs inTRELLO__GET_CARD. Please apply the fix outlined above forCREATE_CARD.
198-312: Duplicate: authentication parameter alignment applies here too
TheTRELLO__UPDATE_CARDfunction also defines only"token". Ensure"key"is added per the security scheme and both are marked as required.
313-377: Duplicate: authentication parameter alignment applies here too
TheTRELLO__DELETE_CARDfunction likewise expects only"token". Add"key"in the query parameters to align withapp.json.
🧹 Nitpick comments (4)
backend/apps/trello/app.json (2)
6-6: Ensure semantic versioning consistency
The"version": "aipolabs_0.0.1"deviates from standard Semantic Versioning (e.g.,0.0.1). Consider aligning with SemVer conventions for clarity and consistency across apps.
16-19: Verify categories against taxonomy
Ensure the categories"Productivity"and"Project Management"match the platform’s predefined taxonomy and casing conventions to maintain consistency in the UI.backend/apps/trello/functions.json (2)
36-43: Add enum and format constraints for known parameters
To improve schema validation and reduce runtime errors:
- Add an
enumfor"pos"(e.g.,["top","bottom"]) or allow numeric values via a union type.- Add
"format": "date-time"for"due"and"start"to enforce ISO 8601 date‐time strings.Also applies to: 66-82
157-163: Specify enum for checklist options
The"checklists"parameter describes valid values"all"or"none"but is typed asstring. Consider adding anenumconstraint:"checklists": { "type": "string", "enum": ["all", "none"], "description": "Whether to include checklists." }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
backend/apps/trello/app.json(1 hunks)backend/apps/trello/functions.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Compose Tests
- GitHub Check: Format & Lint
- GitHub Check: Format, Lint, and Test
| "security_schemes": { | ||
| "api_key": { | ||
| "location": "query", | ||
| "name": "key", | ||
| "prefix": null | ||
| } | ||
| }, |
There was a problem hiding this comment.
Mismatch between security scheme and function parameters
The security scheme in app.json defines the API key as a query param named "key", but the functions in functions.json expect a "token" parameter (and not "key"). This will lead to authentication failures. You should either:
- Update the functions to require
"key"(and"token"if Trello requires both), or - Adjust the security scheme to include
"token".
🤖 Prompt for AI Agents
In backend/apps/trello/app.json around lines 8 to 14, the security scheme
defines the API key as a query parameter named "key", but the functions expect a
parameter named "token". To fix this, either update the functions in
functions.json to require "key" instead of "token" (or both if needed), or
modify the security scheme here to use "token" as the parameter name to match
the functions. Ensure consistency between the security scheme and function
parameters to avoid authentication failures.
| [ | ||
| { | ||
| "name": "TRELLO__CREATE_CARD", | ||
| "description": "Create a new card in Trello. You can specify the card name, description, position, labels, members and other attributes.", | ||
| "tags": [ | ||
| "cards", | ||
| "create" | ||
| ], | ||
| "visibility": "public", | ||
| "active": true, | ||
| "protocol": "rest", | ||
| "protocol_data": { | ||
| "method": "POST", | ||
| "path": "/cards", | ||
| "server_url": "https://api.trello.com/1" | ||
| }, | ||
| "parameters": { | ||
| "type": "object", | ||
| "properties": { | ||
| "query": { | ||
| "type": "object", | ||
| "description": "Query parameters", | ||
| "properties": { | ||
| "token": { | ||
| "type": "string", | ||
| "description": "Trello API token for authentication" | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "The name of the card" | ||
| }, | ||
| "desc": { | ||
| "type": "string", | ||
| "description": "The description of the card" | ||
| }, | ||
| "pos": { | ||
| "type": "string", | ||
| "description": "The position of the card. Valid values: 'top', 'bottom', or a positive number." | ||
| }, | ||
| "due": { | ||
| "type": "string", | ||
| "description": "Date due in ISO 8601 format, or null" | ||
| }, | ||
| "start": { | ||
| "type": "string", | ||
| "description": "Start date in ISO 8601 format, or null" | ||
| }, | ||
| "idList": { | ||
| "type": "string", | ||
| "description": "The ID of the list to add the card to" | ||
| }, | ||
| "idMembers": { | ||
| "type": "array", | ||
| "description": "Array of member IDs to add to the card", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "idLabels": { | ||
| "type": "array", | ||
| "description": "Array of label IDs to add to the card", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "required": [ | ||
| "token", | ||
| "idList" | ||
| ], | ||
| "visible": [ | ||
| "token", | ||
| "name", | ||
| "desc", | ||
| "pos", | ||
| "due", | ||
| "start", | ||
| "idList", | ||
| "idMembers", | ||
| "idLabels" | ||
| ], | ||
| "additionalProperties": false | ||
| } | ||
| }, | ||
| "required": [ | ||
| "query" | ||
| ], | ||
| "visible": [ | ||
| "query" | ||
| ], | ||
| "additionalProperties": false | ||
| } | ||
| }, |
There was a problem hiding this comment.
Add and align API key parameter for authentication
The TRELLO__CREATE_CARD function only defines a "token" query parameter, but the app.json security scheme expects "key". The Trello API typically requires both key (your API key) and token (user token). Update this schema to include both parameters and mark them as required:
--- a/backend/apps/trello/functions.json
+++ b/backend/apps/trello/functions.json
@@ "properties": {
- "token": {
+ "key": {
+ "type": "string",
+ "description": "Trello API key for authentication"
+ },
+ "token": {
"type": "string",
"description": "Trello API token for authentication"
},
@@ "required": [
- "token",
+ "key",
+ "token",
"idList"
]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [ | |
| { | |
| "name": "TRELLO__CREATE_CARD", | |
| "description": "Create a new card in Trello. You can specify the card name, description, position, labels, members and other attributes.", | |
| "tags": [ | |
| "cards", | |
| "create" | |
| ], | |
| "visibility": "public", | |
| "active": true, | |
| "protocol": "rest", | |
| "protocol_data": { | |
| "method": "POST", | |
| "path": "/cards", | |
| "server_url": "https://api.trello.com/1" | |
| }, | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "query": { | |
| "type": "object", | |
| "description": "Query parameters", | |
| "properties": { | |
| "token": { | |
| "type": "string", | |
| "description": "Trello API token for authentication" | |
| }, | |
| "name": { | |
| "type": "string", | |
| "description": "The name of the card" | |
| }, | |
| "desc": { | |
| "type": "string", | |
| "description": "The description of the card" | |
| }, | |
| "pos": { | |
| "type": "string", | |
| "description": "The position of the card. Valid values: 'top', 'bottom', or a positive number." | |
| }, | |
| "due": { | |
| "type": "string", | |
| "description": "Date due in ISO 8601 format, or null" | |
| }, | |
| "start": { | |
| "type": "string", | |
| "description": "Start date in ISO 8601 format, or null" | |
| }, | |
| "idList": { | |
| "type": "string", | |
| "description": "The ID of the list to add the card to" | |
| }, | |
| "idMembers": { | |
| "type": "array", | |
| "description": "Array of member IDs to add to the card", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "idLabels": { | |
| "type": "array", | |
| "description": "Array of label IDs to add to the card", | |
| "items": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "token", | |
| "idList" | |
| ], | |
| "visible": [ | |
| "token", | |
| "name", | |
| "desc", | |
| "pos", | |
| "due", | |
| "start", | |
| "idList", | |
| "idMembers", | |
| "idLabels" | |
| ], | |
| "additionalProperties": false | |
| } | |
| }, | |
| "required": [ | |
| "query" | |
| ], | |
| "visible": [ | |
| "query" | |
| ], | |
| "additionalProperties": false | |
| } | |
| }, | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "query": { | |
| "type": "object", | |
| "description": "Query parameters", | |
| "properties": { | |
| "key": { | |
| "type": "string", | |
| "description": "Trello API key for authentication" | |
| }, | |
| "token": { | |
| "type": "string", | |
| "description": "Trello API token for authentication" | |
| }, | |
| "name": { | |
| "type": "string", | |
| "description": "The name of the card" | |
| }, | |
| "desc": { | |
| "type": "string", | |
| "description": "The description of the card" | |
| }, | |
| "pos": { | |
| "type": "string", | |
| "description": "The position of the card. Valid values: 'top', 'bottom', or a positive number." | |
| }, | |
| "due": { | |
| "type": "string", | |
| "description": "Date due in ISO 8601 format, or null" | |
| }, | |
| "start": { | |
| "type": "string", | |
| "description": "Start date in ISO 8601 format, or null" | |
| }, | |
| "idList": { | |
| "type": "string", | |
| "description": "The ID of the list to add the card to" | |
| }, | |
| "idMembers": { | |
| "type": "array", | |
| "description": "Array of member IDs to add to the card", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "idLabels": { | |
| "type": "array", | |
| "description": "Array of label IDs to add to the card", | |
| "items": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "key", | |
| "token", | |
| "idList" | |
| ], | |
| "visible": [ | |
| "token", | |
| "name", | |
| "desc", | |
| "pos", | |
| "due", | |
| "start", | |
| "idList", | |
| "idMembers", | |
| "idLabels" | |
| ], | |
| "additionalProperties": false | |
| } | |
| }, | |
| "required": [ | |
| "query" | |
| ], | |
| "visible": [ | |
| "query" | |
| ], | |
| "additionalProperties": false | |
| } |
🤖 Prompt for AI Agents
In backend/apps/trello/functions.json lines 1 to 93, the TRELLO__CREATE_CARD
function schema currently only includes the "token" query parameter for
authentication, but the Trello API requires both "key" (API key) and "token"
(user token). To fix this, add a "key" parameter alongside "token" in the
"query" properties, provide a description for it as the Trello API key, and
update the "required" array to include both "key" and "token" to ensure both are
mandatory for authentication.
There was a problem hiding this comment.
The Trello API requires two keys:
curl --request DELETE \
--url 'https://api.trello.com/1/cards/{id}?**key**=APIKey&**token**=APIToken'Refer to their documentation on API keys and tokens: Trello Cards API
However, our platform only supports the following authentication methods:
NO_AUTH = "no_auth"
API_KEY = "api_key"
HTTP_BASIC = "http_basic"
HTTP_BEARER = "http_bearer"
OAUTH2 = "oauth2"Solution 1: When attempting to implement a Trello connector, hardcoding the token is not ideal.
Solution 2: Fixing the code bottleneck requires modifying more code.
Compromise: Include the token in the prompt for now.
Future Plan: Revisit Solution 2.
There was a problem hiding this comment.
@fak111 I understand your approach regarding the Trello API authentication challenge. You're right that Trello requires both key and token parameters, which doesn't perfectly map to the standard authentication methods your platform supports.
Your compromise of including the token in the prompt for now is a pragmatic solution given the constraints. It allows you to move forward with the integration while acknowledging this isn't the ideal long-term approach.
This is a reasonable short-term workaround until you can implement Solution 2 in the future. If you need any assistance when you revisit this authentication challenge later, I'd be happy to help explore more scalable options.
hanyixxx
left a comment
There was a problem hiding this comment.
please attach screenshots of testing & results
fix |
|
i think we need a better way to handle dual tokens |
hanyixxx
left a comment
There was a problem hiding this comment.
we need to find a better way to support trello's dual token authentication
|
✨ No files to analyze in this PR. Need help? Join our Discord for support! |
🏷️ Ticket
trello
testing & results
📸 Screenshots (if applicable)
https://www.loom.com/share/19c2355db7a042958a3a1d54f6d02b4e?sid=9ff6227c-0622-4d7e-8f32-8a947a763dc6
✅ Checklist
Summary by CodeRabbit