3Dolphins
5.1 ID
5.1 ID
  • Get Started
  • Pre-Requisite
  • FAQ User
    • User Management
      • Apa yang Dilakukan Jika User Masih Memiliki Active Session?
      • Apa yang Harus Dilakukan Jika User Terkunci?
    • Ticket Management
      • Apa yang Harus Dilakukan Jika Tiket Tidak Masuk ke Tab Inbox?
    • Bot Settings
      • Apa yang Harus Dilakukan Jika Bot Tidak Ada Respon?
      • Apa yang Harus Dilakukan Jika Bot Tidak Merespons Seperti Yang Diharapkan?
    • Data Settings
      • Apa App Server, Web Server, dan Database yang Digunakan Oleh Chatbot 3Dolphins SRM?
      • Saat ChatBot Dijalankan di Linux. Proses Apa yang Running Untuk Menandakan Aplikasi Sedang Berjalan?
      • Jika Proses Mengalami Berhenti (fall) yang Tidak Normal. Apa yang Harus Dilakukan?
      • Bagaimana Cara Memantau 3rd-Party Service?
      • Tentang Performance Monitoring. Bisakah Dipantau dan Apakah Memiliki Dashboard?
      • Apa yang Perlu di-Backup?
      • Bagaimana Cara Backup Solr? Apakah Ada Menu dari Aplikasi Untuk Melakukan Backup?
      • Siklus Backup Apa yang Digunakan? Full atau Incremental?
      • Data Apa Saja yang Disimpan di Server?
      • Prosedur Data Housekeeping dan Technical Guideline. Apakah Ada Menu di Apps?
      • Cara Mengkonversi Field Milliseconds API Menjadi Format Date Apache Solr Menggunakan Microsoft Excel
  • Task Management
    • Task Management
      • Task Feature
      • Create Task
      • Edit Task
      • Detail Task Feature
  • Administration
    • User Privilege
      • User Role and Permission Level
      • Grant and Revoke Module Access
      • Create New Privilege
      • Remove Privilege
    • User Management
      • Group
      • User
      • Blocked
      • Active
      • Upload
      • Dual Control
      • Team Collaboration Chat
    • System Settings
      • Ticket Configuration
        • Number of Ticket History
        • Reply Signature
        • Enable Watermark on Attachment
        • Operator Allow Ticket Redistribute
        • Pop-Up Chat On Idle
        • Severity Required Before Closed
        • Auto Send Feedback
        • Claim Ticket Count
        • Default Sorting Mode
        • Word Sensor on Live Agent Message
        • Auto Greeting
        • Group Ticket Distribution
        • Ask Feedback Message
        • Image URL Link and Font Color for Feedback Link
        • Feedback Appreciate Message
        • Number of Live Chat History
        • Walk in SLA Time (in Second)
        • Closure Types
      • User Configuration
      • Bot Configuration
      • Contact Configuration
      • Deal Configuration
      • Custom Submenu Configuration
    • Data Settings
      • Create New Collection
        • Add Fields in Collection
        • Purge Data Collection
      • Remove Collection
      • Archive Collection
    • Public Holiday
      • Create New Holiday
      • Edit an Existing Public Holiday
      • Delete an Existing Public Holiday
    • Co-Browsing
      • Add Co-Browsing Menu
      • How to Use Co-Browsing
  • Integration
    • Chanel Connector
      • Telegram Bot
        • Create Telegram Bot
        • Create a New Channel Telegram Bot
        • Create New Rule
        • Attach Bot
        • Start Chat
      • Email Inbox
        • Create a New Email Inbox Channel
        • Gmail Settings
        • Create New Rule
        • Reply Email
        • Forward Email
      • Live Chat
        • Create a New Channel of Live Chat
        • How to Connect Client to Live Chat Channel
        • Create New Rule
        • Live Chat Message
        • Live Chat Capabilities
        • Memasukkan Live Chat pada Website / Mobile (Webview) Anda
          • Website
          • Mobile (Webview)
        • Live Chat SDK for React Native
      • Telegram Account
        • Create a New Telegram Account
        • Create a New Channel of Telegram Account
        • Create New Rule
        • Attach Bot
      • Twitter
        • Twitter Developers Page
        • Create an App in Twitter Developer
        • Create a New Channel of Twitter
        • Create New Rule
        • Result of Create New Twitter Channel
        • Best Practice Twitter
          • Customer
          • Agent (Operator) atau Supervisor
        • Twitter Gateway
      • Facebook
        • Facebook Developers
        • Verify Your Bussiness
        • How to Create Facebook App
          • Change Additional Information About the App
          • How to Add Facebook Login Platform to Your Facebook App
          • How to Add Messenger Platform to Your Facebook App
          • Permission And Feature
        • Create New Page on Facebook
        • Create a New Channel of Facebook
        • How to Add Webhook Platform to Your Facebook App
        • Create New Rule
        • Mechanism for using BOT in Facebook Messenger
        • How to Add an Email from My Facebook Account
        • Best Practice Facebook
          • BOT
          • Customer
          • Agent (Operator) dan Supervisor
        • Facebook Gateway
      • WhatsApp Business API
        • How to Set Up Whatsapp Business
        • Create New Whatsapp Channel
        • How to Add New Whatsapp Channel Rule
      • Instagram Business
        • How to Register as a Facebook Developers
        • Go To Developers Facebook
        • Verify Your Bussiness
        • How to Create Facebook App
          • Change Additional Information About the App
        • How to Add Facebook Login Platform to Your Facebook App
        • Change Status Development Mode Into Public
        • How to Create New a Instagram Business Channel
        • How to Add “Webhooks” Platform to Your Facebook App
        • How to Add “Instagram” Platform to Your Facebook App
        • How to Add Permissions and Feature
        • How to Create a New Instagram Business Channel Rule
        • Result of Create New Instagram Business Channel
        • Best Practice Instagram
        • Instagram Gateway
      • Line Account
        • Create New Line Official Account
        • Create Line Developer
        • Create a New Channel of Line Account
        • Create New Rule
        • Result of Create New Line Account Channel
      • Skype
        • Create a Bot With Microsoft Bot Framework and Microsoft Azure
        • Create a New Channel of Skype
        • Create New Skype Account
        • Create New Rule
        • Result of Create New Skype Channel
      • App Follow
        • Create a New Channel of App Follow
        • Create New Rule
        • How to Create New Ticket on App Follow
      • YouTube
        • Create a New Channel on YouTube
        • Create YouTube API Credentials
        • Create a New Channel of YouTube
        • Create New Rule
        • Result of Create New Channel YouTube
      • Smartcall
        • Create a New Channel of Smartcall
        • Add Telephony Credentials
        • Create New Rule
        • Result of Create New Channel Smartcall
    • Live Chat Designer
      • New Design
        • Style
        • Live Chat Connection
        • On Boarding Form
        • Livechat Label
        • Messaging Setting
      • Member Mode
      • Queue
      • Error Message
      • Voice and Speech
      • Campaign
      • Service Hour
      • Generate Script
      • View Script Widget
      • Edit Widget
      • Remove Widget
    • Third-Party Integration
  • Employee
    • Operator Shift
      • Add New Shift
      • Edit an Existing Shift
      • Assign Operator Shift
      • Delete Shift
    • Shift Mapping
      • Upload Agent's Attendance
      • Edit an Existing Shift
      • Delete Shift
      • Filter Shift
    • Operator Target
      • Add Multiple Target
      • Add Operators Target (Independent Target)
  • Marketing
    • Public Post
      • Create New Public Post
        • Upload File
        • Schedule, Post, and Draft
      • Filter dan Search
    • Notification
      • Create Notification
        • Account & Recipients
        • Message
        • Send or Schedule
      • Filter and Search Notification
      • Edit and Delete Notification
    • Template
      • Request Template
        • Header Template
        • Body Template
        • Footer Template
        • Buttons Template
      • Filter and Search Template
      • Delete Template
    • Audience
      • Create New Audience
      • Edit and Delete Existing Audience
      • Import Audience
      • Create New Audience Group
      • Edit and Delete Existing Audience Group
      • Search Feature
    • Maker Checker
      • Public Post Maker
      • Public Post Checker
      • Notification Maker
      • Notification Checker
  • Sales Activity
    • Lead
      • Create New Lead
      • Detail Lead
        • Contact Info
        • Company Info
        • Transfer Lead Ownership
        • Note
        • Task
      • Filter and Search Lead
      • Lead Automation
        • Automation Component
        • Create Automation
        • Duplicate and Delete Automation
      • Convert Lead to Deal or Archive Lead
      • Unarchive Lead
      • Delete Lead
    • Deal
      • Create New Deal
      • Detail Deal
        • Add Product on Deal
        • Contact Info
        • Company Info
        • Transfer Deal Ownership
        • Note
        • Task
        • Add On-Site Visit
      • Transfer Deal to Another Pipeline
      • Pipeline
        • Add New Pipeline
        • Edit Pipeline
        • Delete Pipeline
      • Filter, Sort, and Search
      • Advanced Setting
      • Closed Deal to Won or Lost Deal
      • Delete Deal
    • Company
      • Create New Company
      • Detail Company
      • Search Company and Configuration Table
      • Delete Company
    • Contact
      • Create New Contact
      • Detail Contact
        • Switch and Unlink Companies
        • Add Deal
        • Set Contact as VIP
        • Block and Unblock Contact
        • Merge Contact
        • Note
        • Task
      • Delete Contact
    • Product
      • Create New Product
      • Detail Product
        • Open Deals
        • Stock and Restock Product
        • Transfer Product Ownership
        • Note
        • Filter and Search Product
      • Configuration Table
      • Delete Product
  • Customer Service
    • Kata Pengantar
    • Customer Support
      • Monitoring Dashboard Agent
      • Monitoring Dashboard Supervisor
      • Search in Dashboard
      • Change Status Agent
      • Reply Ticket
      • Send File or Attachment
        • Send File
        • Send Library
        • Send Form
        • Chat History
        • Send FAQ
        • Video Conference Call
      • Watermark
      • Ticket Activity
        • Add Customer Case
        • Add Task based on Ticket
        • Customer Identify
      • Ticket Priority
      • Ticket Notification
      • Filter Ticket
      • Team Member
      • Escalated Ticket
      • Transferred Ticket
      • Reassign Ticket
      • Takeover Ticket
      • Closed Ticket
      • Share Ticket Link
      • View Chat History
      • Merge and Unmerge Ticket
      • Merge Contact
      • Merge Contact Suggestion
      • Blocked Ticket
      • Reopen Ticket
      • Canned Message
      • How to Find FAQ
      • How to Export Ticket
      • How to Create Outbound Email
      • How to Create Offline Ticket
      • View Assignment Rule
    • Customer Contact
      • Create New Contact
      • Edit Contact
      • Case Timeline
      • Chat History
      • Merge Contact
      • Merge Contact Suggestion
      • Send Email Message
      • Block Contact
      • Remove Contact
    • Ticket Automation
      • Komponen Automation
      • Tag, Severity, dan Process Flow
      • On Idle Trigger Ticket
      • Auto Greeting dengan Respon Berbasis Waktu
      • Bypass Distribusi Tiket untuk Pelanggan dengan Profil Tinggi
    • Rule Management
      • Add New Rule
      • Add Team Member
      • Add Rule Criteria
      • Configuration Rule
        • SLA Settings
        • Assignment
        • Service Hours
      • Clone Rule
      • Remove Rule
      • Filter Rule
      • Reload Rule
    • Form Management
      • Form Records
        • Filter Form Records
        • Download Form Record
      • Form Builder
        • Create New Form Builder
          • Settings
          • Generate Link
        • Edit Form Builder
        • Remove Form Builder
    • Paragraph Classifier
      • Add New Classifier Module
      • Add New Classifier
      • Add Tag to Chat Ticket
      • Edit Classifier
      • Remove Classifier
    • Email Template
      • New Email Template
      • Edit Email Template
      • Remove Email Template
      • Email Signature
      • Auto-Reply
    • Auxiliary Mapping
      • Create a New Agent Status
      • Edit an Existing Agent Status
      • Remove Agent Status
  • Quality Assurance
    • Performance Rating
      • Add Appraisal
      • Transfer Appraisal Report
      • Change Appraisal Report
      • Filter Ticket
    • Feedback Template
      • Create New Feedback Question
        • Agent Rating Survey
        • NPS Survey
      • Activate Feedback Template
      • Edit an Existing Feedback Template
      • Delete Feedback Template
    • Customer Feedback
    • Rating Criteria
      • Add New Template Criteria
      • Add Criteria
      • Active and Inactive Template
      • Duplicate Template Criteria
      • Delete Template Criteria
  • Bot Settings
    • Bot Manager
      • Create New Bot
        • Attach Dialog
        • Attach FAQ
        • Channel Deployment
        • Timeout Message
        • Unrecognized Setting
        • Fallback Message
        • 3Dolphins Think Integration
        • Bot Option Configuration
        • Bot Assistant
        • Bot Contextual
        • Bot Language
      • Bot Profile Settings
      • General Synonym
      • Evaluate Bot
        • Create Validation Script
        • Validate The Script
        • Upload Script Validation
      • Automatic Detection Language
    • Process Flow
      • Component of Workflow
        • Webhook
        • Execute Command
        • HTTP Request
        • MVEL Function
        • Execute Workflow
        • Timer Interval
        • Send Message
        • Send Email
        • Show Growl
        • Connector Setting
      • Integration
      • List of Workflow
      • Edit Workflow
      • Remove Workflow
      • Workflow Log
    • Dialog Flows
      • Create New Dialog
        • Intention and Entity
        • Prompt Response
        • Integration
        • Configuration
        • Build Dialog Model
        • Test the Dialog on Bot Emulator
      • Search and Filter Dialog
      • Switch Dialog
      • Change Contact Name
      • Get Customer
      • Get User Token
      • API Configuration
      • 3Dolphins SRM Bot Macro Commands
      • JSON Body Request for 3Dolphins SRM Dialog Rest Integration
      • JSON Body Response for 3Dolphins SRM Dialog Rest Integration
    • FAQ Knowledge
      • Create New FAQ Knowledge
      • FAQ Knowledge Contextual
      • How to Show Fallback
      • Remove, Edit and Clone Knowledge
      • Search and Filter Knowledge
      • Macro First Name and Last Name
    • FAQ Suggestion
      • Mechanism of Using FAQ Suggestion
    • Digital Library
      • Create New Digital Library
        • Send Card
        • Send Option
        • Send Image
        • Send Document
        • Send Video
        • Send Audio
      • Edit Digital Library
      • Remove Digital Library
    • Page Builder
      • Add New Page
        • New Page Feature
      • Edit Page Builder
      • Generate Link Page
      • Download Raw Data of Page as JSON Format
      • Remove Page Builder
    • Payment Library
      • Add New Payment
      • Edit Payment Libarary
      • Delete Payment Library
    • Think Paragraph
      • Add Document (Article)
      • Edit Document (Article)
      • Ask Question Article
      • Delete Document (Article)
      • Think Paragraph Configuration
  • Analytic
    • Live Agent
      • Conversation History
      • Appraisal Report
      • Channel Interaction
      • Channel Group SLA
      • Live Agent SLA
      • Live Agent Performance
      • Live Agent Productivity
      • Live Agent Rating
      • Customer Rating
      • Visitor Volume
      • Bot Visitor Volume
      • Conversation Audit
      • User Access Audit
      • User AUX Audit
      • Net Promotor Score
      • Datetime Configuration
      • Create New Service Analytics
    • Virtual Agent
      • Bot Overview
        • Intent Data
        • Intent Score
      • Bot Engagement
      • Business Service
      • Intents Fallback
      • User Transaction
    • Employee
      • Operator Target
      • Attendance Report
      • Task Report
    • Sales
      • Deal Progress
      • Deal Conversion
      • Deal Overdue
      • Deal Won
      • Deal Lost
      • Filter Report
      • Download Report
    • WhatsApp
    • Wallboard
      • Wallboard Channel
      • Wallboard Agent
      • Wallboard Classifier
      • Wallboard Configuration
  • API
    • Service API
      • Ping API
      • Get Token
      • Auxilliary Mapping
      • Channel Connector API
      • Support Chart API
      • Contact API
      • File Upload Service
      • Form API
      • Location API
      • Marketing API
        • WhatsApp Broadcast
        • Line Broadcast
      • Profile API
      • Push Notification API
      • Report API
      • Ticket File Media API
      • Operator API
      • Ticket API
      • Supervisor API
      • Users API
      • Email Outbound API
      • Task API
    • Bot API
      • Get Token
      • Get Bot Response
      • Get Bot by Bot Id and Get list of Bots
      • Get Bot Deployment Channel by Bot Id
      • Get Bot FAQ Modules by Bot Id
      • Get Bot Dialogs by Bot Id
      • Get Bot Responses by Bot Id and User Message
      • NLP API
      • Think Paragraph API
    • Sales API
      • Get Token
      • Company API
      • Product API
      • Pipeline API
      • Deal API
      • Notes API
      • Lead API
Powered by GitBook
On this page

Was this helpful?

  1. Integration
  2. Chanel Connector
  3. Live Chat
  4. Memasukkan Live Chat pada Website / Mobile (Webview) Anda

Mobile (Webview)

Pertama, pilih file HTML index-debug-standard.html dan ganti namanya menjadi index-mobile.html (Ini opsional atau Anda dapat membiarkannya saja seperti itu).

Kemudian, buka file HTML dan salin kode di bawah ini ke index situs web Anda atau masukkan file HTML. Tempel kode di dalam tag <head> Anda.

<html>
<head>
  <meta charset="UTF-8">
  <title>Enterprise Web Chat</title>
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no" />
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Open+Sans'>
  <link rel="stylesheet" href="css/indigo.css">
  <link rel="stylesheet" href="css/widget.css">
  <link rel="stylesheet" href="css/lightslider.css">
  <link rel="stylesheet" href="css/intlTelInput.css">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no" />
	<style type="text/css">
		html {
			background: url(images/bg-login.svg) no-repeat;
			height: 100%;
			background-size: cover;
		}
	</style>
  <!-- <script src="https://maps.googleapis.com/maps/api/js?key=<KEY>&libraries=places"></script> -->
  <script src="https://www.google.com/recaptcha/api.js"></script>
  <!-- <script src="http://code.responsivevoice.org/responsivevoice.js"></script> -->
  <script src='js/jquery-2.1.3.min.js'></script>
  <script src='js/iframeResizer.contentWindow.js'></script>
  <script src='js/iframeResizer.js'></script>
  <script src='js/lightslider.js'></script>  
  <script src='js/lazyload.min.js'></script>  
  <script src="js/cryptojs/pbkdf2.js"></script>
  <script src="js/cryptojs/aes.js"></script>
  <script src="js/cipher/aes-util.js"></script>
  <script src="js/stp.js"></script>
  <script src="js/sjs.js"></script>
  <script src="js/chat.js"></script>
  <script src="js/fuse.js"></script>
  <script src="js/speech.js"></script>
  <script src="js/intlTelInput.js"></script>
  <script>
  $(document).ready(function() {
	    Chat.init({
	        header: 'Welcome to Our Chat',
	        login_sub_header: 'Please tell us about yourself',
	        connect_message: 'Do you have questions ? <br>Come chat with us, we are here to help you',
	        chat_sub_header: 'Our agent will serve you shortly',
			url: 'https://<host>:<port>',
			client_id: '<client_id>',
			client_secret: '<client_secret>',	
	        type_placeholder: 'Type message...',
			avatar: '<bot_image>',
			icon_avatar: '<icon_image>',
			agent_avatar: '<agent_image>',
	        enable_attachment: true,
	        enable_voice: true,
	        enable_speech: true,
	        enable_queue: true,
	        enable_history: true,
	        compatibility_mode: false,
	        queue_text: "⏰NOMOR URUT: ",
	        enable_campaign: false,
	        campaign_avatar: '<campaign_image>',
			campaign_title: '<campaign_title>',
	        campaign_text: 'Hello 👋, What do you think about our service ?',
	        campaign_timer: 5000,
	        campaign_menu: [{
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }, {
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }, {
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }],
	        max_upload_message: "File size limit exceeded. Maximum filesize is [max_filesize]",
	        selection_topic_placeholder: "Please select a topic",
	        selection_topic_member: ["Product", "Service"],
	        selection_topic_non_member: ["Hai", "Hello"],
			member_mode: false,
	        selection_topic_placeholder: "Please select a topic",
	        enable_service_hour: false,
	        service_hour: [{
	                "days": "sunday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "monday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "tuesday",
	                "startHour": "00:00",
	                "endHour": "15:52",
	                "holiday": true
	            },
	            {
	                "days": "wednesday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "thursday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "friday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "saturday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            }
	        ],
	        channel_id_email: "25b7fe4f7bd81aa0533be4963972ac74", /* channel id email */
	        subject_email: "Of service hour ticket",
	        send_email_success_message: "Email sent successfully !<br/><br/>Thanks, we have received your question or your complaint",
	        process_send_email_message: "Sending Email...",
	        process_send_email_error_message: "Email sent failed !",
			is_waiting_text_icon: true
	    });
	});
  </script>
</head>
<body>  
</body>
</html>

Hapus semua file HTML tetapi pertahankan index-mobile.html sebagai gantinya.

Salin seluruh direktori live chat yang tersisa ke path yang Anda tentukan dari server hosting web Anda.

Asumsikan yang ingin Anda pilih adalah tema indigo, lalu buka index-mobile.html dan ubah kode menggunakan warna yang Anda inginkan.

<link rel="stylesheet" href="css/indigo.css">
  <link rel="stylesheet" href="css/widget.css">
  <link rel="stylesheet" href="css/lightslider.css">
  <link rel="stylesheet" href="css/intlTelInput.css">

Jangan lupa untuk menyesuaikan resource path yang ada di index-mobile.html yang digunakan untuk memuat file seperti js, CSS, atau gambar, sesuai dengan tempat resource disimpan di server Anda.

<html>
<head>
  <meta charset="UTF-8">
  <title>Enterprise Web Chat</title>
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no" />
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Open+Sans'>
  <link rel="stylesheet" href="css/indigo.css">
  <link rel="stylesheet" href="css/widget.css">
  <link rel="stylesheet" href="css/lightslider.css">
  <link rel="stylesheet" href="css/intlTelInput.css">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no" />
	<style type="text/css">
		html {
			background: url(images/bg-login.svg) no-repeat;
			height: 100%;
			background-size: cover;
		}
	</style>
  <!-- <script src="https://maps.googleapis.com/maps/api/js?key=<KEY>&libraries=places"></script> -->
  <script src="https://www.google.com/recaptcha/api.js"></script>
  <!-- <script src="http://code.responsivevoice.org/responsivevoice.js"></script> -->
  <script src='js/jquery-2.1.3.min.js'></script>
  <script src='js/iframeResizer.contentWindow.js'></script>
  <script src='js/iframeResizer.js'></script>
  <script src='js/lightslider.js'></script>  
  <script src='js/lazyload.min.js'></script>  
  <script src="js/cryptojs/pbkdf2.js"></script>
  <script src="js/cryptojs/aes.js"></script>
  <script src="js/cipher/aes-util.js"></script>
  <script src="js/stp.js"></script>
  <script src="js/sjs.js"></script>
  <script src="js/chat.js"></script>
  <script src="js/fuse.js"></script>
  <script src="js/speech.js"></script>
  <script src="js/intlTelInput.js"></script>
  <script>
  $(document).ready(function() {
	    Chat.init({
	        header: 'Welcome to Our Chat',
	        login_sub_header: 'Please tell us about yourself',
	        connect_message: 'Do you have questions ? <br>Come chat with us, we are here to help you',
	        chat_sub_header: 'Our agent will serve you shortly',
			url: 'https://<host>:<port>',
			client_id: '<client_id>',
			client_secret: '<client_secret>',	
	        type_placeholder: 'Type message...',
			avatar: '<bot_image>',
			icon_avatar: '<icon_image>',
			agent_avatar: '<agent_image>',
	        enable_attachment: true,
	        enable_voice: true,
	        enable_speech: true,
	        enable_queue: true,
	        enable_history: true,
	        compatibility_mode: false,
	        queue_text: "⏰NOMOR URUT: ",
	        enable_campaign: false,
	        campaign_avatar: '<campaign_image>',
			campaign_title: '<campaign_title>',
	        campaign_text: 'Hello 👋, What do you think about our service ?',
	        campaign_timer: 5000,
	        campaign_menu: [{
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }, {
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }, {
	            "label": "<Campaign Label>",
	            "value": "<Campaign Payload>",
	            "icon": "<campaign_icon>"
	        }],
	        max_upload_message: "File size limit exceeded. Maximum filesize is [max_filesize]",
	        selection_topic_placeholder: "Please select a topic",
	        selection_topic_member: ["Product", "Service"],
	        selection_topic_non_member: ["Hai", "Hello"],
			member_mode: false,
	        selection_topic_placeholder: "Please select a topic",
	        enable_service_hour: false,
	        service_hour: [{
	                "days": "sunday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "monday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "tuesday",
	                "startHour": "00:00",
	                "endHour": "15:52",
	                "holiday": true
	            },
	            {
	                "days": "wednesday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "thursday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "friday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            },
	            {
	                "days": "saturday",
	                "startHour": "00:00",
	                "endHour": "23:59",
	                "holiday": true
	            }
	        ],
	        channel_id_email: "25b7fe4f7bd81aa0533be4963972ac74", /* channel id email */
	        subject_email: "Of service hour ticket",
	        send_email_success_message: "Email sent successfully !<br/><br/>Thanks, we have received your question or your complaint",
	        process_send_email_message: "Sending Email...",
	        process_send_email_error_message: "Email sent failed !",
			is_waiting_text_icon: true
	    });
	});
  </script>
</head>
<body>  
</body>
</html>

Di bagian sebelumnya ditujukkan untuk meletakkan source code pada situs web yang sudah tersedia, sedangkan di bagian ini kita harus membuat host live chat secara mandiri.

Di bawah ini merupakan sample code untuk mengonfigurasi tampilan web Anda yang menampilkan index-mobile.html yang sudah dihosting.

Configure Web View

Anda perlu mengaktifkan Javascript dan DomStorage untuk LocalStorage.

webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDatabaseEnabled(true);
webview.getSettings().setDomStorageEnabled(true);

Sekarang Anda dapat memuat URL.

webview.loadUrl("https://hostname/webchat/index-debug-standard.html");

Untuk menyesuaikannya setelah load halaman selesai, Anda dapat menjalankan kode ini.

webview.setWebViewClient(new WebViewClient() {
     @Override
     public void onPageFinished(WebView view, String url) {
          progressBar.setVisibility(View.GONE);
          super.onPageFinished(view, url);
     }
});

Enable Voice to Text (Speech Recognition)

Untuk mengaktifkan fitur ini, pertama-tama Anda perlu mengaktifkan RECORD_AUDIO pada android manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.imi.dolphin.bella">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
		...
		...
</manifest>

Kemudian, silahkan menginisialisasi Properties untuk mengaktifkan Record Audio Permission.

private static final int RECORD_AUDIO_REQUEST_CODE = 123;
private PermissionRequest permissionRequest;

permissionRequest property digunakan untuk mengakomodasi permintaan dari tampilan web yang akan diberikan akses nanti.

Saat ikon 'microphone' diklik, browser akan meminta izin ke perangkat, aplikasi Anda harus menangkap permintaan tersebut. dapat dilakukan dengan:

private void loadLiveChat() {
		...
		...

    webview.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onPermissionRequest(PermissionRequest request) {
            if (request != null) {
                permissionRequest = request;
                askPermission();
            }
        }
    });
}

private void askPermission() {
    if (ContextCompat.checkSelfPermission(getApplicationContext(), 
						Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
        
				ActivityCompat.requestPermissions(
						MainActivity.this, 
						new String[]{Manifest.permission.RECORD_AUDIO}, 
						RECORD_AUDIO_REQUEST_CODE
				);
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            permissionRequest.grant(permissionRequest.getResources());
        }
    }
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    if(requestCode == RECORD_AUDIO_REQUEST_CODE){
        if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                permissionRequest.grant(permissionRequest.getResources());
            }
            Toast.makeText(getApplicationContext(), "Permission Granted", Toast.LENGTH_SHORT).show();
        }
    }
}

Enable Attachment

Anda perlu mengaktifkan izin untuk READ_EXTERNAL_STORAGE pada android manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.imi.dolphin.bella">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
		...
</manifest>

kemudian, inisialisasi Properties untuk mengakses file.

private static final int INPUT_FILE_REQUEST_CODE = 1;
private ValueCallback<Uri[]> mFilePathCallback;

Konfigurasi web view untuk mengakses akses file.

private void loadLiveChat() {
		...
    webview.getSettings().setLoadWithOverviewMode(true);
    webview.getSettings().setAllowFileAccess(true);
		...
		...
}

Saat ikon 'attachment' diklik, browser akan meminta untuk membuka penyimpanan perangkat. Dapat dilakukan dengan:

private void loadLiveChat() {
    ...
		...

    webview.setWebChromeClient(new WebChromeClient() {
        ...
				...
				@Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { 
            if (mFilePathCallback != null) {
                mFilePathCallback.onReceiveValue(null);
            }
            mFilePathCallback = filePathCallback;

            Intent chooserIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
            return true;
        }
    });
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }
        Uri[] results = null;
        if (resultCode == Activity.RESULT_OK) {
            if (data != null) {
                String dataString = data.getDataString();
                results = new Uri[]{Uri.parse(dataString)};
            }
        }
        mFilePathCallback.onReceiveValue(results);
        mFilePathCallback = null;
    }
}

Di bawah ini adalah contoh final code jika Anda sudah mengikuti langkah-langkah di atas.

package com.imi.dolphin.bella;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.webkit.PermissionRequest;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

public class MainActivity extends AppCompatActivity {

    /**
     * Properties to access file
     */
    private static final int INPUT_FILE_REQUEST_CODE = 1;
    private ValueCallback<Uri[]> mFilePathCallback;

    /**
     * Properties to enable Record Audio Permission
     * <p>
     * the permissionRequest property is used to accommodate requests from the web view that will be granted access later
     */
    private static final int RECORD_AUDIO_REQUEST_CODE = 123;
    private PermissionRequest permissionRequest;

    /**
     * Initial Component Web View and Progress Bar
     */
    private WebView webview;
    private ProgressBar progressBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();
        loadLiveChat();
    }

    /**
     * Configure Web View
     */
    @SuppressLint("SetJavaScriptEnabled")
    private void loadLiveChat() {
        webview.loadUrl("<Server URL>");

        // Configure WebView To set Enable Javascript True And To Activate DomStorage True For LocalStorage
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setDatabaseEnabled(true);
        webview.getSettings().setDomStorageEnabled(true);

        // Configure WebView to access file access
        webview.getSettings().setLoadWithOverviewMode(true);
        webview.getSettings().setAllowFileAccess(true);

        webview.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                progressBar.setVisibility(View.GONE);
                super.onPageFinished(view, url);
            }
        });
        webview.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onPermissionRequest(PermissionRequest request) {
                if (request != null) {
                    permissionRequest = request;
                    askPermission();
                }
            }

            @Override
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
                // Double check that we don't have any existing callbacks
                if (mFilePathCallback != null) {
                    mFilePathCallback.onReceiveValue(null);
                }
                mFilePathCallback = filePathCallback;

                Intent chooserIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
                return true;
            }
        });
    }

    /**
     * Binding Item
     */
    private void init() {
        webview = findViewById(R.id.web_view);
        progressBar = findViewById(R.id.progress_bar);
        progressBar.setVisibility(View.VISIBLE);
    }

    /**
     * ask permission for Record Audio
     */
    private void askPermission() {
        if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.RECORD_AUDIO}, RECORD_AUDIO_REQUEST_CODE);
        } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                permissionRequest.grant(permissionRequest.getResources());
            }
        }
    }

    /**
     * Catch permission from user
     */
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        if (requestCode == RECORD_AUDIO_REQUEST_CODE) {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    permissionRequest.grant(permissionRequest.getResources());
                }
                Toast.makeText(getApplicationContext(), "Permission Granted", Toast.LENGTH_SHORT).show();
            }
        }
    }

    /**
     * Catch File data from user
     */
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
                super.onActivityResult(requestCode, resultCode, data);
                return;
            }
            Uri[] results = null;
            if (resultCode == Activity.RESULT_OK) {
                if (data != null) {
                    String dataString = data.getDataString();
                    results = new Uri[]{Uri.parse(dataString)};
                }
            }
            mFilePathCallback.onReceiveValue(results);
            mFilePathCallback = null;
        }
    }
}
PreviousWebsiteNextLive Chat SDK for React Native

Last updated 4 years ago

Was this helpful?

Selanjutnya, sesuaikan url, client_id dan properti client_secret sesuai dengan konfigurasi channel back-end Anda. Silakan merujuk kembali ke bagian untuk informasi lebih lanjut.

Jika Anda ingin mencoba code kami, klik untuk memulai.

How to Connect Client to Live Chat Channel
ini
Remove HTML File