Skip to content

helsingborg-stad/gdi-send-sms

Repository files navigation

MIT License

Logo

GDI SMS service


Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Acknowledgments

About The Project

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
Loading

(back to top)

Getting Started

# 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

(back to top)

Configure service

The service is configured through standard .env file

Local environment with docker

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>

(back to top)

Prerequisites

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)