> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/works/reference-implementations/muktasoft-v2.2/deployment/sms-adapter-services/individual-notification-service.md).

# Individual Notification Service

* Package: org.egov.works.service
* Source File: IndividualNotificationService.java

## Overview

The IndividualNotificationService class is responsible for managing notifications related to individual entities within the eGov Works module. It handles the generation and sending of notifications when individual entities are created or updated.

## Attributes

1. config: NotificationServiceConfiguration for accessing configuration settings.
2. producer: Kafka producer for sending notifications.
3. repository: ServiceRequestRepository for fetching data from external services.
4. restTemplate: RestTemplate for making HTTP requests.
5. mapper: ObjectMapper for JSON serialization/deserialization.

## Methods

* process(final String record, @Header(KafkaHeaders.RECEIVED\_TOPIC) String topic, boolean isCreateOperation): Processes the incoming Kafka message containing individual details and delegates the notification sending process based on whether it's a create or update operation.
* sendNotification(IndividualRequest request, boolean isCreateOperation): Sends notifications for individual creation or update based on the boolean flag.
* pushNotificationForCreate(IndividualRequest request): Pushes notifications for individual creation to relevant parties.
* pushNotificationForUpdate(IndividualRequest request): Pushes notifications for individual update to relevant parties.
* getDetailsForSMS(IndividualRequest request): Retrieves details necessary for composing the SMS notification for individual creation or update.
* getMessageForCreate(IndividualRequest request): Retrieves the localized message for individual creation.
* getMessageForUpdate(IndividualRequest request): Retrieves the localized message for individual update.
* getMessage(IndividualRequest request, String msgCode): Retrieves the localized message for the specified code and locale.
* buildMessageForCreate(Map\<String, String> userDetailsForSMS, String message): Builds the message for individual creation based on the provided user details.
* buildMessageForUpdate(Map\<String, String> userDetailsForSMS, String message): Builds the message for individual updates based on the provided user details.
* getLocalisedMessages(RequestInfo requestInfo, String rootTenantId, String locale, String module): Fetches localized messages from the localization service based on the specified parameters.
* setAdditionalFields(IndividualRequest request, String localizationCode, Map\<String, Object> additionalField): Sets additional fields for the notification if required.
* checkAdditionalFieldAndPushONSmsTopic(String customizedMessage, Map\<String, Object> additionalField, Map\<String, String> smsDetails): Checks if additional fields are present and push the SMS notification accordingly.

## Usage

Instantiate and configure the IndividualNotificationService class within the application context to handle notifications related to individual entities. Ensure that dependencies such as NotificationServiceConfiguration, Kafka producer, ServiceRequestRepository, RestTemplate, and ObjectMapper are properly injected. Additionally, configure the methods to handle individual creation and update notifications as per the application's requirements.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digit.org/works/reference-implementations/muktasoft-v2.2/deployment/sms-adapter-services/individual-notification-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
