import json import os import boto3 sqs_client = boto3.client('sqs') pwd_path = os.path.dirname(os.path.realpath('__file__')) # TODO: please store one of each type of template data as needed in the future template_name = 'analytics_digest' data_filename = 'example_messages/'+template_name+'/getstream_message.json' data_filename_path = os.path.join(pwd_path, data_filename) file = open(data_filename_path) data = json.load(file) # GetStream messages are a bit different than orchard's so we just get what we need to test and hydrate template_data = data[0]["new"][0] template_data.update({ "default_brand": "awal", "label_name": "37 Records", }) message = { "type": 'Notification', "subject": "Weekly Analytics Digest Weekly", "to": ["QAORCHEmailContact@theorchard.com"], 'user_ids': ['alw:23702'], 'feed_id': 'vendor_23702', 'feed_name': 'label_analytics_digest', "template": 'analytics_digest', "lang": "en", "sender": '"Sony Music Notifications" ', "payload": template_data, } SQS_QUEUE_URL = os.environ.get('SQS_QUEUE_URL') response = sqs_client.send_message( QueueUrl=SQS_QUEUE_URL, MessageBody=json.dumps(message), DelaySeconds=0 ) print ("MessageId", response['MessageId'], "with RequestId:", response['ResponseMetadata']['RequestId']) print ("Sent to SQS Queue:", SQS_QUEUE_URL)