Project structure
- All project components must live within the
srcdirectory specified in thehsproject.jsonconfig file. - All app features and components must live within the
app/directory. - App objects are defined within the
app-objects/directory. - App object associations are defined within the
app-object-associations/directory. - All component and feature instances are declared using
*-hsmeta.jsonfiles. You can use any file name you’d like, as long as it ends in-hsmeta.json(e.g.,my-cool-object-hsmeta.json). These files must live at the root level of their respective folder.
App objects
To create an app object, include anapp-objects component directory in the project, along with a configuration file.
*-object-hsmeta.json.
Fields marked with * are required.
The fully-qualified name (FQN) for your app object will be
a<appId>_<objectName>. For example: if your appId is 16858319 and the app object name is CARS, then the FQN would be a16858319_CARS. You’ll use the FQN when setting scope values for your app objects.App schema
To create an app object, include anapp-hsmeta.json configuration file in the app directory.
app-hsmeta.json.
App schema *-hsmeta.json fields
Fields marked with * are required
auth fields
Fields marked with * are required.
Scopes
In theauth field of an app configuration file, you can specify three types of scopes: required scopes, conditionally required scopes, and optional scopes. If you’re just getting started with app objects, you should only include your app object scopes as conditionallyRequiredScopes. This will allow you to silo your new features to specific customers by including the app object scopes in the install URL.
App object scopes use the following format:
crm.app.schemas.<appObjectFullyQualifiedName>.read
For example, for an app object with the FQN a16858319_cars, the read scope would be:
crm.app.schemas.a16858319_cars.read.
At a minimum, your app must include the above read scope to enable customers to access the object. It’s recommended to include all app object scopes in your app, as shown below.
Webhooks component definition
To define a set of webhook subscriptions for your app, include awebhooks directory in the project, along with a *-hsmeta.json configuration file.
*-hsmeta.json file.
Webhook *-hsmeta.json fields
Fields marked with * are required.
For each
subscription object, the following fields can be specified, based on the subscription definition type you’re subscribed to (i.e., crmObjects, legacyCrmObjects, or hubEvents) or whether you’re subscribing to a specific property change (e.g., contact.propertyChange).
App card schema
To create an app card that appears on an app object record page, include acards component directory in the project, along with a configuration file.
- Make sure you’ve run
hs project uploadafter you created your app object component and the associated configuration files. - In your
my-app-card-hsmeta.jsonfile, add your app object UID to theobjectTypesarray (e.g.,"app_object_uid"in this example). Each of the available fields in the.jsonfile are detailed in the table below.
- After you’ve saved the changes to your
example-card-hsmeta.jsonfile, runhs project upload.
App card *-hsmeta.json fields
Fields marked with * are required.
App object associations
To enable associations between your app object and other CRM objects, include anapp-object-associations component directory in the project, along with a *-hsmeta.json configuration file for each record type you want to define an association for.
The directory structure and example *-hsmeta.json file below provide an example of defining an association between an app object with a uid of car-app-object and contacts.
*-hsmeta.json file.
Association *-hsmeta.json fields
Fields marked with * are required.