:doc:`Chatbot <../../chatbot>` / Client / create_custom_action

********************
create_custom_action
********************



.. py:method:: Chatbot.Client.create_custom_action(**kwargs)

  

  Creates a custom action that can be invoked as an alias or as a button on a notification.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/chatbot-2017-10-11/CreateCustomAction>`_  


  **Request Syntax**
  ::

    response = client.create_custom_action(
        Definition={
            'CommandText': 'string'
        },
        AliasName='string',
        Attachments=[
            {
                'NotificationType': 'string',
                'ButtonText': 'string',
                'Criteria': [
                    {
                        'Operator': 'HAS_VALUE'|'EQUALS',
                        'VariableName': 'string',
                        'Value': 'string'
                    },
                ],
                'Variables': {
                    'string': 'string'
                }
            },
        ],
        Tags=[
            {
                'TagKey': 'string',
                'TagValue': 'string'
            },
        ],
        ClientToken='string',
        ActionName='string'
    )
    
  :type Definition: dict
  :param Definition: **[REQUIRED]** 

    The definition of the command to run when invoked as an alias or as an action button.

    

  
    - **CommandText** *(string) --* **[REQUIRED]** 

      The command string to run which may include variables by prefixing with a dollar sign ($).

      

    
  
  :type AliasName: string
  :param AliasName: 

    The name used to invoke this action in a chat channel. For example, ``@aws run my-alias``.

    

  
  :type Attachments: list
  :param Attachments: 

    Defines when this custom action button should be attached to a notification.

    

  
    - *(dict) --* 

      Defines when a custom action button should be attached to a notification.

      

    
      - **NotificationType** *(string) --* 

        The type of notification that the custom action should be attached to.

        

      
      - **ButtonText** *(string) --* 

        The text of the button that appears on the notification.

        

      
      - **Criteria** *(list) --* 

        The criteria for when a button should be shown based on values in the notification.

        

      
        - *(dict) --* 

          A criteria for when a button should be shown based on values in the notification

          

        
          - **Operator** *(string) --* **[REQUIRED]** 

            The operation to perform on the named variable.

            

          
          - **VariableName** *(string) --* **[REQUIRED]** 

            The name of the variable to operate on.

            

          
          - **Value** *(string) --* 

            A value that is compared with the actual value of the variable based on the behavior of the operator.

            

          
        
    
      - **Variables** *(dict) --* 

        The variables to extract from the notification.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
    

  :type Tags: list
  :param Tags: 

    A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.

    

  
    - *(dict) --* 

      A key-value pair. A tag consists of a tag key and a tag value. Tag keys and tag values are both required, but tag values can be empty (null) strings.

       

      .. warning::

         

        Do not include confidential or sensitive information in this field.

         

       

      For more information, see `User-Defined Tag Restrictions <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html>`__ in the *AWS Billing and Cost Management User Guide*.

      

    
      - **TagKey** *(string) --* **[REQUIRED]** 

        The key of the tag.

        

      
      - **TagValue** *(string) --* **[REQUIRED]** 

        The value of the tag.

        

      
    

  :type ClientToken: string
  :param ClientToken: 

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, subsequent retries with the same client token returns the result from the original successful request.

     

    If you do not specify a client token, one is automatically generated by the SDK.

    This field is autopopulated if not provided.

  
  :type ActionName: string
  :param ActionName: **[REQUIRED]** 

    The name of the custom action. This name is included in the Amazon Resource Name (ARN).

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'CustomActionArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **CustomActionArn** *(string) --* 

        The fully defined ARN of the custom action.

        
  
  **Exceptions**
  
  *   :py:class:`Chatbot.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Chatbot.Client.exceptions.LimitExceededException`

  
  *   :py:class:`Chatbot.Client.exceptions.ConflictException`

  
  *   :py:class:`Chatbot.Client.exceptions.InternalServiceError`

  
  *   :py:class:`Chatbot.Client.exceptions.UnauthorizedException`

  