This repo hosts the codebase for Stack Overflow Coda Pack. The pack allows to work with data from Stack Overflow directly in your doc.
See Get started on your local machine. However, I think it's easier to develop in the docker container as shown below.
- Install Docker
- Install VSCode Remote - Containers extension.
- Run the
Remote-Containers: Open Folder in Container...command and select the local folder. - A new VSCode window will launch where you can develop and run commands in a bash terminal.
There's also an in-depth guide on how to develop coda packs with docker containers: https://github.com/AlahmadiQ8/coda-pack-local-dev
You need to have a client id and client secret to enable the pack to use the Stack Overflow API.
- Create an Stack Exchange app at https://stackapps.com/apps/oauth/register
- Fill out the required fields. For the OAuth Domain, use the value
localhost. NOTE: if you want to use Postmant to experiment with the api, use the valuepstmn.ioinstead. - Once created, copy the Client Id and Client Secret
- (optional) For write apis such as Bookmark action (
/questions/${id}/favorite), you must edit the app and add a Stack App Post. Post a new question on Stack Exchange with the tagsapporscriptand post the question url value field.
Once done, run npx coda auth pack.ts. It will ask you for the client id and client secret you copied in the previous page. .coda-credentials.json file will be generated. Make sure you edit the scopes as shown below:
{
"credentials": {
"clientId": "23844",
"clientSecret": "xxxxxxxxxxxxxxxxxxx",
"accessToken": "xxxxxxxxxxxxxxxxxxx",
"scopes": [
"read_inbox",
"no_expiry",
"private_info",
"write_access"
]
}
}Here is an example on how to test formulas locally:
# Formula: Question
npx coda execute pack.ts Question https://stackoverflow.com/questions/72913818/how-to-access-my-sprite-properties-from-outside-a-function-in-phaser3-and-matter
# Sync Table:
npx coda execute pack.ts Questions "All Stack Overflow" "2022-02-01,2022-05-01" "false" "reactjs,nextjs,vercel"
npx coda execute pack.ts Questions "My bookmarks" "" "false" "reactjs"
# Bookmark Question
npx coda execute pack.ts BookmarkQuestion "https://stackoverflow.com/questions/72931914/error-usehref-may-be-used-only-in-the-context-of-a-router-component-in-reg"
# Undo Bookmark Question
npx coda execute pack.ts UndoBookmarkQuestion "https://stackoverflow.com/questions/72931914/error-usehref-may-be-used-only-in-the-context-of-a-router-component-in-reg"You can experiment with Stack Overflow API with Postment by forking the collection in the button above.
- Keep in mind that you must have the following environment variables to run the requests in the collection:
ClientIdClientSecretkey
- Edit the Stack Exchange App such that for the OAuth Domain, the value should be
pstmn.io
These values correspond to the Stack Exchange app created as shown below:
Then, generate an access token by going to the collection settings under the Authorization tab and clicking Get New Access Token


