def post_sqs()

in lambda/api/app.py [0:0]


def post_sqs():
    try:
        body = app.current_event.json_body

        if 'id' not in body:
            body['id'] = str(uuid.uuid4())

        sqs_queue.send_message(MessageBody=json.dumps(body))

        return {"result": body['id']}
    except Exception as e:
        logger.error(e)
        metrics.add_metric(name='API_Error_SQS',
                           unit=MetricUnit.Count, value=1)
        raise ServiceError(502, "Something went wrong! Please try again.")