def _generate_payload(author_icon, title, report):
    '''
    Prepare the payload for Slack
    :param author_icon: The url for the thumbnail to be displayed
    :param title: The title of the message
    :param report: A dictionary with the report of the Salt function
    :return: The payload ready for Slack
    '''

    title = _sprinkle(title)

    unchanged = {
        'color': 'good',
        'title': 'Unchanged: {unchanged}'.format(unchanged=report['unchanged'].get('counter', None))
    }

    changed = {
        'color': 'warning',
        'title': 'Changed: {changed}'.format(changed=report['changed'].get('counter', None))
    }

    if report['changed'].get('tasks'):
        changed['fields'] = list(
            map(_format_task, report['changed'].get('tasks')))

    failed = {
        'color': 'danger',
        'title': 'Failed: {failed}'.format(failed=report['failed'].get('counter', None))
    }

    if report['failed'].get('tasks'):
        failed['fields'] = list(
            map(_format_task, report['failed'].get('tasks')))

    text = 'Function: {function}\n'.format(function=report.get('function'))
    if report.get('arguments'):
        text += 'Function Args: {arguments}\n'.format(
            arguments=str(list(map(str, report.get('arguments')))))

    text += 'JID: {jid}\n'.format(jid=report.get('jid'))
    text += 'Total: {total}\n'.format(total=report.get('total'))
    text += 'Duration: {duration:.2f} secs'.format(
        duration=float(report.get('duration')))

    payload = {
        'attachments': [
            {
                'fallback': title,
                'color': "#272727",
                'author_name': _sprinkle('{id}'),
                'author_link': _sprinkle('{localhost}'),
                'author_icon': author_icon,
                'title': 'Success: {success}'.format(success=str(report.get('success'))),
                'text': text
            },
            unchanged,
            changed,
            failed
        ]
    }

    return payload