@@ -436,6 +436,48 @@ def create_bot(self,
436436 json = payload ,
437437 headers = headers )
438438
439+ def create_bot_template (self ,
440+ name : str = None ,
441+ avatar : str = None ,
442+ max_chats_count : int = None ,
443+ default_group_priority : str = None ,
444+ job_title : str = None ,
445+ owner_client_id : str = None ,
446+ affect_existing_installations : bool = None ,
447+ payload : dict = None ,
448+ headers : dict = None ) -> httpx .Response :
449+ ''' Creates a new bot template for the Client ID (application) provided in the request.
450+ One Client ID can register up to five bot templates.
451+ Bots based on the template will be automatically created on the license when the application is installed.
452+ The bots will have the same ID as the bot template. If the application is already installed on the license,
453+ the bots will be created only if `affect_existing_installations` is set to `true`.
454+ Args:
455+ name (str): Display name.
456+ avatar (str): Avatar URL.
457+ max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
458+ default_group_priority (str): The default routing priority for a group without defined priority.
459+ job_title (str): Bot's job title.
460+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
461+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
462+ will be ignored, and provided `owner_client_id` will be used instead.
463+ affect_existing_installations (bool): based on this template will be created on all licenses that have given
464+ application installed. Otherwise only new installations will trigger bot
465+ creation.
466+ payload (dict): Custom payload to be used as request's data.
467+ It overrides all other parameters provided for the method.
468+ headers (dict): Custom headers to be used with session headers.
469+ They will be merged with session-level values that are set,
470+ however, these method-level parameters will not be persisted across requests.
471+ Returns:
472+ httpx.Response: The Response object from `httpx` library,
473+ which contains a server's response to an HTTP request.
474+ '''
475+ if payload is None :
476+ payload = prepare_payload (locals ())
477+ return self .session .post (f'{ self .api_url } /create_bot_template' ,
478+ json = payload ,
479+ headers = headers )
480+
439481 def delete_bot (self ,
440482 id : str = None ,
441483 payload : dict = None ,
@@ -460,6 +502,39 @@ def delete_bot(self,
460502 json = payload ,
461503 headers = headers )
462504
505+ def delete_bot_template (self ,
506+ id : str = None ,
507+ owner_client_id : str = None ,
508+ affect_existing_installations : bool = None ,
509+ payload : dict = None ,
510+ headers : dict = None ) -> httpx .Response :
511+ ''' Deletes a bot template specified by `id`. The bots associated with the template will
512+ be deleted only if `affect_existing_installations` is set to `true`.
513+
514+ Args:
515+ id (str): Bot Template ID.
516+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
517+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
518+ will be ignored, and provided `owner_client_id` will be used instead.
519+ affect_existing_installations (bool): based on this template will be created on all licenses that have given
520+ application installed. Otherwise only new installations will trigger bot
521+ creation.
522+ payload (dict): Custom payload to be used as request's data.
523+ It overrides all other parameters provided for the method.
524+ headers (dict): Custom headers to be used with session headers.
525+ They will be merged with session-level values that are set,
526+ however, these method-level parameters will not be persisted across requests.
527+
528+ Returns:
529+ httpx.Response: The Response object from `httpx` library,
530+ which contains a server's response to an HTTP request.
531+ '''
532+ if payload is None :
533+ payload = prepare_payload (locals ())
534+ return self .session .post (f'{ self .api_url } /delete_bot_template' ,
535+ json = payload ,
536+ headers = headers )
537+
463538 def update_bot (self ,
464539 id : str = None ,
465540 name : str = None ,
@@ -498,6 +573,46 @@ def update_bot(self,
498573 json = payload ,
499574 headers = headers )
500575
576+ def update_bot_template (self ,
577+ id : str = None ,
578+ name : str = None ,
579+ avatar : str = None ,
580+ max_chats_count : int = None ,
581+ default_group_priority : str = None ,
582+ owner_client_id : str = None ,
583+ affect_existing_installations : bool = None ,
584+ payload : dict = None ,
585+ headers : dict = None ) -> httpx .Response :
586+ ''' Updates an existing Bot Template.
587+
588+ Args:
589+ id (str): Bot Template ID.
590+ name (str): Display name.
591+ avatar (str): Avatar URL.
592+ max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
593+ default_group_priority (str): The default routing priority for a group without defined priority.
594+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
595+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
596+ will be ignored, and provided `owner_client_id` will be used instead.
597+ affect_existing_installations (bool): based on this template will be created on all licenses that have given
598+ application installed. Otherwise only new installations will trigger bot
599+ creation.
600+ payload (dict): Custom payload to be used as request's data.
601+ It overrides all other parameters provided for the method.
602+ headers (dict): Custom headers to be used with session headers.
603+ They will be merged with session-level values that are set,
604+ however, these method-level parameters will not be persisted across requests.
605+
606+ Returns:
607+ httpx.Response: The Response object from `httpx` library,
608+ which contains a server's response to an HTTP request.
609+ '''
610+ if payload is None :
611+ payload = prepare_payload (locals ())
612+ return self .session .post (f'{ self .api_url } /update_bot_template' ,
613+ json = payload ,
614+ headers = headers )
615+
501616 def list_bots (self ,
502617 all : bool = None ,
503618 fields : list = None ,
@@ -524,6 +639,32 @@ def list_bots(self,
524639 json = payload ,
525640 headers = headers )
526641
642+ def list_bot_templates (self ,
643+ owner_client_id : str = None ,
644+ payload : dict = None ,
645+ headers : dict = None ) -> httpx .Response :
646+ ''' Returns the list of Bot Templates created for the Client ID (application).
647+
648+ Args:
649+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
650+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
651+ will be ignored, and provided `owner_client_id` will be used instead.
652+ payload (dict): Custom payload to be used as request's data.
653+ It overrides all other parameters provided for the method.
654+ headers (dict): Custom headers to be used with session headers.
655+ They will be merged with session-level values that are set,
656+ however, these method-level parameters will not be persisted across requests.
657+
658+ Returns:
659+ httpx.Response: The Response object from `httpx` library,
660+ which contains a server's response to an HTTP request.
661+ '''
662+ if payload is None :
663+ payload = prepare_payload (locals ())
664+ return self .session .post (f'{ self .api_url } /list_bot_templates' ,
665+ json = payload ,
666+ headers = headers )
667+
527668 def get_bot (self ,
528669 id : str = None ,
529670 fields : list = None ,
@@ -550,6 +691,96 @@ def get_bot(self,
550691 json = payload ,
551692 headers = headers )
552693
694+ def issue_bot_token (self ,
695+ bot_id : str = None ,
696+ bot_secret : str = None ,
697+ organization_id : str = None ,
698+ client_id : str = None ,
699+ payload : dict = None ,
700+ headers : dict = None ) -> httpx .Response :
701+ ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked.
702+
703+ Args:
704+ bot_id (str): Bot's ID.
705+ bot_secret (str): Bot's secret.
706+ organization_id (str): Organization's ID.
707+ client_id (str): Client's ID.
708+ payload (dict): Custom payload to be used as request's data.
709+ It overrides all other parameters provided for the method.
710+ headers (dict): Custom headers to be used with session headers.
711+ They will be merged with session-level values that are set,
712+ however, these method-level parameters will not be persisted across requests.
713+
714+ Returns:
715+ httpx.Response: The Response object from `httpx` library,
716+ which contains a server's response to an HTTP request.
717+ '''
718+ if payload is None :
719+ payload = prepare_payload (locals ())
720+ return self .session .post (f'{ self .api_url } /issue_bot_token' ,
721+ json = payload ,
722+ headers = headers )
723+
724+ def reset_bot_secret (self ,
725+ id : str = None ,
726+ owner_client_id : str = None ,
727+ payload : dict = None ,
728+ headers : dict = None ) -> httpx .Response :
729+ ''' Resets secret for given bot.
730+
731+ Args:
732+ id (str): Bot's ID.
733+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
734+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
735+ will be ignored, and provided `owner_client_id` will be used instead.
736+ payload (dict): Custom payload to be used as request's data.
737+ It overrides all other parameters provided for the method.
738+ headers (dict): Custom headers to be used with session headers.
739+ They will be merged with session-level values that are set,
740+ however, these method-level parameters will not be persisted across requests.
741+
742+ Returns:
743+ httpx.Response: The Response object from `httpx` library,
744+ which contains a server's response to an HTTP request.
745+ '''
746+ if payload is None :
747+ payload = prepare_payload (locals ())
748+ return self .session .post (f'{ self .api_url } /reset_bot_secret' ,
749+ json = payload ,
750+ headers = headers )
751+
752+ def reset_bot_template_secret (self ,
753+ id : str = None ,
754+ owner_client_id : str = None ,
755+ affect_existing_installations : bool = None ,
756+ payload : dict = None ,
757+ headers : dict = None ) -> httpx .Response :
758+ ''' Resets secret for given bot template.
759+
760+ Args:
761+ id (str): Bot Template ID.
762+ owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
763+ authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
764+ will be ignored, and provided `owner_client_id` will be used instead.
765+ affect_existing_installations (bool): based on this template will be created on all licenses that have given
766+ application installed. Otherwise only new installations will trigger bot
767+ creation.
768+ payload (dict): Custom payload to be used as request's data.
769+ It overrides all other parameters provided for the method.
770+ headers (dict): Custom headers to be used with session headers.
771+ They will be merged with session-level values that are set,
772+ however, these method-level parameters will not be persisted across requests.
773+
774+ Returns:
775+ httpx.Response: The Response object from `httpx` library,
776+ which contains a server's response to an HTTP request.
777+ '''
778+ if payload is None :
779+ payload = prepare_payload (locals ())
780+ return self .session .post (f'{ self .api_url } /reset_bot_template_secret' ,
781+ json = payload ,
782+ headers = headers )
783+
553784# Groups
554785
555786 def create_group (self ,
0 commit comments