When a block is added and selected in a proposal, this webhook will be called. The response is used for customizing the default values and behavior of the block.

The POST request will have the following data in its body:

Content Details Request
{
  id: string;
  created: number;
  type: 'content.details';
  integration: IntegrationSessionData;
  integrationBlockSource: {
    integrationId: number;
    uniqueId: string;
    metadata: Record<string, unknown>;
  }
}

The uniqueId and metadata properties will contain the values defined during content import.

The expected response to this is a json object with the following format

Response
{
  data: {
    dateType?: 'date' | 'dateTime';
    defaultQuantity?: string | number;
    defaultLabel?: string;
    fields?: IntegrationField[];
    hideSubrows?: boolean;
    showQuantity?: boolean;
    disableDiscounts?: boolean;
    customSubrows?: ContentSubrow[];
    subResources?: IntegrationContentSubresource[];
  };
}

Content details

fields

This is used to create custom inputs on a block. The values defined will be stored in the block’s sources.integration.metadata property.

The values set by the fields options are stored in the sources.integration.metadata property of a Block.

See IntegrationField for information on how to use them.

subResources

This is used to be able to add custom quick addable sub resources to a block (using the blue button with a plus icon). The format of this is as follows:

ContentSubrow
{
  name: string
  subtitle?: string
  value?: number
  valueWithTax?: number

  /*
   * flat: value is added once per row
   * unit: value is multiplied by the row quantity
   */
  pricingType: 'flat' | 'unit'
}

When a user adds a sub resource to a block, it will be appended to block.multi_product_data as a subrow.

customSubrows

Custom subrows are predefined subrows that will be added to block.multi_product_data automatically. These are usually internal subrows that the user should not be able to modify. Therefore it can be good to set the hideSubrows property to true when using it.