2.0.1 • Published 12 months ago

@workgrid/conversation-builder v2.0.1

Weekly downloads
241
License
Apache-2.0
Repository
github
Last release
12 months ago

Conversation Builder

Latest version

The ConversationBuilder includes helper methods for constructing the response. A Response may contain multiple elements, and the helper methods aid in generating responses, reducing the need to initialize and set the elements of each response. ConversationBuilder is available via @workgrid/conversation-builder.

Installation

$ npm install @workgrid/conversation-builder

Usage

import ConversationBuilder from '@workgrid/conversation-builder'

const builder = new ConversationBuilder()
builder.withTitle('Exciting Title')
builder.withText('Some response text')
builder.withImage('https://www.messengerpeople.com/wp-content/uploads/2018/08/knowhow-chatbots2-5bots.png')
builder.withUrl('https://www.workgrid.com/')
builder.withDetail('Additional detail for your answer')
builder.withOptions(['Option Button 1', 'Option Button 2', 'Option Button 3'])
builder.withSuggestions(['Suggestion 1', 'Suggestion 2', 'Suggestion 3'])
builder.withCard(true)
builder.build()

How It Works

At a minimum, the .withText method must be used to supply some text for a response.

  • .withText - will render standard text.
    • N.B. The text specified may be split across a maximum of 2 speech bubbles by using the '(newbubble)' delimiter between the text for each bubble, for example 'withText('Text for 1st speech bubble.(newbubble)Text for 2nd bubble')
  • .withCard(true) - will wrap the response in a card format.
  • .withOptions will add option buttons for the user to choose from in the response.
  • .withSuggestions - will render suggestion chips which will appear above the chatbot textbox to guide the user
  • .withImage - will render an image if an image url is specified.
  • .withOptions - will render buttons with the labels supplied
  • .withUrl - will add a url (below the main text) N.B. the response text itself can also contain hyperlinks

Elements which are only applicable to "Card" format responses

  • .withCard - will wrap the response elements in a card format (styled div).
    • This would typically be used for static answers to questions like "What is Workgrid?"
  • .withTitle - will render a Title if "card" format has been selected
  • .withDetail - will add more detailed text (below the main text) if "card" format has been selected.
    • The detailed text may be split across a maximum of 2 paragraphs using the '\n\n' delimiter between the paragraphs, e.g. withDetail("Contents of 1st paragraph.\n\n Contents of 2nd paragraph.")

Example responses

Simple Text only Response

const builder = new ConversationBuilder()
builder
.withText('Hi! What can I do for you today?')
.build()

Simple Text only Response

Double Bubble Response

const builder = new ConversationBuilder()
builder
.withText(
  'Workgrid’s initial product – the Workgrid Assistant – is a digital assistant built to simplify the work day by integrating with the common systems and tools found in the workplace. **(newbubble)** See www.workgridsoftware.com for more info.'
)
.build()

Double Speech Bubble Response

Suggestions Response

const builder = new ConversationBuilder()
builder
  .withText(
    "I know about these areas and more: \n\n - Workgrid \n- Amenities \n- Treasury \n- LSM Underwriting \n- Company Devices \n\nEnter _'Tell me about'_ and your chosen topic to dig a little deeper."
  )
  .withSuggestions('See more topics', 'show all topics', 'Cancel')
  .build()

Suggestions Response

Card Response

const builder = new ConversationBuilder()
builder
  .withText(
    "Hi Matt !\n\nI'm your Digital Assistant, always available to make your day a bit easier.\n\n To get started, ask me a question or say Learn More.`"
  )
  .withOptions(['Learn More'])
  .withCard(true)

Card Response

0.0.0-9bae370

12 months ago

0.0.0-720b7da

12 months ago

0.0.0-d5c9894

2 years ago

0.0.0-c30effa

1 year ago

0.0.0-db374cd

1 year ago

0.0.0-ad31173

2 years ago

0.0.0-8a96a87

2 years ago

0.0.0-ff07f97

2 years ago

0.0.0-8464640

2 years ago

0.0.0-49406f6

2 years ago

0.0.0-5810137

1 year ago

0.0.0-ecd3e71

1 year ago

0.0.0-2dbfc85

1 year ago

0.0.0-d8388b6

1 year ago

0.0.0-da522d8

1 year ago

0.0.0-1a6eb52

2 years ago

0.0.0-85f5507

3 years ago

0.0.0-19c31ba

2 years ago

0.0.0-cefbeeb

2 years ago

0.0.0-0ae553e

2 years ago

0.0.0-28d2f05

2 years ago

0.0.0-0591d44

3 years ago

0.0.0-e89c44b

2 years ago

0.0.0-d8bf15c

2 years ago

0.0.0-152e306

2 years ago

0.0.0-6e8155f

2 years ago

0.0.0-b65df8c

2 years ago

0.0.0-e976967

3 years ago

0.0.0-b99818a

2 years ago

0.0.0-5a5adcb

2 years ago

0.0.0-6512001

2 years ago

0.0.0-56501f1

2 years ago

0.0.0-aac93e1

2 years ago

0.0.0-7cf7eee

2 years ago

0.0.0-1bdaecd

2 years ago

0.0.0-1dc05fb

2 years ago

0.0.0-aaf85fa

2 years ago

0.0.0-98dd599

3 years ago

0.0.0-91da1b2

2 years ago

0.0.0-087eb38

2 years ago

0.0.0-a34c2f1

3 years ago

0.0.0-b8ba905

3 years ago

0.0.0-5a6ce9a

3 years ago

0.0.0-ad085f7

3 years ago

0.0.0-9a8913e

3 years ago

0.0.0-5ff5fcd

3 years ago

0.0.0-94cfc1d

3 years ago

0.0.0-6d98501

3 years ago

0.0.0-fcb4eb3

3 years ago

0.0.0-eca947a

3 years ago

0.0.0-a93078f

3 years ago

0.0.0-285b089

3 years ago

0.0.0-35b55ee

3 years ago

0.0.0-513513d

3 years ago

0.0.0-8317ff4

3 years ago

2.0.1

3 years ago

0.0.0-53a1cee

3 years ago

0.0.0-258210c

3 years ago

0.0.0-6d9b0ca

3 years ago

0.0.0-b263cf3

3 years ago

0.0.0-507fdf8

3 years ago

0.0.0-3508c93

3 years ago

0.0.0-1a14e9c

3 years ago

0.0.0-7caf3aa

3 years ago

0.0.0-4dba1ba

3 years ago

0.0.0-472ff48

3 years ago

0.0.0-e7a0c6c

3 years ago

0.0.0-6e55132

3 years ago

0.0.0-3652e3a

3 years ago

0.0.0-8ce7221

3 years ago

0.0.0-731c551

3 years ago

0.0.0-02b4bba

3 years ago

0.0.0-826bfdc

3 years ago

0.0.0-64af13b

3 years ago

0.0.0-1997f56

3 years ago

0.0.0-e3b1dff

3 years ago

0.0.0-ab348aa

3 years ago

0.0.0-7ace820

3 years ago

0.0.0-4e131be

3 years ago

0.0.0-659e77d

3 years ago

0.0.0-d65fce0

3 years ago

0.0.0-f8023f5

3 years ago

0.0.0-b79f338

3 years ago

0.0.0-b49ebf7

3 years ago

0.0.0-a0e75ff

3 years ago

0.0.0-25e8551

3 years ago

0.0.0-f959831

3 years ago

0.0.0-edf71ce

3 years ago

0.0.0-4431d1b

3 years ago

0.0.0-aeb1275

3 years ago

0.0.0-63f3e2c

3 years ago

0.0.0-445e4bf

3 years ago

0.0.0-d2d79bf

3 years ago

0.0.0-c54d083

3 years ago

0.0.0-d0e718d

3 years ago

0.0.0-1291d53

3 years ago

0.0.0-949f33f

3 years ago

0.0.0-061d3b6

3 years ago

0.0.0-de72067

3 years ago

0.0.0-779c1c7

3 years ago

0.0.0-49a97f7

3 years ago

0.0.0-adb3fb2

3 years ago

0.0.0-151be45

3 years ago

0.0.0-d95d316

3 years ago

0.0.0-c0da8e8

3 years ago

0.0.0-f1f273b

4 years ago

0.0.0-d7e8026

4 years ago

0.0.0-15697f5

4 years ago

0.0.0-da5c3f7

4 years ago

0.0.0-ac98a69

4 years ago

0.0.0-0dc20c4

4 years ago

0.0.0-48de000

4 years ago

0.0.0-ee03c8d

4 years ago

0.0.0-7958327

4 years ago

0.0.0-2b26903

4 years ago

0.0.0-f6bf0ff

4 years ago

0.0.0-2b48604

4 years ago

0.0.0-8e84dd2

4 years ago

0.0.0-48dc995

4 years ago

0.0.0-43aa17d

4 years ago

0.0.0-d95c5e8

4 years ago

0.0.0-ec24081

4 years ago

0.0.0-70b517b

4 years ago

0.0.0-a7d6db8

4 years ago

0.0.0-ae6f109

4 years ago

0.0.0-598d715

4 years ago

0.0.0-fbf8249

4 years ago

0.0.0-2a58e96

4 years ago

0.0.0-b04dd52

4 years ago

0.0.0-1acb547

4 years ago

2.0.0

4 years ago

0.0.0-e13a58a

4 years ago

0.0.0-233f165

4 years ago

0.0.0-07db60d

4 years ago

0.0.0-45a690a

4 years ago

0.0.0-67ad699

4 years ago

0.0.0-0708a65

4 years ago

0.0.0-2efbcb3

4 years ago

0.0.0-12eded8

4 years ago

0.0.0-2e8aab2

4 years ago

0.0.0-03f4c17

4 years ago

0.0.0-7f08813

4 years ago

0.0.0-90ccb3e

4 years ago

0.0.0-c13ca61

4 years ago

0.0.0-46e94f3

4 years ago

0.0.0-ba89429

4 years ago

0.0.0-abe726a

4 years ago

0.0.0-24d4bf1

4 years ago

0.0.0-68898b5

4 years ago

0.0.0-8a6ad9f

4 years ago

0.0.0-b2dc1c2

4 years ago

0.0.0-0579a60

4 years ago

0.0.0-d815488

4 years ago

0.0.0-a873e18

4 years ago

0.0.0-b79d22b

4 years ago

0.0.0-bf428e1

4 years ago

0.0.0-fcbb26d

4 years ago

0.0.0-ed2a875

4 years ago

0.0.0-04dfbf4

4 years ago

0.0.0-4a14765

4 years ago

0.0.0-bd1d2da

4 years ago

0.0.0-48f4417

4 years ago

0.0.0-f9b63c1

4 years ago

0.0.0-b2b120c

4 years ago

0.0.0-fdd66bd

4 years ago

0.0.0-3d19f58

4 years ago

0.0.0-f6797a4

4 years ago

0.0.0-ce06869

4 years ago

0.0.0-854af13

4 years ago

0.0.0-4717bfd

4 years ago

0.0.0-9644616

4 years ago

0.0.0-9a3d82f

4 years ago

0.0.0-c3a8c13

4 years ago

0.0.0-22b6f5d

4 years ago

0.0.0-31a4158

4 years ago

0.0.0-11845f0

4 years ago

0.0.0-1c99241

4 years ago

0.0.0-aecbf16

4 years ago

0.0.0-9f01edc

4 years ago

0.0.0-f0597af

4 years ago

0.0.0-3a3fc4f

4 years ago

0.0.0-71a7897

4 years ago

0.0.0-fc5e0b9

4 years ago

0.0.0-293deea

4 years ago

0.0.0-7d81bf1

4 years ago

0.0.0-b577bc2

4 years ago

0.0.0-2b96fbd

4 years ago

0.0.0-435247b

4 years ago

0.0.0-33174b6

4 years ago

0.0.0-76b68fd

4 years ago

0.0.0-7d1fc2a

4 years ago

0.0.0-de0f63a

4 years ago

0.0.0-99dfe6d

4 years ago

0.0.0-0ead5d9

4 years ago

0.0.0-90759fd

4 years ago

0.0.0-0ec6b78

4 years ago

0.0.0-717a092

4 years ago

0.0.0-416ec80

4 years ago

0.0.0-dcda6a0

4 years ago

0.0.0-b4f7fa3

4 years ago

0.0.0-9c1af54

4 years ago

0.0.0-9b0c4a3

4 years ago

0.0.0-43d0791

4 years ago

0.0.0-1f1514a

4 years ago

0.0.0-76a9ac3

4 years ago

0.0.0-7fa1c3c

4 years ago

0.0.0-46f61de

4 years ago

0.0.0-233a5ec

4 years ago

0.0.0-e73c795

4 years ago

0.0.0-8719635

4 years ago

0.0.0-ff708d1

4 years ago

0.0.0-51b1a35

4 years ago

0.0.0-04cbc54

4 years ago

0.0.0-248dd74

4 years ago

0.0.0-a8ef17f

4 years ago

0.0.0-c382ecc

4 years ago

0.0.0-9290421

4 years ago

0.0.0-3aecdec

4 years ago

0.0.0-32d321f

4 years ago

0.0.0-09004e2

4 years ago

0.0.0-56556be

4 years ago

0.0.0-58f2404

4 years ago

0.0.0-6ca2472

4 years ago

0.0.0-394a9d9

4 years ago

0.0.0-7501ba9

4 years ago

0.0.0-3850648

4 years ago

0.0.0-dde206b

4 years ago

0.0.0-2f67668

4 years ago

0.0.0-45a0c29

4 years ago

0.0.0-48cff85

4 years ago

0.0.0-f19e7b5

4 years ago

0.0.0-05c7be3

4 years ago

0.0.0-08463f9

4 years ago

0.0.0-14cb4a8

4 years ago

0.0.0-8263ac1

4 years ago

0.0.0-752261f

4 years ago

0.0.0-f10a9db

4 years ago

0.0.0-ceb7a95

4 years ago

0.0.0-1e2c5d9

4 years ago

0.0.0-b4f46b4

4 years ago

0.0.0-c6ec510

4 years ago

0.0.0-f82d560

4 years ago

0.0.0-64b2497

4 years ago

0.0.0-46e1404

4 years ago

0.0.0-bb21519

4 years ago

0.0.0-9c8b224

4 years ago

0.0.0-4840bfb

4 years ago

0.0.0-73cf9dc

4 years ago

0.0.0-d5c9613

4 years ago

0.0.0-72d9208

4 years ago

0.0.0-d7c8358

4 years ago

0.0.0-57f6e4b

4 years ago

0.0.0-6ccf4c8

4 years ago

0.0.0-6068052

4 years ago

0.0.0-be05bf8

4 years ago

0.0.0-72fdec1

4 years ago

0.0.0-90979c1

4 years ago

0.0.0-e41f341

4 years ago

0.0.0-59eaa2d

4 years ago

0.0.0-c75f604

4 years ago

0.0.0-2c1243f

4 years ago

0.0.0-9df0306

4 years ago

0.0.0-9a65f34

4 years ago

0.0.0-0510a72

4 years ago

0.0.0-6a0e66a

4 years ago

0.0.0-1b7971e

4 years ago

0.0.0-10f8fa6

4 years ago

0.0.0-c1163b7

4 years ago

0.0.0-2f5880c

4 years ago

0.0.0-8a143be

4 years ago

0.0.0-4847888

4 years ago

0.0.0-09e10f4

4 years ago

0.0.0-152bb97

4 years ago

0.0.0-2aa1d1f

4 years ago

0.0.0-9c8983d

4 years ago

0.0.0-abf8fb4

4 years ago

0.0.0-79d4d54

4 years ago

0.0.0-3a8ef7c

4 years ago

0.0.0-6d85175

4 years ago

0.0.0-7b3e2e4

4 years ago

0.0.0-f3759a4

4 years ago

0.0.0-b1a6ea8

4 years ago

0.0.0-576c1e3

4 years ago

0.0.0-f54da8a

4 years ago

0.0.0-88453cc

4 years ago

0.0.0-aaccc76

4 years ago

0.0.0-3e0eb42

4 years ago

0.0.0-b47d0fe

4 years ago

0.0.0-86f226b

4 years ago

0.0.0-61d132a

4 years ago

0.0.0-2796acf

4 years ago

0.0.0-0fcf00a

4 years ago

0.0.0-5174d07

4 years ago

0.0.0-f461aa3

4 years ago

0.0.0-b29bd65

4 years ago

0.0.0-55ee22e

4 years ago

0.0.0-fc4ce76

4 years ago

0.0.0-a3aff60

4 years ago

0.0.0-06ecc44

4 years ago

0.0.0-f5141db

4 years ago

0.0.0-052a9f0

4 years ago

0.0.0-134ffeb

4 years ago

0.0.0-f6570ef

4 years ago

0.0.0-934e221

4 years ago

0.0.0-c4403a3

5 years ago

0.0.0-ec19f0a

5 years ago

0.0.0-323447a

5 years ago

0.0.0-3d7e7f1

5 years ago

0.0.0-a96324d

5 years ago

0.0.0-fb7de86

5 years ago

0.0.0-8e1c4c3

5 years ago

0.0.0-680cd17

5 years ago

0.0.0-ce8703d

5 years ago

0.0.0-da2200c

5 years ago

0.0.0-2d962c3

5 years ago

0.0.0-ed0e34b

5 years ago

0.0.0-9160f0b

5 years ago

0.0.0-5be973f

5 years ago

0.0.0-fc50794

5 years ago

0.0.0-4490b48

5 years ago

0.0.0-1ffea91

5 years ago

0.0.0-2de7d89

5 years ago

0.0.0-fbe022f

5 years ago

0.0.0-584840f

5 years ago

0.0.0-48c3aab

5 years ago

1.5.0

5 years ago

0.0.0-4f47ccb

5 years ago

0.0.0-26034a5

5 years ago

0.0.0-af3d913

5 years ago