@extends('layouts.app') @section('title', 'Social Media – Setting') @section('content')

← Setting

Social Media

Configure notifications for when users request human assistance (handoff) via WhatsApp or Instagram. Use the global AI toggle below to enable or disable automated replies on both channels at once (each channel also has its own switch).

@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif @php // Show the real DB column when the row exists so an empty/failed save is not masked by DEFAULT_HANDOFF_PHONE. $handoffPhoneValue = old('handoff_notification_phone'); if ($handoffPhoneValue === null) { $handoffPhoneValue = $setting->exists ? trim((string) ($setting->handoff_notification_phone ?? '')) : $setting->getHandoffNotificationPhone(); } $handoffPhone2Value = old('handoff_notification_phone_2'); if ($handoffPhone2Value === null) { $handoffPhone2Value = $setting->exists ? trim((string) ($setting->handoff_notification_phone_2 ?? '')) : ''; } $handoffPhone3Value = old('handoff_notification_phone_3'); if ($handoffPhone3Value === null) { $handoffPhone3Value = $setting->exists ? trim((string) ($setting->handoff_notification_phone_3 ?? '')) : ''; } $handoffPhone4Value = old('handoff_notification_phone_4'); if ($handoffPhone4Value === null) { $handoffPhone4Value = $setting->exists ? trim((string) ($setting->handoff_notification_phone_4 ?? '')) : ''; } @endphp

Handoff notifications

When a user requests to speak with a human, an SMS is sent to the number below to notify staff.

@csrf

Global AI bot

Master switch for automated AI replies on both WhatsApp and Instagram. When off, neither channel sends AI replies (incoming messages may still be logged). Each channel has an additional “Enable bot” control under Social Networks.
E.164 format (e.g. +17866084763). Staff will receive an SMS when a customer requests human assistance.
Leave empty to disable. If filled (E.164), receives the same handoff SMS as the primary number.
Leave empty to disable. If filled (E.164), receives the same handoff SMS as the primary number.
Leave empty to disable. If filled (E.164), receives the same handoff SMS as the primary number.
Minutes of staff inactivity before AI resumes. If no one from your team responds to the customer within this time, the AI automatically takes over again. 0 = resume immediately (for testing). Default: 15.
Do not send another handoff SMS for the same conversation until this many minutes have passed since the last one. 0 = always send (for testing). Default: 60.
WhatsApp / Instagram: append the extra line only when similar_text similarity between this reply and the previous assistant message is ≥ this %. Higher values = stricter (append only when replies are very alike). Lower values (e.g. 5–15) match almost every turn — use 25–40 for typical tuning. If the reply already includes your store WhatsApp and email, only the bot name + AI line is added (contact is not repeated).

Configure separate active hours and agent handoff rules for WhatsApp and Instagram. This is not your store’s opening hours. When the bot is off for a channel, it sends no message on that channel (no AI, no products, no handoff).

@foreach ($channels as $i => $channel) @php $ch = $channelSchedules[$channel] ?? []; $botSchedule = $ch['botSchedule'] ?? []; $agentHandoff = $ch['agentHandoff'] ?? []; $tzValue = old('channels.'.$channel.'.schedule_timezone', $ch['timezone'] ?? config('app.deals_display_timezone', 'America/New_York')); $agentMsgValue = old('channels.'.$channel.'.agent_unavailable_message', $ch['agentUnavailableMessage'] ?? ''); @endphp @endforeach
@push('styles') @endpush @push('scripts') @endpush @endsection