Stella Platform Documentation

Stella Platform Documentation

  • Docs
  • Procedures
  • Reference
  • FAQ
  • Bot API
  • API
  • Languages iconEnglish
    • 中文

›Advanced Chatbot Application

Get Started

  • Build your First Chatbot

Basic Facebook Chatbot Setup

  • Overview
  • 1.1: Connect to Channels
  • 1.2: Create New Tree
  • 1.3: Build the First Node
  • 1.4: Create a Global Node
  • 1.5: Build Child Nodes
  • 2.1: Production Channel
  • 3.1: Draft a Post
  • 3.2: Create Comment Reply

Basic Instagram Chatbot Setup

  • Overview
  • 1.1: Connect to Channels
  • 1.2: Create New Tree
  • 1.3: Build the First Node
  • 1.4: Create Global Node
  • 1.5: Build Child Nodes
  • 2.1: Create Story Mention
  • 2.2: Create Comment Reply
  • 2.3: Send Push Message

Basic Web Chat Chatbot Setup

  • Overview
  • 1.1: Connect to Channels
  • 1.2: Create New Tree
  • 1.3: Build the First Node
  • 1.4: Create a Global Node
  • 1.5: Build Child Nodes

Basic WhatsApp Chatbot Setup

  • Overview
  • 1.1: WABA Subscription
  • 1.2: Connect WABA
  • 1.3: Check Approval Status of WABA
  • 1.4: Setup WABA with Used WhatsApp Number
  • 1.5: Reset / Terminate WABA
  • 2.1: Create New Tree
  • 2.2: Build the First Node
  • 2.3: Create a Global Node
  • 2.4: Build Child Nodes
  • 2.5: Connect to Datasource
  • 3.1: Create Priority Group
  • 4.1: Create Product Message

Common Use Case Application

  • Overview
  • 1.1: Apply Fail-Safe to Chatbot
  • 1.2: Apply Member Unsubscription Flow to Chatbot

Advanced Chatbot Application

  • Overview
  • Apply Datasource to Chatbot
  • Apply Payload Value to Chatbot
  • Apply API to Chatbot
  • Apply Custom Locale to Chatbot
  • Apply Opt-in Flow to Chatbot
  • Apply Agenda to Chatbot
  • Apply Stella API to Chatbot
  • Apply Web Event to Webchat Chatbot

Error Handling

  • Handle Errors for Chatbot

Stella Partner Portal Setup

  • Overview
  • 1.1: Partner Portal Setup
  • 1.2: New Customer Onboarding
  • 1.3: WABA Setup
  • 1.4: Check Approval Status of WABA
  • 1.5: Setup WABA with Used WhatsApp Number
  • 1.6: Reset / Terminate WABA

Template Tree

  • Overview
  • Create Template Tree
  • Manage Proxy Tree

Chatbot Testing & Deployment

  • Overview
  • Stage One - Tree Building
  • Stage Two - Testing Stage
  • Stage Three - Production Deployment

Slack Live Chat Tree Setup

  • Overview
  • 1.1: Create Tree for Live Chat Assignment
  • 2.1: Set Up Pick Ticket Status
  • 2.2: Create Done Command
  • 2.3: Create Transfer Command
  • 2.4: Create Archive Function
  • 2.5: Create Member Tagging/Remarks Command
  • 3.1: Automatic End Live Chat Function

Zendesk Live Chat Tree Setup

  • Overview
  • 1.1: Create Tree for Assignment
  • 2.1: Create Done Command
  • 2.2: Auto End Live Chat Function

FAQ Chatbot Setup

  • Overview
  • 1.1: Exact Keyword Match
  • 1.2: Keyword Groups Match & Diversion
  • 2.1: Redirect to Existing Chatbot Tree
  • 2.2: Data Analytics for FAQ Chatbot
  • 2.3: NLP for FAQ Chatbot
  • 3.1: Filtering Questions for FAQ Chatbot

NLP Chatbot Setup

  • Overview
  • 1.1: Apply NLP to your Chatbot
  • 2.1: Set Up an NLP Fallback Tree
  • 3.1: NLP Fallback to Other Languages

Connect Shopify Store to Stella

  • Overview
  • 1.1: Integrate Stella to Shopify
  • 2.1: Setup Facebook Messenger Chatbot for Shopify
  • 2.2: Setup WhatsApp Chatbot for Shopify
  • 2.3: WhatsApp Customer Care Notification for Shopify

Stella Inbox Setup

  • Overview
  • 1.1: Connect Channel to Slack
  • 1.2: Access Control & Admin Panel
  • 1.3: Set up Customizable Message
  • 1.4: Inbox Channel
  • 2.1: Turn on Live Chat Directly
  • 2.2: End Live Chat Mode
  • 2.3: Ticketing
  • 2.4: Manage Ticket Helper
  • 2.5: Add Member Tag
  • 3.1: Send Chatbot Message

Apply Opt-in Flow to Chatbot

Opt-in is a very important safeguard for enterprise, especially when the brand is running a marketing campaign with prizes. In most cases, users will need to opt-in or agree to a set of terms & conditions. A well-written terms will clear any disputes originated from the chatbot game because it set the expectation, rules & regulations for players or users.

Another important use case is to send WhatsApp Template Message from WABA to users. The rules state that a business must get the consent from their users before sending any push messages. For details, you may refer to the opt-in requirement in WhatsApp Overview.

These use cases require an opt-in conversation flow, a record of the opt-in user data, as well as a way to filter out who is opted-in in our member page & push panel.

The following object(s) and method(s) will be used in the application of data source:

  • this.upsertDataToDataSource
  • this.member.tags
  • this.member.botMeta.tempData

Expected Outcome

There are 4 types of expected outcome:

  1. User agrees on the terms of service and redirected to the starting message of the chatbot service. At the same time, the user is tagged with "Agree TNC" and also has a record on the Opt-in Record data source.
User opts-in
  1. Any users who accepted the T&C previously would not be asked to agree to the terms of service the next time they greet the chatbot.
User greets chatbot again.
Member tag "Accept TNC" is added to user.
User is recorded in the Opt-in Record Data Source.
  1. User disagress on the terms of service and redirected back to the T&C message.
User opts-out
  1. User types something randomly to trigger the fail safe and redirected back to the T&C message.
User triggers failsafe

Sample Tree Structure

Opt-in Flow Sample Tree Structure

Getting Hands-on

Enter the Bot Builder here to create your tree node.

Create a Tree Node - TNC

  1. Create a Tree Node and rename it as "TNC".

  2. Create a Response for stating the terms of service and define what constitutes as agreement to the T&C.

Response with T&C
  1. Save the Tree Node.

Create a Data Source - Opt-in Record

  1. Create a new Data Source.
Add a New Data Source
  1. Import this sample Opt-in Record to the Data Source.
Opt-in Record
  1. Copy the Data Source ID.

Create a Tree Node - TNC Agree

  1. Create a Tree Node and rename it as "TNC Agree".
Trigger for Agreement
  1. Create a Trigger for detecting keywords that contitutes as agreement. Rename the Trigger as "Agree Only". You may take reference to the following condition:
this.messageEvent.type === "TEXT" && /^(1|agree|同意|y)$/i.test(this.messageEvent.data.text)
  1. Create the 1st Pre-action for setting the status of user agreeing to T&C in the member data. Rename it as "Set User Agree TNC Status". You may refer to the following code:
return new Promise((resolve) => {
  this.lodash.set(this.member, "tags", this.lodash.get(this.member, "tags", []).filter(tag => tag !== "Disagree TNC"))
  this.lodash.set(this.member, "botMeta.tempData.userAgreeTNC", true)
  
  resolve({
    member: this.member
  })
})
Set User Status to Agree T&C

Please make sure the tag in the array (i.e. Disagree TNC) is the same as the one set in Create a Tree Node - TNC Disagree.

  1. Create the 2nd Pre-action for upserting the user opt-in record to the Data Source. You may refer to the following code:
return new Promise(async (resolve, reject) => {
  try {
    await this.upsertDataToDataSource({
      dataSourceId: "Insert Data Source ID Here",
      data: {
        "Member ID": this.member._id,
        "Name": this.member.firstName,
        "Whatsapp Number": this.member.externalId,
        "Opt-in": "Y"
      }
    })
    
    resolve({
      member: this.member
    })
  } catch (e) {
    reject(e)
  }
})
Upsert to Opt-in Record Data Source

Please remember to set the dataSourceId with the Data Source ID you created for Opt-in Record. You can change the data's naming (i.e. the array of data, e.g. "Member ID") to fit your Data Source column headers too.

  1. Create a response for stating to users that the opt-in has been completed.
Opt-in Success Message
  1. You may choose to toggle on "Redirect" back to the start of chatbot service, so that user can continue the conversation seamlessly.
Redirect to Start of Chatbot Service
  1. Toggle on "Member Tagging" and set the tag as "Agree TNC".
Set Member Tag as "Agree TNC"
  1. Save the Tree Node.

Create a Tree Node - TNC Disagree

  1. Create a Tree Node and rename it as "TNC Disagree".
Trigger for Disagreement
  1. Create a Trigger for detecting keywords that contitutes as disagreement. Rename the Trigger as "Disagree Only". You may take reference to the following condition:
this.messageEvent.type === "TEXT" && /^(2|disagree|不同意|n)$/i.test(this.messageEvent.data.text)
  1. Create a response for stating to users that the opt-in has failed.
Opt-in Fail Message
  1. You may choose to toggle on "Redirect" back to the start of the opt-in flow, so that user can decide for the second time.
Redirect to TNC
  1. Toggle on "Member Tagging" and set the tag as "Disagree TNC".
Set Member Tag as "Disagree TNC"
  1. Save the Tree Node.

Create a Tree Node - TNC failsafe

  1. Create a Tree Node and rename it as "TNC failsafe".

  2. Create a Trigger for any text, any payload or any media. Rename the Trigger as "Type all".

Trigger for Any Text, Payload & Media
  1. Create a response for stating to users that the chatbot does not comprehend user's input.
Fail Safe Message
  1. Toggle on "Redirect" back to the start of the opt-in flow, so that user can input for the second time.
Redirect to TNC
  1. Save the Tree Node.

Create a Global Node - Greetings Keywords

  1. Create a Global Node and rename it as "Greetings Keywords". This Global Node is to determine if the user has opted-in before. If the member tag "Agree TNC" is present, it means the user has opted in and then the system will redirect user to the start of chatbot service. Otherwise, the system will redirect user to the Tree Node - "TNC".

  2. Create a Trigger for detecting greetings keywords. Rename the Trigger as "Text: Greetings".

Trigger for Greetings User Input
  1. Toggle on "Redirect" and copy the following code to the "Advanced" tab:
return new Promise (resolve => {
  const memberTagArray = this.lodash.get(this.member, "tags", [])
  if (memberTagArray.includes("Agree TNC")) {
    resolve({
      tree: "Insert Tree ID here or this.node.tree", // Tree ID of the start of chatbot service
      nodeCompositeId: "Insert Node Composite ID Here", // Node Composite ID of the start of chatbot service
      runPreAction: true,
      sendResponse: true,
      runPostAction: true,
    })
  }
  resolve({
      tree: this.node.tree,
      nodeCompositeId: "Insert Node Composite ID Here", // Node Composite ID of TNC
      runPreAction: true,
      sendResponse: true,
      runPostAction: true,
    })
})

Redirect User Based on Opt-in Status

For this section, you may set which Tree Node the chatbot should redirect to. Insert a Tree ID if it is not in the same Opt-in Flow tree. Otherwise, type this.node.tree.

  1. Save the Global Node and see if you can produce the expected outcome.
← Apply Custom Locale to ChatbotApply Agenda to Chatbot →
  • Expected Outcome
  • Sample Tree Structure
  • Getting Hands-on
    • Create a Tree Node - TNC
    • Create a Data Source - Opt-in Record
    • Create a Tree Node - TNC Agree
    • Create a Tree Node - TNC Disagree
    • Create a Tree Node - TNC failsafe
    • Create a Global Node - Greetings Keywords
Stella Platform Documentation
Docs
Get StartedBot API ReferenceAPI ReferenceStandard Procedures
Community
FAQUser ShowcaseChat with Us
Copyright © 2023 Sanuker Inc. Limited