{"id":15013833,"url":"https://github.com/iainporter/sms-service","last_synced_at":"2025-04-12T05:50:26.829Z","repository":{"id":37628404,"uuid":"275236374","full_name":"iainporter/sms-service","owner":"iainporter","description":"service for sending SMS Messages (Quarkus, Kotlin, postgres, kafka, debezium, docker)","archived":false,"fork":false,"pushed_at":"2022-11-16T01:28:40.000Z","size":556,"stargazers_count":30,"open_issues_count":4,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T01:12:45.119Z","etag":null,"topics":["debezium","docker","kafka","kotlin","quarkus"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iainporter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-26T19:53:49.000Z","updated_at":"2025-01-21T04:07:54.000Z","dependencies_parsed_at":"2023-01-21T11:46:56.414Z","dependency_job_id":null,"html_url":"https://github.com/iainporter/sms-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iainporter%2Fsms-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iainporter%2Fsms-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iainporter%2Fsms-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iainporter%2Fsms-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iainporter","download_url":"https://codeload.github.com/iainporter/sms-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525153,"owners_count":21118616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debezium","docker","kafka","kotlin","quarkus"],"created_at":"2024-09-24T19:44:50.209Z","updated_at":"2025-04-12T05:50:26.802Z","avatar_url":"https://github.com/iainporter.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## SMS Service\n\nSee accompanying blog posts\n\n* [Part One - Building a microservice from the ground up with quarkus kotlin and debezium]( https://medium.com/@changeant/building-a-microservice-from-the-ground-up-with-quarkus-kotlin-and-debezium-83ae5c8a8bbc)\n* [Part Two - Implementing the transactional outbox pattern with debezium in quarkus](https://medium.com/@changeant/implementing-the-transactional-outbox-pattern-with-debezium-in-quarkus-f2680306951)\n* [Part Three - Building a resilient microservice with quarkus and wiremock](https://levelup.gitconnected.com/building-a-resilient-microservice-with-quarkus-and-wiremock-de59b2a4fac7)\n* [Part Four - Securing a microservice in quarkus with openid-connect](https://levelup.gitconnected.com/securing-a-microservice-in-quarkus-with-openid-connect-505204d1c9a9)\n* [Part Five - Running a microservice in quarkus on graalvm](https://medium.com/@changeant/running-a-microservice-in-quarkus-on-graalvm-52d6b42a5840)\n\nAdditional related posts\n\n* [Containerizing your microservice in quarkus with jib](https://medium.com/@changeant/containerizing-your-microservice-in-quarkus-with-jib-fae0f62bd57e)\n* [Building a CI pipeline for a microservice in quarkus with circleci](https://levelup.gitconnected.com/building-a-ci-pipeline-for-a-microservice-in-quarkus-with-circleci-11e9b679423f)\n* [Securing micro services in quarkus with Amazon Cognito](https://medium.com/@changeant/securing-micro-services-in-quarkus-with-aws-cognito-387990c04100)\n\nA production quality micro service for sending SMS messages that demonstrates the use of several technologies including:\n\n* Quarkus\n* GraalVM\n* Kotlin\n* Postgres (Persistence)\n* Panache (JPA)\n* Flyway (Database migration)\n* Kafka (Messaging)\n* Debezium, Kafka Connect (Transactional Outbox pattern)\n* Okta (OIDC)\n* Open API\n* Docker\n* Test Containers\n* Wiremock\n\nThe service accepts SMS messages and routes them to configured providers\n\nThe service has support for Twilio and ClickSend \n\nNew providers can easily be plugged in by implementing com.porterhead.sms.provider.SmsProvider\n\nYou can build the service, but it won't accept messages unless there is at least one provider configured\n\n## The architecture\n\n![Arch diagram](https://github.com/iainporter/sms-service/blob/master/images/sms_service.png?raw=true)\n\n# Configuring the Service\nTo configure the service, sign up to Twilio and/or ClickSend and add the appropriate properties\nto a config/application.properties file.\n\nSign up to Okta or any other OIDC provider of your choice and add the base url to the properties file\n\nCreate a client in your OIDC domain and add the client-id to the config\n\nAn example for Okta would be \n\n```\nquarkus.oidc.auth-server-url=\u003cYour Okta server url\u003e\u003e\nquarkus.oidc.client-id=\u003cyour client-id\u003e\n```\n \nSee application.properties.sample \n\nEnsure the config directory is mounted by checking the path in the docker-compose.yml file\n\ni.e.\n```\n    volumes:\n      - ../config/application.properties:/deployments/config/application.properties\n```\n\nBuild the service\n\n```\n mvn install\n ```\n\ndocker-compose to bring the service up\n\n```\ncd sms-service\ndocker-compose up\n```\n\nInstall the Sms connector\n```\ncurl 'localhost:8083/connectors/' -i -X POST -H \"Accept:application/json\" \\\n-H \"Content-Type:application/json\" \\\n-d '{\"name\": \"sms-connector\", \"config\": {\"connector.class\": \"io.debezium.connector.postgresql.PostgresConnector\", \"database.hostname\": \"postgres-db\", \"database.port\": \"5432\", \"database.user\": \"postgres\", \"database.password\": \"postgres\", \"database.dbname\" : \"sms\", \"database.server.name\": \"smsdb1\", \"table.whitelist\": \"public.outboxevent\", \"transforms\" : \"outbox\",\"transforms.outbox.type\" : \"io.debezium.transforms.outbox.EventRouter\", \"transforms.OutboxEventRouter.event.key\": \"aggregate_id\", \"transforms.outbox.table.fields.additional.placement\": \"type:header:eventType\"}}'    \n```\n\nLogin to the OIDC provider you configured above and obtain an access token\n\nTo send a message\n```\ncurl 'http://localhost:8080/v1/sms' -i -X POST  \\\n   -H 'Content-Type: application/json'  \\\n   -H 'authorization: Bearer \u003cyour access token\u003e'\n   -d '{\"text\":\"Foo Bar!\", \"fromNumber\": \"+1234567890\", \"toNumber\": \"+1234567891\"}'\n```\n\nFrom the response you can check the status by using the location header in the response\n\ni.e.\n```\nHTTP/1.1 202 Accepted\nContent-Length: 0\nLocation: http://localhost:8080/v1/sms/b3a20fac-2d00-49d2-b3ef-b3a3e5ac02ca\n```\n```\ncurl 'http://localhost:8080/v1/sms/b3a20fac-2d00-49d2-b3ef-b3a3e5ac02ca' -i -X GET  \\\n   -H 'Content-Type: application/json'  \\\n   -H 'authorization: Bearer \u003cyour access token\u003e'\n```\n\nyou should see a response similar to this\n\n```\n{\n\"createdAt\":\"2020-07-16T16:43:59.43561Z\",\n\"fromNumber\":\"+1234567890\",\n\"id\":\"b3a20fac-2d00-49d2-b3ef-b3a3e5ac02ca\",\n\"status\":\"DELIVERED\",\n\"text\":\"Foo Bar!\",\n\"provider\": \"Twilio\",\n\"principal\": \"backend-service\",\n\"toNumber\":\"+1234567891\",\n\"updatedAt\":\"2020-07-16T16:44:00.432926Z\"\n}\n```\n\n# Running as a native executable on GraalVM\n\nTo build the native image you must have the native-image tool for GraalVM installed.\n\nTo build it \n\n```\nmvn clean install -Pnative\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiainporter%2Fsms-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiainporter%2Fsms-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiainporter%2Fsms-service/lists"}