How to find out the host name of my forge application

Hi there, I am developing a web trigger forge application that will (hopefully) send data to a Microsoft Sharepoint instance. I am in the midst of trying to register my application with a Sharepoint instance and it asks me for the following :

  • Add-in Domain . The host name of the remote component of the SharePoint Add-in. If the remote application isn’t using port 443, the add-in domain must also include the port number. The add-in domain must match the URL bindings you use for your web application. Do not include protocol (“https:”) or “/” characters in this value. If your web application host is using a DNS CNAME alias, use the alias. Some examples:

How can I figure out what domain my application is being hosted at?

If anyone wants the full link to the instructions I am following to register my app with Sharepoint, they can be found at :

Hi @hasankibriawj

The web trigger URL for your app is generated to be unique for each installation of your app.

After you install your app, you can use the forge webtrigger command in the CLI to discover the URL for your web trigger module.

All web trigger URLs should be subdomains of *.hello.atlassian-dev.net.

Hope this helps!

1 Like

Thanks Joe!

@HeyJoe is there an alternative way to discover the hostname your application is running on besides using the web trigger trick you mentioned above? I noticed we do seem to find it in the invocation context (as siteUrl) when called from custom UI but there are times we want it when we’ve been invoked in another manner (ie issue events, async events, or scheduled events).

Most of these events do include the installContext though which I have found can be mapped to hostname via the graphql api but I haven’t used that much and don’t how appropriate it is for this or if there is a better way.

Regarding use of the graphql api to fetch the hostname I did this and it actually seems to work ok. So I think I can use this for most of our events where we just extract the cloudId from context.installContext and pass it to this function.

export async function getHostUrl(cloudId: string): Promise<string> {
  const query =
    'query hostName($cloudId:ID!) { tenantContexts(cloudIds:[$cloudId]) { hostName } }'
  const variables = { cloudId: cloudId }
  const headers = {}
  const request = await api.asApp().requestGraph(query, variables, headers)
  const result = (await request.json())?.data?.tenantContexts[0].hostName
  return result
}

@jeffryan the serverInfo REST API endpoint should also be queryable for this information (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-server-info/#api-rest-api-3-serverinfo-get)

1 Like

@HeyJoe thanks a lot! Somehow I missed that! Any feeling for the difference between the two methods performance or throttle wise?

I’m actually not sure! I’ve asked some team members internally if we have an opinion on which method is preferred.

1 Like