def cli(obj, resource, event, environment, severity, correlate, service, group, value, text, tags, attributes, origin, type, timeout, raw_data, customer):
    """Send an alert."""
    client = obj['client']

    def send_alert(resource, event, **kwargs):
        try:
            id, alert, message = client.send_alert(
                resource=resource,
                event=event,
                environment=kwargs.get('environment'),
                severity=kwargs.get('severity'),
                correlate=kwargs.get('correlate', None) or list(),
                service=kwargs.get('service', None) or list(),
                group=kwargs.get('group'),
                value=kwargs.get('value'),
                text=kwargs.get('text'),
                tags=kwargs.get('tags', None) or list(),
                attributes=kwargs.get('attributes', None) or dict(),
                origin=kwargs.get('origin'),
                type=kwargs.get('type'),
                timeout=kwargs.get('timeout'),
                raw_data=kwargs.get('raw_data'),
                customer=kwargs.get('customer')
            )
        except Exception as e:
            click.echo('ERROR: {}'.format(e))
            sys.exit(1)

        if alert:
            if alert.repeat:
                message = '{} duplicates'.format(alert.duplicate_count)
            else:
                message = '{} -> {}'.format(alert.previous_severity, alert.severity)
        click.echo('{} ({})'.format(id, message))

    # read entire alert object from terminal stdin
    if not sys.stdin.isatty() and (os.environ.get('TERM', None) or os.environ.get('PS1', None)):
        with click.get_text_stream('stdin') as stdin:
            for line in stdin.readlines():
                try:
                    payload = json.loads(line)
                except Exception as e:
                    click.echo('ERROR: JSON parse failure - {}'.format(e))
                    sys.exit(1)
                send_alert(**payload)
            sys.exit(0)

    # read raw data from file or stdin
    if raw_data and raw_data.startswith('@') or raw_data == '-':
        raw_data_file = raw_data.lstrip('@')
        with click.open_file(raw_data_file, 'r') as f:
            raw_data = f.read()

    send_alert(
        resource=resource,
        event=event,
        environment=environment,
        severity=severity,
        correlate=correlate,
        service=service,
        group=group,
        value=value,
        text=text,
        tags=tags,
        attributes=dict(a.split('=', maxsplit=1) if '=' in a else (a, None) for a in attributes),
        origin=origin,
        type=type,
        timeout=timeout,
        raw_data=raw_data,
        customer=customer
    )