Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Objective:

The objective of this service is to create a common point to manage all the SMS notifications being sent out of the platform. Modules like PT, TL, PGR etc make use of this service to send messages through the Kafka Queue.

Requirements:

  • Prior Knowledge of Java/J2EE

  • Prior Knowledge of SpringBoot

  • Prior Knowledge of Third party API integration

  • Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON etc

  • Prior Knowledge of Kafka and related concepts like Producer, Consumer, Topic etc.

Setup:

Step 1: Start the egov-notification service present in the following repo:

https://github.com/egovernments/core-services/tree/master/egov-notification-sms

Or port forward the egov-notification service. 

Configurable Properties:

 Following are the properties in application.properties file in notifcation sms service which are configurable.

Property

Value

Remarks

kafka.topics.notification.sms.name


egov.core.notification.sms

It is the topic name to which the notification sms consumer would subscribe. Any module wanting to integrate with this consumer should post data to this topic only.

sms.gateway.to.use


SMS_COUNTRY

This property decides which SMS gateway is to be used by the service to send messages. Currently, MSDG and SMS Country gateways have been implemented.

sms.enabled


true

Property to enable and disable SMS sending. It is a boolean field.

sms.provider.url


http://abc.in

URL of the provider. This will be given by the SMS provider only.

sms.sender.username

egovsms

Username as provided by the gateway which is passed during the API call to the gateway. 

sms.sender.password


abc123

Password as provided by the gateway which is passed during the API call to the gateway. This has to be encrypted and stored

sms.sender


EGOV

SMS sender id provided by the gateway, this will show up as the sender on receiver’s phone.

sms.sender.secure.key


asdfghjuytrewqsdfgh

Secure key to be passed during the API call to the gateway. This is optional, right now only MSDG expects a secure key, SMS Country doesn’t. So this is dependent on the provider.

sms.config.map

{'User':'$username', 'passwd': '$password', 'sid':'$senderid', 'mobilenumber':'$mobileno', 'message':'$message', 'mtype':'N', 'DR':'Y', 'smsservicetype':'singlemsg'}


Map of parameters to be passed to the API gateway. This is provider-specific. The one attached here is for SMS Country, Please refer application.properties for other gateways.

Entities:

SMS: Model to capture the sms information. The object pushed onto the queue must be in accordance to this model. Contains mobileNumber and message.

How does it work?:

This service is a consumer, which means it reads from the kafka queue and doesn’t provide facility to be accessed through API calls, there’s no REST layer here. The producers willing to integrate with this consumer will be posting a JSON that is in accordance with the entity mentioned above onto the topic configured at ‘kafka.topics.notification.sms.name’.

The notification-sms service reads from the queue and sends the sms to the mentioned phone number using one of the SMS providers configured. The decision as to which provide is to be picked is controlled by the property ‘sms.gateway.to.use’ from the application.properties file. Currently, SMS Country and MSDG are implemented. The API contract of these providers is available on the respective portals.

There is a common interface which has to be used incase a new provider is to be configured. The current code-base has 2 implementations of the same interface. Please ensure that the implementation follows the norms of the provider wrt to encryption, masking, rate-limiting etc. 

We’ve tested this service with localised msgs in Hindi, Kannada and other languages, We’ve observed that both MSDG and SMS Country have seamless support for localised msgs. Please go through the API documentation of these SMS gateways to support localised messages and also for any new provider that is implemented.

EXAMPLE:

Kafka -
Topic: egov.core.notification.sms
Body:

{"mobileNumber": "9480411228", "message":"Hey, how you doing?"}

Messages -

Interaction Diagram:

  • No labels