|
1 | | -# Pandatech.Communicator |
| 1 | +# 1. PandaTech.Communicator |
2 | 2 |
|
3 | | -## Introduction |
| 3 | +- [1. EasyRateLimiter](#1-easyratelimiter) |
| 4 | + - [1.1. Introduction](#11-introduction) |
| 5 | + - [1.2. Installation](#12-installation) |
| 6 | + - [1.3. Setup](#13-setup) |
| 7 | + - [1.3.1. Program.cs Example](#131-programcs-example) |
| 8 | + - [1.3.2. Appsettings.json Example](#132-appsettingsjson-example) |
| 9 | + - [1.4. Configuration Options Explained](#14-configuration-options-explained) |
| 10 | + - [1.5. Limitations](#15-limitations) |
| 11 | + - [1.6. License](#16-license) |
4 | 12 |
|
5 | | -This nuget is fake for now. Under development. |
| 13 | +## 1.1. Introduction |
| 14 | +**PandaTech.Communicator** is aimed to send Email and SMS messages to the clients of your service where you use this library. |
6 | 15 |
|
| 16 | +- **Email:** By given setup it's easy and fast to configure and setup Email providers for later use by different channels. |
| 17 | +- **SMS:** By given setup it's easy and fast to configure and setup already integrated SMS providers for later use by different channels. |
| 18 | + - **Dexatel** |
| 19 | + - **Twilio** |
7 | 20 |
|
8 | | -## Features |
| 21 | +This package is ideal for efficient and reliable messaging in any application. |
9 | 22 |
|
| 23 | +## 1.2. Installation |
10 | 24 |
|
11 | | -## Installation |
| 25 | +Install this NuGet library directly from the IDE package installer or by following command: |
12 | 26 |
|
| 27 | +`dotnet add package PandaTech.Communicator` |
13 | 28 |
|
| 29 | +## 1.3. Setup |
14 | 30 |
|
15 | | -## Usage |
| 31 | +To incorporate PandaTech.Communicator into your project, you have a primary method to setup in your `Program.cs`: |
16 | 32 |
|
| 33 | +`builder.AddPandaCommunicator();` |
17 | 34 |
|
18 | | -## License |
| 35 | +Configuration options can be specified either in `appsettings.json` or directly in `Program.cs`, with the latter taking precedence. |
19 | 36 |
|
20 | | -Pandatech.Communicator is licensed under the MIT License. |
| 37 | +### 1.3.1. Program.cs Example |
| 38 | + |
| 39 | +In case of using SSL by setting UseSsl = true use port number 456, otherwise use 587 for non SSL connection. |
| 40 | + |
| 41 | +```csharp |
| 42 | +builder.AddPandaCommunicator(options => |
| 43 | +{ |
| 44 | + options.SmsFake = false; |
| 45 | + options.SmsConfigurations = |
| 46 | + [ |
| 47 | + new SmsConfiguration |
| 48 | + { |
| 49 | + Provider = "Dexatel", |
| 50 | + BaseUrl = "https://api.dexatel.com", |
| 51 | + From = "sender_name", |
| 52 | + Properties = new() |
| 53 | + { |
| 54 | + { "X-Dexatel-Key", "key" } |
| 55 | + }, |
| 56 | + TimeoutMs = 10000, |
| 57 | + Channel = "GeneralSender" |
| 58 | + }, |
| 59 | + |
| 60 | + new SmsConfiguration |
| 61 | + { |
| 62 | + Provider = "Twilio", |
| 63 | + BaseUrl = "https://api.twilio.com", |
| 64 | + From = "sender_number", |
| 65 | + Properties = new() |
| 66 | + { |
| 67 | + { "SID", "key" }, |
| 68 | + { "AUTH_TOKEN", "token" } |
| 69 | + }, |
| 70 | + TimeoutMs = 10000, |
| 71 | + Channel = "TransactionalSender" |
| 72 | + } |
| 73 | + ]; |
| 74 | + options.EmailFake = false; |
| 75 | + options.EmailConfigurations = |
| 76 | + [ |
| 77 | + new EmailConfiguration |
| 78 | + { |
| 79 | + SmtpServer = "smtp.test.com", |
| 80 | + SmtpPort = 465, // 587 |
| 81 | + SmtpUsername = "test", |
| 82 | + SmtpPassword = "test123", |
| 83 | + SenderEmail = "[email protected]", |
| 84 | + UseSsl = true, // false |
| 85 | + TimeoutMs = 10000, |
| 86 | + Channel = "GeneralSender" |
| 87 | + }, |
| 88 | + |
| 89 | + new EmailConfiguration |
| 90 | + { |
| 91 | + SmtpServer = "smtp.gmail.com", |
| 92 | + SmtpPort = 465, // 587 |
| 93 | + SmtpUsername = "vazgen", |
| 94 | + SmtpPassword = "vazgen123", |
| 95 | + SenderEmail = "[email protected]", |
| 96 | + UseSsl = true, // false |
| 97 | + TimeoutMs = 10000, |
| 98 | + Channel = "TransactionalSender" |
| 99 | + } |
| 100 | + ]; |
| 101 | +}); |
| 102 | + |
| 103 | +``` |
| 104 | + |
| 105 | +### 1.3.2. Appsettings.json Example |
| 106 | + |
| 107 | +```json |
| 108 | +{ |
| 109 | + "Logging": { |
| 110 | + "LogLevel": { |
| 111 | + "Default": "Information", |
| 112 | + "Microsoft.AspNetCore": "Warning" |
| 113 | + } |
| 114 | + }, |
| 115 | + "PandaCommunicator": { |
| 116 | + "SmsFake": false, |
| 117 | + "SmsConfigurationOptions": [ |
| 118 | + { |
| 119 | + "Provider": "Dexatel", |
| 120 | + "BaseUrl": "https://api.dexatel.com", |
| 121 | + "From": "sender_name", |
| 122 | + "Properties": { |
| 123 | + "X-Dexatel-Key": "key" |
| 124 | + }, |
| 125 | + "TimeoutMs": "10000", |
| 126 | + "Channel": "GeneralSender" |
| 127 | + }, |
| 128 | + { |
| 129 | + "Provider": "Twilio", |
| 130 | + "BaseUrl": "https://api.twilio.com", |
| 131 | + "From": "twilio_sender_number", |
| 132 | + "Properties": { |
| 133 | + "SID": "key", |
| 134 | + "AUTH_TOKEN": "token" |
| 135 | + }, |
| 136 | + "TimeoutMs": "10000", |
| 137 | + "Channel": "TransactionalSender" |
| 138 | + } |
| 139 | + ], |
| 140 | + "EmailFake": false, |
| 141 | + "EmailConfigurationOptions": [ |
| 142 | + { |
| 143 | + "SmtpServer": "smtp.gmail.com", |
| 144 | + "SmtpPort": "465", // 587 |
| 145 | + "SmtpUsername": "test", |
| 146 | + "SmtpPassword": "test123", |
| 147 | + "SenderEmail": "[email protected]", |
| 148 | + "UseSsl": "true", // false |
| 149 | + "TimeoutMs": "10000", |
| 150 | + "Channel": "GeneralSender" |
| 151 | + }, |
| 152 | + { |
| 153 | + "SmtpServer": "smtp.gmail.com", |
| 154 | + "SmtpPort": "465", // 587 |
| 155 | + "SmtpUsername": "vazgen", |
| 156 | + "SmtpPassword": "vazgen123", |
| 157 | + "SenderEmail": "[email protected]", |
| 158 | + "UseSsl": "true", // false |
| 159 | + "TimeoutMs": "10000", |
| 160 | + "Channel": "TransactionalSender" |
| 161 | + } |
| 162 | + ] |
| 163 | + } |
| 164 | +} |
| 165 | +``` |
| 166 | +The configuration options in `appsettings.json` and `program.cs` (priority) are identical. |
| 167 | + |
| 168 | +## 1.4. Configuration Options Explained |
| 169 | + |
| 170 | +- **PandaCommunicator:** Global settings for PandaTech.Communicator |
| 171 | +- **SmsFake:** This setup is for fake SMS service to be used which doesn't send real SMS messages and just return `TTask.CompletedTask`. |
| 172 | +- **SmsConfigurations:** SMS configurations given by `appsettings.json` or via `builder.AddPandaCommunicator()` options for SMS. |
| 173 | +- **EmailFake:** This setup is for fake Email service to be used which doesn't send real SMS messages and just return `TTask.CompletedTask`. |
| 174 | +- **EmailConfigurations:** Email configurations given by `appsettings.json` or via `builder.AddPandaCommunicator()` options for Email. |
| 175 | + |
| 176 | +## 1.5. Limitations |
| 177 | + |
| 178 | +PandaTech.Communicator works with all Email providers, but with only with existing integrations for SMS listed above. |
| 179 | + |
| 180 | +## 1.6. License |
| 181 | + |
| 182 | +PandaTech.Communicator is licensed under the MIT License. |
0 commit comments