def publish_message()

in messages/message_manager.py [0:0]


    def publish_message(self, **kwargs):
        expiration_date = kwargs.pop('ExpirationDateTimeInUtc',
                                     '2299-12-31 00:00:00')
        body = kwargs.pop('Body', '')
        uuid_key = kwargs.pop('UUID', str(uuid.uuid4()))
        no_more_occ = kwargs.pop('NoMoreOccurrences', False)
        person_name = kwargs.pop('PersonName', '')
        bot_names = kwargs.pop('BotNames', None)
        required_bots = kwargs.pop('RequiredBots', None)
        ice_breaker = kwargs.pop('IceBreaker', None)
        voice = kwargs.pop('VoiceId', 'Joanna')
        if not person_name:
            raise ValueError("No person provided")
        if not uuid_key:
            raise ValueError("No uuid provided")
        if not body:
            raise ValueError('No message body provided')
        if kwargs:
            raise TypeError('Unexpected **kwargs: %r' % kwargs)

        pm = PersonManager()
        p = pm.get_person(person_name)
        windows = p.time_windows.to_json()
        msg_attr = {
            'PersonName': {
                'StringValue': person_name,
                'DataType': 'String'
            },
            'Locations': {
                'StringValue': windows,
                'DataType': 'String'
            },
            'ExpirationDateTimeInUtc': {
                'StringValue': expiration_date,
                'DataType': 'String'
            },
            'UUID': {
                'StringValue': uuid_key,
                'DataType': 'String'
            },
            'NoMoreOccurrences': {
                'StringValue': str(no_more_occ),
                'DataType': 'String'
            },
            'Voice': {
                'StringValue': voice,
                'DataType': 'String'
            }}

        if required_bots:
            msg_attr['RequiredBots'] = {
                'StringValue': required_bots,
                'DataType': 'String'
            }

        if bot_names:
            msg_attr['BotNames'] = {
                'StringValue': bot_names,
                'DataType': 'String'
            }

        if ice_breaker:
            msg_attr['IceBreaker'] = {
                'StringValue': ice_breaker,
                'DataType': 'String'
            }
        if bot_names:
            self.log.debug('Publishing to bot queue')
            self.bot_queue.send_message(MessageBody=body,
                                        MessageAttributes=msg_attr)
        else:
            self.log.debug('Publishing to message queue')
            self.queue.send_message(MessageBody=body,
                                    MessageAttributes=msg_attr)
        self.log.debug(body)