open-condo-software / condo

Open source condominium management platform
MIT License
62 stars 26 forks source link

feat(condo): DOMA-9613: Add recipients counter to cross-posting integrations #5026

Closed toplenboren closed 1 month ago

toplenboren commented 1 month ago

Add recipients counter to cross-posting integrations

image

Context

Context: we want to add ability to check out number of recipients before you send cross-posted news item.

Solution

I've implemented custom query that allows our partners to give their users this data. This is not a final solution, as details and architecture may be changed, (thus it is Proof of work)

How it works

To do this they implement POST method called customGetRecipientsCounters (or whatever they want to call it) and put a url link to service that expose this API to newsSharingConfig

Example url: https://my-news-sharing-api/getNewsInfo

We expect that this method accepts this data:

{
  organization: {
      tin: string,
      id: string,
      name: string,
  },

  scopes: [{
      property: string,
      unitName: string,
      unitType: string,
  }]

  properties: [{
      id: string,
      address: string,
      addressMeta: addressMeta (JSON),
  }]
}

Condo expects output in this format:

{
  receiversCount: number
}

Note:

This method is created to support only advanced usecases with custom UI and custom Scopes logic. Integrations that do not require custom UI + custom Scopes logic (such as Telegram / Viber) would not require this logic.

More simple solution will be introduced later this year

Bonus

Sometimes you do not want preview to be shown, for example when your app does not have any preview (maybe internal system?)

Sometimes you do not want to show preview for push messages. For example, if your app sends push messages ONLY for emergency news items

I've introduced a setting in newsSharingConfig that covers this usecase

Alllex202 commented 1 month ago

This method is created to support only advanced usecases with custom UI and custom Scopes logic. Integrations that do not require custom UI + custom Scopes logic (such as Telegram / Viber) would not require this logic.

For messengers (telegram/viber), you can use number of group members as number of recipients

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud