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
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.
@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?
Class: ConvexHttpClient | Convex Developer Hub
browser.ConvexHttpClient
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
1: You can write code using the HTTP client like:

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"}]

Cool both these solutions should be find! Thanks for the help