Table of Contents
This project is providing SMS capabilities to the GDI infrastructure. The current usecase is to provide a confirmation SMS to a customer changing his/her phone number on the Mypages section of the web.
The service will retry sending a failed message 5 times before discarding it.
There are three services provided by the project:
- A listener service that subscribes to a RabbitMQ queue.
- An SMS content service that formats the messages to be sent
- An SMS send service that pushes the message to an external SMS proxy for delivery
sequenceDiagram
autonumber
participant MessageQueue
participant ListenerService
participant ContentService
participant SendService
MessageQueue->>+ListenerService: Event triggered
ListenerService->>+ContentService: Build content
ContentService-->>-ListenerService: Formatted content
ListenerService->>+SendService: Send SMS message
SendService-->>-ListenerService: Return
alt Send successful
ListenerService-->>MessageQueue: Acknowledge
else Send failed
ListenerService-->>-MessageQueue: Negative acknowledge
end
# install dependencies
yarn
# run tests
yarn test
# run tests and report coverage
yarn coverage
# start queue listener daemon
yarn start
# start with debugging output
DEBUG=* yarn start
The service is configured through standard .env file
Start a dockerized RabitMQ with
docker run -d --hostname my-rabbit --name some-rabbit -p 5672:5672 -p 888:15672 -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management
Ensure .env
contains
QUEUE_PROVIDER=amqp
AMQP_URI=amqp://user:password@localhost:5672
AMQP_EXCHANGE=gdi-about-me-person-changed
AMQP_QUEUE=sms-queue
AMQP_FILTER=phone.changed
CONTENT_PROVIDER=helsingborg
CONTENT_VERIFICATION_PATH=https://helsingborg.se/verify?tel=
SMS_PROVIDER=helsingborg
SMS_PROXY_URL=<Secret, provided by devops>
SMS_PROXY_KEY=<Secret, provided by devops>
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.