@@ -46,13 +46,8 @@ import {
4646 UpdateAgentInboxSharedRequestDto ,
4747 UpdateAgentIntegrationRequestDto ,
4848} from '../../shared/dtos' ;
49- import { ConfigureTelegramWebhookResponseDto } from '../../shared/dtos/configure-telegram-webhook-response.dto' ;
5049import { ConfigureWhatsAppWebhookResponseDto } from '../../shared/dtos/configure-whatsapp-webhook-response.dto' ;
5150import { IssueSlackSetupLinkResponseDto } from '../../shared/dtos/issue-slack-setup-link-response.dto' ;
52- import { IssueTelegramMobileLinkRequestDto } from '../../shared/dtos/issue-telegram-mobile-link-request.dto' ;
53- import { IssueTelegramMobileLinkResponseDto } from '../../shared/dtos/issue-telegram-mobile-link-response.dto' ;
54- import { IssueTelegramSubscriberLinkRequestDto } from '../../shared/dtos/issue-telegram-subscriber-link-request.dto' ;
55- import { IssueTelegramSubscriberLinkResponseDto } from '../../shared/dtos/issue-telegram-subscriber-link-response.dto' ;
5651import { SendAgentTestEmailRequestDto } from '../../shared/dtos/send-agent-test-email-request.dto' ;
5752import { SendAgentWelcomeMessageRequestDto } from '../../shared/dtos/send-agent-welcome-message-request.dto' ;
5853import {
@@ -61,12 +56,6 @@ import {
6156} from '../../shared/dtos/send-whatsapp-test-template.dto' ;
6257import { IssueSlackSetupLinkCommand } from '../slack-linking/issue-slack-setup-link/issue-slack-setup-link.command' ;
6358import { IssueSlackSetupLink } from '../slack-linking/issue-slack-setup-link/issue-slack-setup-link.usecase' ;
64- import { ConfigureTelegramAgentWebhookCommand } from '../telegram/configure-telegram-agent-webhook/configure-telegram-agent-webhook.command' ;
65- import { ConfigureTelegramAgentWebhook } from '../telegram/configure-telegram-agent-webhook/configure-telegram-agent-webhook.usecase' ;
66- import { IssueTelegramMobileLinkCommand } from '../telegram-linking/issue-telegram-mobile-link/issue-telegram-mobile-link.command' ;
67- import { IssueTelegramMobileLink } from '../telegram-linking/issue-telegram-mobile-link/issue-telegram-mobile-link.usecase' ;
68- import { IssueTelegramSubscriberLinkCommand } from '../telegram-linking/issue-telegram-subscriber-link/issue-telegram-subscriber-link.command' ;
69- import { IssueTelegramSubscriberLink } from '../telegram-linking/issue-telegram-subscriber-link/issue-telegram-subscriber-link.usecase' ;
7059import { ConfigureWhatsAppWebhookCommand } from '../whatsapp/configure-whatsapp-webhook/configure-whatsapp-webhook.command' ;
7160import { ConfigureWhatsAppWebhook } from '../whatsapp/configure-whatsapp-webhook/configure-whatsapp-webhook.usecase' ;
7261import { SendWhatsAppTestTemplateCommand } from '../whatsapp/send-whatsapp-test-template/send-whatsapp-test-template.command' ;
@@ -96,10 +85,7 @@ export class AgentIntegrationsController {
9685 private readonly sendAgentWelcomeMessageUsecase : SendAgentWelcomeMessage ,
9786 private readonly configureWhatsAppWebhookUsecase : ConfigureWhatsAppWebhook ,
9887 private readonly sendWhatsAppTestTemplateUsecase : SendWhatsAppTestTemplate ,
99- private readonly configureTelegramAgentWebhookUsecase : ConfigureTelegramAgentWebhook ,
100- private readonly issueTelegramMobileLinkUsecase : IssueTelegramMobileLink ,
10188 private readonly issueSlackSetupLinkUsecase : IssueSlackSetupLink ,
102- private readonly issueTelegramSubscriberLinkUsecase : IssueTelegramSubscriberLink ,
10389 private readonly updateAgentInboxSharedUsecase : UpdateAgentInboxShared
10490 ) { }
10591
@@ -365,70 +351,6 @@ export class AgentIntegrationsController {
365351 ) ;
366352 }
367353
368- @Post ( '/:identifier/integrations/:integrationId/telegram/configure' )
369- @ExternalApiAccessible ( )
370- @KeylessAccessible ( )
371- @HttpCode ( HttpStatus . OK )
372- @ApiResponse ( ConfigureTelegramWebhookResponseDto , 200 )
373- @ApiOperation ( {
374- summary : 'Configure Telegram bot webhook' ,
375- description : `Registers the Novu agent webhook URL with Telegram for the specified integration,
376- generates a cryptographic secret token for webhook verification,
377- and persists it on the integration. Re-running rotates the secret.` ,
378- } )
379- @ApiNotFoundResponse ( {
380- description : 'The agent, integration, or agent-integration link was not found.' ,
381- } )
382- @RequirePermissions ( PermissionsEnum . AGENT_WRITE )
383- updateTelegramWebhook (
384- @UserSession ( ) user : UserSessionData ,
385- @Param ( 'identifier' ) identifier : string ,
386- @Param ( 'integrationId' ) integrationId : string
387- ) : Promise < ConfigureTelegramWebhookResponseDto > {
388- return this . configureTelegramAgentWebhookUsecase . execute (
389- ConfigureTelegramAgentWebhookCommand . create ( {
390- userId : user . _id ,
391- environmentId : user . environmentId ,
392- organizationId : user . organizationId ,
393- agentIdentifier : identifier ,
394- integrationId,
395- } )
396- ) ;
397- }
398-
399- @Post ( '/:identifier/integrations/:integrationId/telegram/mobile-link' )
400- @ExternalApiAccessible ( )
401- @KeylessAccessible ( )
402- @HttpCode ( HttpStatus . OK )
403- @ApiResponse ( IssueTelegramMobileLinkResponseDto , 200 )
404- @ApiOperation ( {
405- summary : 'Issue a short-lived Telegram mobile setup link' ,
406- description :
407- 'Issues a signed, single-use link (TTL = 5 minutes) that can be opened on a mobile device to finish ' +
408- 'configuring a Telegram bot without re-authenticating. Telegram-only.' ,
409- } )
410- @ApiNotFoundResponse ( {
411- description : 'The agent, integration, or agent-integration link was not found.' ,
412- } )
413- @RequirePermissions ( PermissionsEnum . AGENT_WRITE )
414- createTelegramMobileLink (
415- @UserSession ( ) user : UserSessionData ,
416- @Param ( 'identifier' ) identifier : string ,
417- @Param ( 'integrationId' ) integrationId : string ,
418- @Body ( ) body ?: IssueTelegramMobileLinkRequestDto
419- ) : Promise < IssueTelegramMobileLinkResponseDto > {
420- return this . issueTelegramMobileLinkUsecase . execute (
421- IssueTelegramMobileLinkCommand . create ( {
422- userId : user . _id ,
423- environmentId : user . environmentId ,
424- organizationId : user . organizationId ,
425- agentIdentifier : identifier ,
426- integrationId,
427- subscriberId : body ?. subscriberId ,
428- } )
429- ) ;
430- }
431-
432354 @Post ( '/:identifier/integrations/:integrationId/slack/setup-link' )
433355 @ExternalApiAccessible ( )
434356 @KeylessAccessible ( )
@@ -459,38 +381,4 @@ export class AgentIntegrationsController {
459381 } )
460382 ) ;
461383 }
462-
463- @Post ( '/:identifier/integrations/:integrationId/telegram/subscriber-link' )
464- @ExternalApiAccessible ( )
465- @KeylessAccessible ( )
466- @HttpCode ( HttpStatus . OK )
467- @ApiResponse ( IssueTelegramSubscriberLinkResponseDto , 200 )
468- @ApiOperation ( {
469- summary : 'Issue a Telegram subscriber-link deep link' ,
470- description :
471- 'Issues a short-lived opaque start code and returns a Telegram `t.me/<bot>?start=<code>` deep link. When ' +
472- 'opened, Telegram sends `/start <code>` to the bot; the agent webhook consumes the code server-side and ' +
473- 'creates a `telegram_chat` channel endpoint so notifications can reach that subscriber via Telegram.' ,
474- } )
475- @ApiNotFoundResponse ( {
476- description : 'The agent, integration, agent-integration link, or subscriber was not found.' ,
477- } )
478- @RequirePermissions ( PermissionsEnum . AGENT_WRITE )
479- createTelegramSubscriberLink (
480- @UserSession ( ) user : UserSessionData ,
481- @Param ( 'identifier' ) identifier : string ,
482- @Param ( 'integrationId' ) integrationId : string ,
483- @Body ( ) body : IssueTelegramSubscriberLinkRequestDto
484- ) : Promise < IssueTelegramSubscriberLinkResponseDto > {
485- return this . issueTelegramSubscriberLinkUsecase . execute (
486- IssueTelegramSubscriberLinkCommand . create ( {
487- userId : user . _id ,
488- environmentId : user . environmentId ,
489- organizationId : user . organizationId ,
490- agentIdentifier : identifier ,
491- integrationId,
492- subscriberId : body . subscriberId ,
493- } )
494- ) ;
495- }
496384}
0 commit comments