Best way to use in something like Retool

Is there a recommended approach to leverage convex in something like retool? I figure I can just leverage the cloud url w/ special syntax or formatting to make the requests?
6 Replies
ballingt
ballingt2y ago
Yep, using the Convex HTTP client should work well. If you need auth to run protected mutations etc. I'd use a secret token, a random string you add as an environment variable or hardcode, instead of auth.getUserIdentity() since it would be hard to get a clerk/auth0 identity token from a retool scheduled job.
ballingt
ballingt2y ago
@Chad Maycumber does using the ConvexHttpClient https://docs.convex.dev/api/classes/browser.ConvexHttpClient work for you for this, or do you want to make raw fetch requests to the CONVEX_URL?
ian
ian2y ago
In ReTool there are two primary ways you can structure Convex as a resource (assuming you don't want to make a Convex http endpoint to expose a graphQL or OpenAPI spec): 1. JavaScript query 2. REST API
ian
ian2y ago
1: You can write code using the HTTP client like:
const client = await import("https://esm.run/convex/browser");
convex = new client.ConvexHttpClient("https://keen-llama-684.convex.cloud");
return await convex.query("getCounter");
const client = await import("https://esm.run/convex/browser");
convex = new client.ConvexHttpClient("https://keen-llama-684.convex.cloud");
return await convex.query("getCounter");
No description
ian
ian2y ago
2: You can use your backend's URL with /api/query or /api/mutation or /api/action and pass JSON arguments in the POST body like: path: "getCounter" args: [{arg1: "value"}]
No description
Chad Maycumber
Chad MaycumberOP2y ago
Cool both these solutions should be find! Thanks for the help

Did you find this page helpful?