def create_event(message_type=None, routing_key='everybody', **kwargs):

    keyword_args = {'entity_id': str,
                    'state_message': str,
                    'entity_is_host': bool,
                    'entity_display_name': str,
                    'ack_message': str,
                    'ack_author': str
                    }

    data = {}

    if not message_type:
        raise SaltInvocationError('Required argument "message_type" is missing.')

    if message_type.upper() not in ['INFO', 'WARNING', 'ACKNOWLEDGEMENT', 'CRITICAL', 'RECOVERY']:
        raise SaltInvocationError('"message_type" must be INFO, WARNING, ACKNOWLEDGEMENT, CRITICAL, or RECOVERY.')

    data['message_type'] = message_type

    data['monitoring_tool'] = 'SaltStack'

    if 'timestamp' in kwargs:
        timestamp_fmt = kwargs.get('timestamp_fmt', '%Y-%m-%dT%H:%M:%S')

        try:
            timestamp = datetime.datetime.strptime(kwargs['timestamp'], timestamp_fmt)
            data['timestamp'] = int(time.mktime(timestamp.timetuple()))
        except (TypeError, ValueError):
            raise SaltInvocationError('Date string could not be parsed: {0}, {1}'.format(
                kwargs['timestamp'], timestamp_fmt)
            )

    if 'state_start_time' in kwargs:
        state_start_time_fmt = kwargs.get('state_start_time_fmt', '%Y-%m-%dT%H:%M:%S')

        try:
            state_start_time = datetime.datetime.strptime(kwargs['state_start_time'], state_start_time_fmt)
            data['state_start_time'] = int(time.mktime(state_start_time.timetuple()))
        except (TypeError, ValueError):
            raise SaltInvocationError('Date string could not be parsed: {0}, {1}'.format(
                kwargs['state_start_time'], state_start_time_fmt)
            )

    for kwarg in keyword_args:
        if kwarg in kwargs:
            if isinstance(kwargs[kwarg], keyword_args[kwarg]):
                data[kwarg] = kwargs[kwarg]
            else:
                # Should this faile on the wrong type.
                log.error('Wrong type, skipping {0}'.format(kwarg))

    status, result = _query(action='alert',
                            routing_key=routing_key,
                            data=json.dumps(data),
                            method='POST'
                            )
    return result
Create an event in VictorOps. Designed for use in states.
dataset/ETHPy150Open saltstack/salt/salt/modules/victorops.py/create_event