@php $isConnected = $integration && $integration->isConnected(); @endphp @php $slackIcon = ''; $cmd = $integration->slash_command ?? '/wa'; @endphp @if (!$isConnected) {{-- ═══════════════ NOT CONNECTED ═══════════════ --}}
{{ __('Integrations') }}/{{ __('Slack') }}

{{ __('Connect') }} {{ __('Slack') }}

{{ __('Type a slash command in Slack to send a WhatsApp message to one of your contacts — no switching apps.') }}

@if (session('error') || $errors->any())
{{ session('error') ?: $errors->first() }}
@endif @if (!$enabled)
{{ __("Slack isn't enabled yet") }}

{{ __('An administrator must enable the Slack integration before your workspace can connect.') }}

@else
{{ __('Step 3') }}

{{ __('App credentials') }}

@csrf
@if ($senders->isNotEmpty())
{{ __('The connected number every command sends through. You run more than one — pick the right one.') }}
@endif
{{ __('Slash command Request URL · paste into Slack') }}
{{ $commandUrl }}
@endif
@else {{-- ═══════════════ CONNECTED — redesigned ═══════════════ --}} @php $total = $logs->count(); $okCount = $logs->filter(fn ($l) => $l->status === 'ok')->count(); $failCount = $total - $okCount; $lastLog = $logs->first(); @endphp @if (session('status'))
{{ session('status') }}
@endif
{{-- Breadcrumb --}}
{{ __('Integrations') }}/{{ __('Slack') }}
{{-- HERO BANNER --}}
{!! $slackIcon !!}

{{ $integration->team_name ?: __('Slack workspace') }}

{{ __('Connected') }}
{{ __('Send WhatsApp messages from Slack with') }} {{ $cmd }}
{{-- KPI ROW --}}
{{ __('Commands') }}
{{ number_format($total) }}
{{ __('recent total') }}
{{ __('Delivered') }}
{{ number_format($okCount) }}
{{ __('sent to WhatsApp') }}
{{ __('Failed') }}
{{ number_format($failCount) }}
{{ __('no contact / error') }}
{{ __('Last active') }}
{{ $lastLog ? $lastLog->created_at->diffForHumans(null, true) : '—' }}
{{ $lastLog ? __('ago') : __('no commands yet') }}
{{-- ACTIVITY + USAGE --}}
{{-- Activity table --}}

{{ __('Recent activity') }}

{{ $total }}
@forelse ($logs as $log) @empty @endforelse
{{ __('Command') }}{{ __('When') }}{{ __('Status') }}
{{ $log->detail ?: $log->event }} {{ $log->created_at?->diffForHumans() }} {{ $log->status }}
{{ __('No commands run yet. Type /wa in Slack to get started.') }}
{{-- Usage rail --}}
{{-- HOW IT WORKS — end-to-end explainer + usage cheatsheet --}}
{{ __('Reference') }}

{{ __('How it works') }}

{{ $cmd }}
{{-- 4-step flow --}}
@foreach ([ ['1', __('Type in Slack'), __('A teammate types the slash command in any channel or DM — no need to open :brand.', ['brand' => brand_name()])], ['2', __('We verify it'), __(':brand checks the request signature with your Signing Secret, so only your Slack can send.', ['brand' => brand_name()])], ['3', __('Match the contact'), __('The name is matched to a WhatsApp contact — or a phone number is used as-is.')], ['4', __('Send + confirm'), __('The message goes out from your connected WhatsApp device and Slack shows the result.')], ] as [$n, $t, $d])
{{ $n }}
{{ $t }}

{{ $d }}

@endforeach
{{-- Commands + prerequisites --}}
{{ __('Commands to use') }}
{{ $cmd }} send Rahul: your order is ready
{{ $cmd }} send 919812345678: on my way
{{ $cmd }} help

{{ __('Format') }}: {{ $cmd }} send <name or number>: <message>

{{ __('Before it can send') }}
  • {{ __('The Slack slash command points its Request URL at the address below.') }}
  • {{ __('The Slack app has the scopes') }} commands + chat:write.
  • {{ __('A WhatsApp device is connected in :brand to actually deliver the message.', ['brand' => brand_name()]) }}
{{ __('Slash command Request URL') }}
{{ $commandUrl }}
{{-- SENDING DEVICE — which connected number /wa sends through --}} @if ($senders->isNotEmpty())

{{ __('Sending device') }}

{{ __('You run more than one WhatsApp number. Pick which connected number every command sends through — otherwise it uses the workspace default.') }}

@csrf
@endif {{-- SETTINGS --}}

{{ __('Connection') }}

{{ __('Workspace') }}
{{ $integration->team_name ?: '—' }}
{{ __('Slash command') }}
{{ $cmd }}
{{ __('Connected') }}
{{ optional($integration->connected_at)->diffForHumans() ?? '—' }}
{{ __('Request URL') }}
{{ $commandUrl }}

{{ __('Disconnecting removes the stored token + secret.') }}

@csrf
@endif