การส่งข้อความ

Python เบื้องต้นสำหรับ AWS Boto

Maksim Pecherskiy

Data engineer

การเผยแพร่ไปยัง Topic

response = sns.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'Body text of SMS or e-mail',
  Subject = 'Subject Line for Email'
)

SNS publishing to topic

Python เบื้องต้นสำหรับ AWS Boto

การเผยแพร่ไปยัง Topic

SNS publishing to topic SNS publishing to topic

Python เบื้องต้นสำหรับ AWS Boto

การเผยแพร่ไปยัง Topic

SNS publishing to topic SNS publishing to topic

Python เบื้องต้นสำหรับ AWS Boto

การส่งข้อความแบบกำหนดเอง

num_of_reports = 137

response = client.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'There are {} reports outstanding'.format(num_of_reports),
  Subject = 'Subject Line for Email'
)
Python เบื้องต้นสำหรับ AWS Boto

การส่ง SMS เดี่ยว

response = sns.publish(
  PhoneNumber = '+13121233211',
  Message = 'Body text of SMS or e-mail'
)

การส่ง SMS เดี่ยว

Python เบื้องต้นสำหรับ AWS Boto

ไม่เหมาะสำหรับการใช้งานระยะยาว

  • SMS แบบครั้งเดียว = ทำงานได้สำเร็จ
  • Topic และ subscriber = บำรุงรักษาง่าย
Python เบื้องต้นสำหรับ AWS Boto

เผยแพร่ไปยัง Topic เทียบกับ SMS เดี่ยว

เผยแพร่ไปยัง Topic

  • ต้องมี Topic ก่อน
  • Topic ต้องมี subscription
  • เหมาะสำหรับผู้รับหลายคน
  • จัดการรายชื่อได้ง่ายกว่า

เผยแพร่ไปยัง Topic

ส่ง SMS เดี่ยว

  • ไม่ต้องมี Topic
  • ไม่ต้องมี subscription
  • ส่งข้อความไปยังหมายเลขโทรศัพท์โดยตรง
  • ไม่รองรับตัวเลือกอีเมล

ส่ง SMS เดี่ยว

Python เบื้องต้นสำหรับ AWS Boto

ทบทวน

เผยแพร่ไปยัง Topic

response = sns.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'Body text of SMS or e-mail',
  Subject = 'Subject Line for Email'
)

ส่ง SMS เดี่ยว

response = sns.publish(
  PhoneNumber = '+13121233211',
  Message = 'Body text of SMS or e-mail'
)
Python เบื้องต้นสำหรับ AWS Boto

มาฝึกกันเถอะ!

Python เบื้องต้นสำหรับ AWS Boto

Preparing Video For Download...