TrueVote.Comms is an implementation of interacting with the TrueVote Voting Suite of Applications via Communication (Email, Notifications, Bots, etc.). It's deployed as an Azure Functions project.
The main technology stack platform is .NET Core 9.0.
Telegram is the first bot implemented. Additional Bot frameworks can be added.
- Install Visual Studio 2022 (preview) or later, or Visual Studio Code. Ensure that
$ dotnet --versionis at least 9.0.
Create a new file at the root of the TrueVote.Comms project named local.settings.json.
Get the ServiceBusConnectionString from Azure portal. Currently Service Bus is not available to run locally.
Get the ServiceAccountNsec by registering a user using the TrueVote App specifically as a "Services" privileged user.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"BaseApiUrl": "https://localhost:7253/api",
"TelegramBotKey": "<TelegramBotKey>",
"TelegramRuntimeChannel": "TrueVote_Api_Runtime_Channel_Dev",
"ServiceBusConnectionString": "<ServiceBusConnectionString>",
"ServiceBusCommsQueueName": "comms-dev",
"ServiceAccountNsec": "<ServiceAccountNsec>",
"TransactionFromEmailAddress": "electionadmin@truevote.org",
"TransactionFromEmailName": "Election Admin TrueVote",
"MandrillSMTPServerHost": "smtp.mandrillapp.com",
"MandrillSMTPServerPort": "587",
"MandrillApiKey": "<MandrillApiKey>"
}
}$ dotnet restore
$ dotnet tool restoreOpen TrueVote.Comms.sln solution in Visual Studio, and build the solution.
TrueVote.Comms makes REST calls to TrueVote.Api and uses C# models via the OpenAPI spec from the TrueVote.Api schema.
To refresh the models, use nswag.
Nswag is installed in this project as a dotnet tool.
Local: $ dotnet nswag openapi2csclient /input:https://localhost:7253/swagger/v1/swagger.json /output:TrueVote.Api.cs /namespace:TrueVote.Api
Production: $ dotnet nswag openapi2csclient /input:https://api.truevote.org/swagger/v1/swagger.json /output:TrueVote.Api.cs /namespace:TrueVote.Api
TrueVote.Comms uses sementic versioning, starting with 1.0.0.
The patch (last segment of the 3 segments) is auto-incremented via a GitHub action when a pull request is merged to master. The GitHub action is configured in .github/workflows/truevote-Comms-version.yml. To update the major or minor version, follow the instructions specified in the bumping section of the action - use #major or #minor in the commit message to auto-increment the version.
We welcome useful contributions. Please read our contributing guidelines before submitting a pull request.
TrueVote.Comms is licensed under the MIT license.
