I have written a code in which I am using aws sns to send email notifications to user via boto3 client (sns) library.
My issue is that I was unable to convert the Message to HTML. The recipients should receive a HTLML notification, instead of plain text. Is there away to modify my code here. I appreciate any solution Here is my code:
import boto3
import json
from json2table import convert
SNS_TOPIC_ARN_Critical = 'SNSTOPIC'
def lambda_handler(event, context):
build_direction = "LEFT_TO_RIGHT"
table_attributes = {"style" : "width:100%", "display": "table", "border-collapse": "collapse","border-color": "gray", "border": "1px solid black"}
response = boto3.client('sns').publish(
TopicArn = SNS_TOPIC,
Message = convert(json.dumps(event, indent=2),build_direction=build_direction, table_attributes=table_attributes),
Subject = 'Test Alert',
MessageStructure = 'html'
)