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
  • Configuration
  • First Import the Required Class
  • The Outline of How to Use The API
  • Connect()
  • Disconnect()
  • Connectedmethod
  • Connectingmethod
  • onReceivedMethod()
  • onCustomerTyping()
  • onSend()
  • messageSentMethod
  • onAgentTypingMethod
  • getChatHistory
  • checkChannelStatus
  • additionalRestHeaders
  • Trigger Menus

Was this helpful?

  1. Integration
  2. Chanel Connector
  3. Live Chat

Live Chat SDK for React Native

Configuration

Sebelum menggunakan DolphinConnect API, harap instal modul npm dolphin-livechat-connector versi terbaru. Pada saat penulisan ini, versinya adalah 1.1.4.

First Import the Required Class

import { DolphinProfile, DolphinConnect} from 'dolphin-livechat-connector';

The Outline of How to Use The API

/**
* Prepare your  customer  profile here
*/
 
let profile = new DolphinProfile();
profile.username= "your name"
profile.email   = "your email";
profile.phone   = "your  phone number";
profile.customerid= "your customerid";  //optional
 
/**
* Get  singleton  instance of  Dolphin Messenger  Connector
* Setup Your Avatar,  Client  Id,  and  Client  Secret
*/
 
let dolphinConnect = DolphinConnect.getlnstance(profile);
dolphinConnect.setAvatarCSri Virtual Assistant',
'http://www.inmotion.co.idlassets/images/logolsri_face.png');
 
dolphinConnect.setDetectorEndpoint('http://example:xxxxx/isonline/14xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.);  //optional
 
dolphinConnect.setAdditionalRestHeaders({ //optional
       'ApiKey'     :  rxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx'
})
 
dolphinConnect.configure( 
      "your channel url",
      "your channel client id",
      "your  channel client  secret"
);
 
dolphinConnect.set0nReceiveMethod(this.on any iveMessage);
dolphinConnect.setMessageSentMethod(this.messageSentMethod);
dolphinConnect.setConnectedMethod(this.connectedMethod);
dolphinConnect.setConnectingMethod(this.connectingMethod);
dolphinConnect.setOnAgentTypingMethod(this.onAgentrypingMethod);

Connect()

Panggil metode ini untuk membuat koneksi ke server. Di bawah ini adalah contoh bagaimana menggunakan metode tersebut.

dolphinConnect.connect();

Disconnect()

Panggil metode ini untuk memutuskan koneksi dengan server. Di bawah ini adalah contoh bagaimana menggunakan metode tersebut.

dolphinConnect.disconnect();

Connectedmethod

Metode ini akan di-trigger ketika status 'DolphinConnect.isConnected' diaktifkan (true -> false atau sebaliknya). Di bawah ini adalah contoh bagaimana menerapkan metode tersebut.

connectedMethod = (connected, error) => {
    if (connected) {
        dolphinConnect.isConnected === true // TRUE
    } else {
        dolphinConnect.isConnected === false // TRUE
        console.log('Connection is broken', error);
    }
}
dolphinConnect.setConnectedMethod(connectedMethod);

Connectingmethod

Metode ini akan ditrigger ketika DolphinConnect membuat koneksi, baik ketika pertama kali kita memanggil metode connect() atau proses menghubungkan kembali. Di bawah ini adalah contoh bagaimana menerapkan metode tersebut.

connectingMethod = () => {
    dolphinConnect.isConnecting === true // TRUE
    console.log('Estabilishing connection...');
}
dolphinConnect.setConnectingMethod(connectingMethod);

onReceivedMethod()

Metode ini akan di-trigger saat DolphinConnect mendeteksi pesan masuk. Di bawah ini adalah contoh bagaimana mengimplementasikan metode (Catatan: 'message' payload yang ditunjukkan di bawah ini adalah array object).

onReceiveMessage = message => {
     console.log(message);
}
dolphinConnect.setOnReceiveMethod(onReceiveMessage);

Pure text message

Jenis pesan ini selalu memiliki properti 'text'. Seperti inilah tampilan pesannya.

createdAt : Thu Oct 24 2018 13:58:40 GMT+0700 (Western Indonesia Time) {}
document : null
documentName : null
origin : "Incoming"
text : "Pagi kak Albert, senang bisa menyapa kakak pagi ini."
user :
   avatar : "http://www.example.co.id/assets/images/logo/example.png"
   name : "Sri Virtual Assistant"
   _id : "agent/bot"
   __proto__ : Object
  _id : "0xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
   __proto__ : Object
length : 1
__proto__ : Array(0)

Quick Reply / Suggestion Message

Jenis pesan ini selalu memiliki properti 'options'. Seperti inilah tampilan pesannya.

createdAt : Thu Oct 24 2018 13:58:40 GMT+0700 (Western Indonesia Time) {}
options : Array(3)
  0 : "Satu@===@1"
  1 : "Sepuluh@===@10"
  2 : "Seratus@===@100"
length : 3
__proto__ : Array (0)
origin : "Incoming"
user : {_id: "agent/bot", name: "Sri Virtual Assistant", avatar: "http://www.example.co.id/assistant"
 _id: "9xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
__proto__ : Object

Properti 'options' memiliki dua properti yang dipisahkan oleh simbol @ === @. Properti pertama adalah label yang ditampilkan dalam pesan chat, sedangkan properti kedua adalah nilai / payload yang dikirimkan ke backend / server. Di bawah ini adalah contoh bagaimana menerapkannya.

const albelAndValue = option.split('@===@');
dolphinConnect.onSend({
    text : labelAndValue[0],
    value : labelAndValue[1],
})

Button Card Message

Pesan seperti ini selalu memiliki properti 'buttons'. seperti inilah tampilan pesannya.

0:
  buttons: Array(2)
    0:
      buttonValues: Array(2)
      0: {name: "INFO", value: "info Social CRM"
      1: {name: "DETAIL", value: "https://www.example.co.id"}
        length: 2
      __proto__ : Array(0)
      group: "3Dolphin"
      id: "0xxxxxxxxxxxxxxxxxxxxxxxx"
      pictureLink: "http://chat.example.com:xxxxx/webchat/out/button/Axxxxxxxxxxxxxxxxxx"
      subTitle: "omniChannel Social CRM"
      title: "Social CRM"
      __proto__: Object
    1: {id: "1xxxxxxxxxxxxxxxxxxxxxxxxxx", pictureLink: "http://chat.example.com:xxxxx"
    length:2
    __proto__ : Array(0)
  createdAt : Thu Oct 24 2018 13:58:40 GMT+0700 (Western Indonesia Time) {}
  origin: "Incoming"
  user :{_id: "agent/bot", name: Sri Virtual Assistant, avatar: "http://www.example.co.id/assets/images/logo"}
   _id : "4xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
   __proto__ : Object

Image message

Pesan seperti ini selalu memiliki properti 'image'. seperti inilah tampilan pesannya.

0:
createdAt : Thu Oct 24 2018 13:58:40 GMT+0700 (Western Indonesia Time) {}
image: "http://example/1xxxxxxxxxxxxxxxxxxxxxxxxxxxx/webchat/out/image/"
origin: "Incoming"
text: null
user :{_id: "agent/bot", name: Sri Virtual Assistant, avatar: "http://www.example.co.id/assets/images/logo"}
   _id : "axxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
   __proto__ : Object

onCustomerTyping()

Panggil metode ini ketika Anda ingin mengirimkan typing event pelanggan/user ke server. Di bawah ini adalah contoh bagaimana menggunakan metode tersebut.

dolphinConnect.onCustomerTyping();

onSend()

Panggil metode ini untuk mengirim pesan, pesan harus berupa object atau array object. Di bawah ini adalah contoh cara mengirimkannya.

Text Message

dolphinConnect.onSend({ text: 'Hai selamat pagi!'});
dolphinConnect.onSend([{ text: 'Hai selamat pagi!' }, { text: 'Ada yang bisa saya bantu?' }])

Image Message

dolphinConnect.onSend({ image: 'content://media/external/images/media/xxxxxx'});
dolphinConnect.onSend([{ image: 'content://media/external/images/media/xxxxxx' }, { image: 'content://media/external/images/media/xxxxxx' }])

Metode ini juga untuk me-return object array dengan pesan teks sebelumnya ditambah dengan informasi tambahan seperti created date dan id.

const messageArrObj = DolphinConnect.instance.onSend([{ text: 'Hai Selamat Pagi!' }, { text: 'Ada yang bisa saya bantu?' }]);
console.log(messageArrObj);

Seperti inilah tampilan untuk array object-nya.

createdAt : Thu Oct 24 2018 13:58:40 GMT+0700 (Western Indonesia Time) {}
origin : "Outgoing"
text : "Hai Selamat Pagi!"
user :{_id: "user", name: undefined, avatar: undefined}
_id : "2xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
__proto__ : Object
1: {text: "Ada yang bisa saya bantu?", _id: "2xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx", create
length : 2 
__proto__ : Array(0)

messageSentMethod

Metode ini akan di-trigger setelah metode onSend dipanggil, apakah pesan berhasil dikirim atau tidak. Di bawah ini adalah contoh bagaimana menerapkan metode tersebut.

messageSentMethod = (message, success, error) => {
   if (success) {
      console.log('This message is sent successfully!')
   } else {
      console.log('This message sent failed!', error)
   }
 
   console.log('MESSAGE :', message);
}

onAgentTypingMethod

Metode ini akan di-trigger saat Agen sedang mengetik. Di bawah ini adalah contoh bagaimana menerapkan metode tersebut.

onAgentTypingMethod = () => {
     console.log('Agent is typing...')
}
dolphinConnect.setOnAgentTypingMethod(onAgentTypingMethod);

getChatHistory

Mengambil conversation history dari backend. Format yang diambil sama dengan contoh pesan sebelumnya (array object). Di bawah ini adalah contoh cara menggunakannya.

dolphinConnect.getChatHistory(getChatHistorySuccess, getChatHistoryFailed);
 
getChatHistorySuccess = chatHistory => {
     //Do Something with the retrieved chat history
}
 
getChatHistoryFailed = error => {
       console.log('Chat History retrieval failed', error);
}

checkChannelStatus

Memeriksa apakah channel yang ditentukan sedang online atau tidak. Sebelum menggunakan metode ini, pastikan Anda telah menyetel endpoint.

dolphinConnect.setDetectorEndpoint('http://example:xxxxx/isonline/14xxxxxxxxxxxxxxxxxxxxxxxx');

Di bawah ini adalah contoh cara menggunakannya.

channelOnlineMethod = () => {
       console.log('CHANNEL IS ONLINE')
}
 
channelOfflineMethod = message => {
       console.log('CHANNEL IS OFFLINE', message);
}
 
dolphinConnect.checkChannelStatus(this.channelOnlineMethod, this.channelOfflineMethod);

additionalRestHeaders

Tambahkan header REST tambahan untuk mengakomodasi header BTPN-ApiKey. Di bawah ini adalah contoh cara menambahkan beberapa header.

dolphinConnect.setAdditionalRestHeaders({
       'BTPN-ApiKey' : 'bxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx',
       'other-header': 'other-value'
})

Trigger Menus

Untuk mengaplikasikan trigger menu atau knowledge. Dapat dilakukan setelah chat init, tambahkan metode dolphinConnect.onSend (triggerMenu). Jadi ketika user memulai percakapa awal, aplikasi juga langsung mengirimkan metode pesan ke 3dolphins. Sesuai dengan kata kunci yang sudah di atur sejak awal.

/**
* prepare your customer profile here\
*/
 
let profile = new DolphinProfile();
profile.username = "your name";
profile.email = "your email";
profile.phone = "your phone number";
 
/**
* Get singleton instance of Dolphin Messenger Connector
* Setup your avatar, Client Id, and client secret 
*/
 
let dolphinConnect = DolphinConnect.getInstance(Profile);
dolphinConnect.setAvatar('Sri Virtual Assistant', 'http://www.inmotion.inmotion.co.id/assets/images/logo/xxxx.png');
 
        dolphinConnect.configure(
        "https://xxxxxxxx.ngrok.io",    //url
        "ddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",    /fclient_id
        "13xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"     //client_secret
);
 
dolphinConnect.set0nReceiveMethod(this.onReceiveMessage);
dolphinConnect.setMessageSentMethod(thisrmessageSentMethod);
dolphinConnect.setConnectedMethod(this.connectedMethod);
dolphinConnect.setConnectingMethod(this.connectingMethod);
dolphinConnect.setOnAgentTypingMethod(this.onAgentTypingMethod);
 
dolphinConnect.connect(
dolphinConnect.onCustomerTyping();
dolphinConnect.onSend({text:'Hai  Selamat  Pagi!'}); dolphinConnect.disconnect();
PreviousMobile (Webview)NextTelegram Account

Last updated 4 years ago

Was this helpful?