Skip to content

Commit 5b09354

Browse files
authored
Telegram Connector (#12)
* First implementation of the Telegram connector * Additional test coverage of the Telegram channel * Connector documentation
1 parent ff32501 commit 5b09354

24 files changed

+7352
-112
lines changed

Deveel.Messaging.Model.sln

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deveel.Messaging.Connector.
4141
EndProject
4242
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deveel.Messaging.Connector.Facebook.XUnit", "test\Deveel.Messaging.Connector.Facebook.XUnit\Deveel.Messaging.Connector.Facebook.XUnit.csproj", "{6DE730ED-C03C-7F63-E5C3-06920CD5B0FE}"
4343
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deveel.Messaging.Connector.Telegram", "src\Deveel.Messaging.Connector.Telegram\Deveel.Messaging.Connector.Telegram.csproj", "{7AB2FDCA-D49E-0329-5707-469617078EB8}"
45+
EndProject
46+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deveel.Messaging.Connector.Telegram.XUnit", "test\Deveel.Messaging.Connector.Telegram.XUnit\Deveel.Messaging.Connector.Telegram.XUnit.csproj", "{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}"
47+
EndProject
4448
Global
4549
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4650
Debug|Any CPU = Debug|Any CPU
@@ -219,6 +223,30 @@ Global
219223
{6DE730ED-C03C-7F63-E5C3-06920CD5B0FE}.Release|x64.Build.0 = Release|Any CPU
220224
{6DE730ED-C03C-7F63-E5C3-06920CD5B0FE}.Release|x86.ActiveCfg = Release|Any CPU
221225
{6DE730ED-C03C-7F63-E5C3-06920CD5B0FE}.Release|x86.Build.0 = Release|Any CPU
226+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
227+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
228+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|x64.ActiveCfg = Debug|Any CPU
229+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|x64.Build.0 = Debug|Any CPU
230+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|x86.ActiveCfg = Debug|Any CPU
231+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Debug|x86.Build.0 = Debug|Any CPU
232+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
233+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|Any CPU.Build.0 = Release|Any CPU
234+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|x64.ActiveCfg = Release|Any CPU
235+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|x64.Build.0 = Release|Any CPU
236+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|x86.ActiveCfg = Release|Any CPU
237+
{7AB2FDCA-D49E-0329-5707-469617078EB8}.Release|x86.Build.0 = Release|Any CPU
238+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
239+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
240+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|x64.ActiveCfg = Debug|Any CPU
241+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|x64.Build.0 = Debug|Any CPU
242+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|x86.ActiveCfg = Debug|Any CPU
243+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Debug|x86.Build.0 = Debug|Any CPU
244+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
245+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|Any CPU.Build.0 = Release|Any CPU
246+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|x64.ActiveCfg = Release|Any CPU
247+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|x64.Build.0 = Release|Any CPU
248+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|x86.ActiveCfg = Release|Any CPU
249+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8}.Release|x86.Build.0 = Release|Any CPU
222250
EndGlobalSection
223251
GlobalSection(SolutionProperties) = preSolution
224252
HideSolutionNode = FALSE
@@ -238,6 +266,8 @@ Global
238266
{FAA38244-1DFE-A70C-4F12-3012E65A9779} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
239267
{BAA0E8C8-0BAF-3908-4ACE-48FCDDB9BD26} = {0F91077D-AC47-4319-96FF-09CA6EE50CC6}
240268
{6DE730ED-C03C-7F63-E5C3-06920CD5B0FE} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
269+
{7AB2FDCA-D49E-0329-5707-469617078EB8} = {0F91077D-AC47-4319-96FF-09CA6EE50CC6}
270+
{D6BAA05A-DB2C-5209-2E20-6A6BBCE22BC8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
241271
EndGlobalSection
242272
GlobalSection(ExtensibilityGlobals) = postSolution
243273
SolutionGuid = {64BF9420-C7A8-4D2B-804F-41EB2E83437F}

docs/connectors/README.md

Lines changed: 18 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This directory contains comprehensive documentation for all available connectors
66

77
| Connector | Provider | Type | Documentation | Package |
88
|-----------|----------|------|---------------|---------|
9+
| **Telegram Bot** | Telegram | Bot API | [?? Complete Guide](telegram-bot-connector.md) | `Deveel.Messaging.Connector.Telegram` |
910
| **Twilio SMS** | Twilio | SMS | [?? Complete Guide](twilio-sms-connector.md) | `Deveel.Messaging.Connector.Twilio` |
1011
| **Twilio WhatsApp** | Twilio | WhatsApp | [?? Complete Guide](twilio-whatsapp-connector.md) | `Deveel.Messaging.Connector.Twilio` |
1112
| **Facebook Messenger** | Facebook | Messenger | [?? Complete Guide](facebook-messenger-connector.md) | `Deveel.Messaging.Connector.Facebook` |
@@ -14,6 +15,13 @@ This directory contains comprehensive documentation for all available connectors
1415

1516
## ?? Quick Start by Provider
1617

18+
### Telegram Bot Messaging
19+
**Install and configure Telegram Bot API:**
20+
```bash
21+
dotnet add package Deveel.Messaging.Connector.Telegram
22+
```
23+
?? **[Complete Telegram Bot Setup Guide](telegram-bot-connector.md)**
24+
1725
### SMS Messaging
1826
**Install and configure Twilio SMS connector:**
1927
```bash
@@ -53,7 +61,7 @@ dotnet add package Deveel.Messaging.Connector.Sendgrid
5361

5462
Each connector documentation provides comprehensive coverage:
5563

56-
### ?? **Installation & Setup**
64+
### ??? **Installation & Setup**
5765
- NuGet package installation instructions
5866
- Required dependencies and prerequisites
5967
- Configuration parameter setup
@@ -93,6 +101,7 @@ Each connector documentation provides comprehensive coverage:
93101

94102
| Connector | Send Messages | Receive Messages | Status Tracking | Batch Operations | Templates | Media Attachments | Health Monitoring | Webhook Support | Quick Replies | Interactive Elements |
95103
|-----------|:-------------:|:----------------:|:---------------:|:----------------:|:---------:|:-----------------:|:-----------------:|:---------------:|:-------------:|:--------------------:|
104+
| **Telegram Bot** | ? | ? | ? | ? | ? | ? | ? | ? | ? | ? |
96105
| **Twilio SMS** | ? | ? | ? | ? | ? | ? | ? | ? | ? | ? |
97106
| **Twilio WhatsApp** | ? | ? | ? | ? | ? | ? | ? | ? | ? | ? |
98107
| **Facebook Messenger** | ? | ? | ? | ? | ? | ? | ? | ? | ? | ? |
@@ -105,6 +114,7 @@ Each connector documentation provides comprehensive coverage:
105114

106115
| Use Case | Recommended Connector | Why |
107116
|----------|----------------------|-----|
117+
| **Bot Interactions** | [Telegram Bot](telegram-bot-connector.md) | Interactive keyboards, rich media, real-time |
108118
| **Order Confirmations** | [SendGrid Email](sendgrid-email-connector.md) | Rich formatting, reliable delivery |
109119
| **SMS Verification** | [Twilio SMS](twilio-sms-connector.md) | High delivery rates, global reach |
110120
| **Push Notifications** | [Firebase FCM](firebase-push-connector.md) | Real-time, cross-platform |
@@ -115,6 +125,7 @@ Each connector documentation provides comprehensive coverage:
115125

116126
| Use Case | Recommended Connector | Why |
117127
|----------|----------------------|-----|
128+
| **Bot Support** | [Telegram Bot](telegram-bot-connector.md) | 24/7 availability, interactive responses |
118129
| **Support Tickets** | [SendGrid Email](sendgrid-email-connector.md) | Threading, attachments |
119130
| **Live Chat** | [Facebook Messenger](facebook-messenger-connector.md) | Real-time conversation |
120131
| **Urgent Alerts** | [Twilio SMS](twilio-sms-connector.md) | Immediate delivery |
@@ -125,6 +136,7 @@ Each connector documentation provides comprehensive coverage:
125136

126137
| Use Case | Recommended Connector | Why |
127138
|----------|----------------------|-----|
139+
| **Interactive Campaigns** | [Telegram Bot](telegram-bot-connector.md) | Rich media, interactive buttons, channels |
128140
| **Email Newsletters** | [SendGrid Email](sendgrid-email-connector.md) | Advanced tracking, templates |
129141
| **SMS Campaigns** | [Twilio SMS](twilio-sms-connector.md) | Bulk messaging, opt-out handling |
130142
| **App Promotions** | [Firebase FCM](firebase-push-connector.md) | Topic messaging, segmentation |
@@ -136,113 +148,8 @@ Each connector documentation provides comprehensive coverage:
136148
### Installation for Multiple Providers
137149
```bash
138150
# Install multiple connectors for comprehensive messaging
139-
dotnet add package Deveel.Messaging.Connector.Twilio # SMS + WhatsApp
140-
dotnet add package Deveel.Messaging.Connector.Facebook # Facebook Messenger
141-
dotnet add package Deveel.Messaging.Connector.Firebase # Push notifications
142-
dotnet add package Deveel.Messaging.Connector.Sendgrid # Email delivery
143-
```
144-
145-
### Multi-Channel Service Example
146-
```csharp
147-
public class NotificationService
148-
{
149-
private readonly TwilioSmsConnector _smsConnector;
150-
private readonly FacebookMessengerConnector _facebookConnector;
151-
private readonly SendGridEmailConnector _emailConnector;
152-
private readonly FirebasePushConnector _pushConnector;
153-
154-
public async Task SendNotification(User user, string message, NotificationChannel channel)
155-
{
156-
switch (channel)
157-
{
158-
case NotificationChannel.SMS:
159-
await _smsConnector.SendMessageAsync(CreateSmsMessage(user, message));
160-
break;
161-
case NotificationChannel.FacebookMessenger:
162-
await _facebookConnector.SendMessageAsync(CreateFacebookMessage(user, message));
163-
break;
164-
case NotificationChannel.Email:
165-
await _emailConnector.SendMessageAsync(CreateEmailMessage(user, message));
166-
break;
167-
case NotificationChannel.Push:
168-
await _pushConnector.SendMessageAsync(CreatePushMessage(user, message));
169-
break;
170-
}
171-
}
172-
}
173-
```
174-
175-
## ?? Testing Strategies
176-
177-
### Unit Testing
178-
Each connector guide includes unit testing examples:
179-
```csharp
180-
[Test]
181-
public async Task SendMessage_ValidInput_ReturnsSuccess()
182-
{
183-
// Arrange
184-
var connector = new MockConnector(schema);
185-
var message = CreateTestMessage();
186-
187-
// Act
188-
var result = await connector.SendMessageAsync(message);
189-
190-
// Assert
191-
Assert.IsTrue(result.IsSuccess);
192-
}
193-
```
194-
195-
### Integration Testing
196-
```csharp
197-
[Test]
198-
[Category("Integration")]
199-
public async Task SendMessage_RealProvider_DeliversMessage()
200-
{
201-
// Only run with real credentials
202-
Skip.IfNot(HasTestCredentials());
203-
204-
var connector = CreateRealConnector();
205-
var result = await connector.SendMessageAsync(testMessage);
206-
207-
Assert.IsTrue(result.IsSuccess);
208-
}
209-
```
210-
211-
## ?? Support and Resources
212-
213-
### Documentation Links
214-
- **[Framework Overview](../README.md)** - Main framework documentation
215-
- **[Getting Started](../getting-started.md)** - Quick start guide
216-
- **[Channel Schemas](../ChannelSchema-Usage.md)** - Schema configuration
217-
- **[Connector Implementation](../ChannelConnector-Usage.md)** - Custom connector guide
218-
219-
### Community Resources
220-
- **[GitHub Repository](https://github.com/deveel/deveel.messaging)** - Source code and issues
221-
- **[GitHub Discussions](https://github.com/deveel/deveel.messaging/discussions)** - Community support
222-
- **[Contributing Guide](../CONTRIBUTING.md)** - How to contribute
223-
224-
### Provider Resources
225-
226-
| Provider | Documentation | Console | Support |
227-
|----------|---------------|---------|---------|
228-
| **Twilio** | [Docs](https://www.twilio.com/docs) | [Console](https://console.twilio.com) | [Support](https://support.twilio.com) |
229-
| **Facebook** | [Docs](https://developers.facebook.com/docs/messenger-platform) | [Console](https://developers.facebook.com) | [Support](https://developers.facebook.com/support) |
230-
| **Firebase** | [Docs](https://firebase.google.com/docs) | [Console](https://console.firebase.google.com) | [Support](https://firebase.google.com/support) |
231-
| **SendGrid** | [Docs](https://docs.sendgrid.com) | [Console](https://app.sendgrid.com) | [Support](https://support.sendgrid.com) |
232-
233-
## ?? Contributing New Connectors
234-
235-
Planning to add a new connector? Each guide follows our standard template:
236-
237-
1. **?? Installation** - Package installation and setup
238-
2. **?? Configuration** - Schema and parameter setup
239-
3. **?? Usage Examples** - Basic to advanced usage patterns
240-
4. **?? Integration** - Webhooks and bidirectional messaging
241-
5. **?? Testing** - Unit and integration testing guidance
242-
6. **?? Production** - Performance and security considerations
243-
244-
See our [Connector Implementation Guide](../ChannelConnector-Usage.md) for creating new connectors.
245-
246-
---
247-
248-
*Choose the connector that best fits your messaging needs and follow the detailed documentation for implementation guidance.*
151+
dotnet add package Deveel.Messaging.Connector.Telegram # Telegram Bot API
152+
dotnet add package Deveel.Messaging.Connector.Twilio # SMS + WhatsApp
153+
dotnet add package Deveel.Messaging.Connector.Facebook # Facebook Messenger
154+
dotnet add package Deveel.Messaging.Connector.Firebase # Push notifications
155+
dotne

0 commit comments

Comments
 (0)