Forge Bitbucket app settings

Hello!
We are working on new Forge app on bitbucket that show in repoPullRequestCard
Now we think about distributing the app, the issue is that we want to have place where user can do some basic settings like settings there api tokens, name , so the app can use to work properly, currently in development we are hardcoding such values, but the now we search for way to have such functionality to be able to distribute the app.
Thank you in advance

1 Like

Could you not use repoSettingsMenuPage module? Or you don’t want these settings to be on a per-repo basis?

1 Like

@AdamMoore Exactly, we want to use settings on workspace to be more clear.

1 Like

I believe the module to show app in workspace doesn’t exist currently, is it in the plan to have such feature?
my other question is currently we are showing setting as you mentioned in repoSettingsmenupage until work Space will be released.
and I have maybe little issue related to Storage ,
we have some triggers, and we are setting currently our API tokens inside file called appConstants
and we export them for later use by other functions in the app.

const NOTION_API_TOKEN = "NOTION_API_TOKEN";
const NOTION_API_VERSION = "2022-06-28";
export const NOTION_HEADERS = {
  Authorization: `Bearer ${NOTION_API_TOKEN}`,
  "Notion-Version": NOTION_API_VERSION,
  "Content-Type": "application/json",
};

/**
 * Pull request status mapping
 */
export const STATUS_MAPPING = {
  OPEN: "Open",
  DECLINED: "Declined",
  MERGED: "Merged",
  CLOSED: "Closed",
  SUPERSEDED: "Superseded",
};

export const NOTION_ISSUE_STATUS_MAPPING = {
  OPEN: "Ready to merge",
  DECLINED: "In progress",
  CLOSED: "In progress",
  MERGED: "Ready to deploy in staging",
};

export const TYPE_MAPPING = { pullrequest: "Pull Request" };
export const DEVELOPMENT_DATABASE_ID = "DEVELOPMENT_DATABASE_ID";
export const ISSUE_DATABASE_ID = "ISSUE_DATABASE_ID";
export const NOTION_BASE_URL = "https://api.notion.com";
export const NOTION_API_URL = `${NOTION_BASE_URL}/v1/pages`;
export const NOTION_DEVELOPMENT_DATABASE_QUERY_URL = `${NOTION_BASE_URL}/v1/databases/${DEVELOPMENT_DATABASE_ID}/query`;
export const NOTION_ISSUES_DATABASE_QUERY_URL = `${NOTION_BASE_URL}/v1/databases/${ISSUE_DATABASE_ID}/query`;

now what im trying is

import { storage } from "@forge/api";

const NOTION_API_TOKEN = await storage.get("notion_api_token");
const NOTION_API_VERSION = "2022-06-28";
export const NOTION_HEADERS = {
  Authorization: `Bearer ${NOTION_API_TOKEN}`,
  "Notion-Version": NOTION_API_VERSION,
  "Content-Type": "application/json",
};

/**
 * Pull request status mapping
 */
export const STATUS_MAPPING = {
  OPEN: "Open",
  DECLINED: "Declined",
  MERGED: "Merged",
  CLOSED: "Closed",
  SUPERSEDED: "Superseded",
};

export const NOTION_ISSUE_STATUS_MAPPING = {
  OPEN: "Ready to merge",
  DECLINED: "In progress",
  CLOSED: "In progress",
  MERGED: "Ready to deploy in staging",
};

export const TYPE_MAPPING = { pullrequest: "Pull Request" };
export const DEVELOPMENT_DATABASE_ID = "DEVELOPMENT_DATABASE_ID";
export const ISSUE_DATABASE_ID = "ISSUE_DATABASE_ID";
export const NOTION_BASE_URL = "https://api.notion.com";
export const NOTION_API_URL = `${NOTION_BASE_URL}/v1/pages`;
export const NOTION_DEVELOPMENT_DATABASE_QUERY_URL = `${NOTION_BASE_URL}/v1/databases/${DEVELOPMENT_DATABASE_ID}/query`;
export const NOTION_ISSUES_DATABASE_QUERY_URL = `${NOTION_BASE_URL}/v1/databases/${ISSUE_DATABASE_ID}/query`;

Im trying to get that notion api token from local storage, but the app never wait for it .