mypy-boto3-chime-sdk-messaging

1.42.3 · active · verified Sat Apr 11

mypy-boto3-chime-sdk-messaging provides type annotations for the boto3 ChimeSDKMessaging service, enhancing development with static type checking in environments like VSCode, PyCharm, and mypy. It is generated by `mypy-boto3-builder` (currently version 8.12.0) and closely tracks the `boto3` release cycle, with frequent updates to ensure compatibility and comprehensive type hints. The current version is 1.42.3.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `ChimeSDKMessagingClient` with type hints for a `create_channel_message` operation. The `TYPE_CHECKING` guard ensures that `mypy-boto3-chime-sdk-messaging` is only a development dependency.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_chime_sdk_messaging.client import ChimeSDKMessagingClient
    from mypy_boto3_chime_sdk_messaging.type_defs import CreateChannelMessageResponseTypeDef


def send_chime_message(channel_arn: str, content: str, app_instance_user_arn: str) -> 'CreateChannelMessageResponseTypeDef':
    client: ChimeSDKMessagingClient = boto3.client("chime-sdk-messaging", region_name="us-east-1")
    response = client.create_channel_message(
        ChannelArn=channel_arn,
        Content=content,
        MessageType="STANDARD",
        AppInstanceUserArn=app_instance_user_arn
    )
    print(f"Message ID: {response.get('ChannelMessage', {}).get('MessageId')}")
    return response

# Example usage (replace with actual values for a runnable example)
# if __name__ == "__main__":
#     CHANNEL_ARN = os.environ.get('CHIME_CHANNEL_ARN', 'arn:aws:chime:us-east-1:123456789012:app-instance/xxxx/channel/yyyy')
#     CONTENT = "Hello from mypy-boto3!"
#     APP_INSTANCE_USER_ARN = os.environ.get('CHIME_APP_INSTANCE_USER_ARN', 'arn:aws:chime:us-east-1:123456789012:app-instance-user/zzzz')
#
#     if CHANNEL_ARN and APP_INSTANCE_USER_ARN:
#         message_response = send_chime_message(CHANNEL_ARN, CONTENT, APP_INSTANCE_USER_ARN)
#         print(message_response)
#     else:
#         print("Please set CHIME_CHANNEL_ARN and CHIME_APP_INSTANCE_USER_ARN environment variables.")

view raw JSON →