import boto3
sns = boto3.client('sns')
response = sns.create_topic(Name='my_fifo_topic.fifo', Attributes={'FifoTopic': 'true'})
sns.subscribe(TopicArn=response['TopicArn'], Protocol='sms', Endpoint='+1234567890')
{ "Name": "my_contact_flow", "Type": "CONTACT_FLOW", "Description": "My contact flow", "Content": { "Version": "1.0", "StartAction": { "Type": "SEND_MESSAGE", "Parameters": { "MessageBody": "Hello, how may I assist you?", "MessageType": "SMS", "Destination": { "PhoneNumber": "+1234567890" }, "Queue": { "Name": "my_fifo_queue.fifo", "Type": "FIFO_SQS" }, "Attributes": { "aws.sns.SMS.SMSType": "Transactional", "aws.sns.SMS.SenderID": "MyCompany" } } } } }
这些步骤将确保您能够发送和接收Amazon Connect 2-way SMS消息,同时记录这些消息以便进一步处理。