@koredev/kore-web-sdk 10.1.0-rc.d07c327 → 10.1.0-rc.dce2a56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # Kore.ai SDK
2
+ Kore.ai offers Bots SDKs as a set of platform-specific client libraries that provide a quick and convenient way to integrate Kore.ai Bots chat capability into custom applications.
3
+
4
+ With just few lines of code, you can embed our Kore.ai chat widget into your applications to enable end-users to interact with your applications using Natural Language. For more information, refer to
5
+
6
+ [Bot SDKs](https://developer.kore.ai/docs/bots/kore-web-sdk/)
7
+
8
+ [Web Socket Endpoints and Events](https://developer.kore.ai/docs/bots/sdks/bots-platform-api-reference/)
9
+
10
+ [SDK Security](https://developer.kore.ai/docs/bots/sdks/user-authorization-and-assertion/)
11
+
12
+ [SDK App Registration](https://developer.kore.ai/docs/bots/sdks/sdk-app-registration/)
13
+
14
+ [Message Templates](https://developer.kore.ai/docs/bots/sdks/message-templates/)
15
+
16
+ [API Referernce](https://rajasekharba-kore.github.io/web-kore-sdk/)
17
+
18
+
19
+ ## 💡 Getting Started
20
+
21
+ First, install kore web SDK via the [npm](https://www.npmjs.com/get-npm) package manager:
22
+
23
+ ```bash
24
+ npm install --save kore-web-sdk
25
+ ```
26
+
27
+ Get chatWindow and chatConfig
28
+
29
+ ```js
30
+ import { chatConfig, chatWindow } from 'kore-web-sdk';
31
+
32
+ ```
33
+ Configure ChatConfig
34
+
35
+
36
+
37
+ ```js
38
+
39
+ let botOptions=chatConfig.botOptions;
40
+
41
+ botOptions.JWTUrl = "PLEASE_ENTER_JWTURL_HERE";
42
+ botOptions.userIdentity = 'PLEASE_ENTER_USER_EMAIL_ID';// Provide users email id here
43
+ botOptions.botInfo = { name: "PLEASE_ENTER_BOT_NAME", "_id": "PLEASE_ENTER_BOT_ID" }; // bot name is case sensitive
44
+ botOptions.clientId = "PLEASE_ENTER_CLIENT_ID";
45
+ botOptions.clientSecret = "PLEASE_ENTER_CLIENT_SECRET";
46
+ /*
47
+ Important Note: These keys are provided here for quick demos to generate JWT token at client side but not for Production environment.
48
+ Refer below document for JWT token generation at server side. Client Id and Client secret should maintained at server end.
49
+ https://developer.kore.ai/docs/bots/sdks/user-authorization-and-assertion/
50
+ **/
51
+
52
+ ```
53
+
54
+
55
+ Create chat window instance and trigger show method
56
+ ```js
57
+ var chatWindowInstance = new chatWindow(chatConfig);
58
+ chatWindowInstance.show(chatConfig);
59
+
60
+ ```
61
+ ### Examples
62
+ Click [here](/docs/sdkdeveloper) to explore different variations how SDK can be consumed
63
+
64
+ ### Other options
65
+ <details>
66
+ <summary>Legacy</summary>
67
+
68
+ include the following script in your html file and configure bot configurations
69
+
70
+ ```js
71
+
72
+ <script src="https://cdn.jsdelivr.net/npm/kore-web-sdk@10.1.0/dist/umd/kore-web-sdk-umd-chat.min.js"></script>
73
+ <script>
74
+ //chat window declaration
75
+ var chatConfig=KoreChatSDK.chatConfig;
76
+ var chatWindow=KoreChatSDK.chatWindow;
77
+
78
+ //create chat window instance
79
+ var chatWindowInstance = new chatWindow();
80
+
81
+ //configure bot configurations
82
+ var botOptions=chatConfig.botOptions;
83
+ botOptions.JWTUrl = "PLEASE_ENTER_JWTURL_HERE";
84
+ botOptions.userIdentity = 'PLEASE_ENTER_USER_EMAIL_ID';
85
+ botOptions.botInfo = { name: "PLEASE_ENTER_BOT_NAME", "_id": "PLEASE_ENTER_BOT_ID" }; // bot name is case sensitive
86
+ botOptions.clientId = "PLEASE_ENTER_CLIENT_ID";
87
+ botOptions.clientSecret = "PLEASE_ENTER_CLIENT_SECRET";
88
+ /*
89
+ Important Note: These keys are provided here for quick demos to generate JWT token at client side but not for Production environment.
90
+ Refer below document for JWT token generation at server side. Client Id and Client secret should maintained at server end.
91
+ https://developer.kore.ai/docs/bots/sdks/user-authorization-and-assertion/
92
+ **/
93
+
94
+ //show chatwindow
95
+ chatWindowInstance.show(chatConfig);
96
+
97
+ </script>
98
+
99
+ ```
100
+
101
+ </details>
102
+
103
+
104
+ <details>
105
+ <summary>For quick demo</summary>
106
+
107
+
108
+
109
+ #### Instructions
110
+ 1.Open examples/umd/chat-with-plugins/index.html
111
+ 2.configure bot configurations
112
+ 3.Open same file in any browser
113
+
114
+
115
+
116
+
117
+ </details>
118
+
119
+ ## 💡 Custom Templates
120
+
121
+ In addition to the kore message templates, new custom templates can be intstalled into kore chat window with *installTemplate* method
122
+
123
+ ```bash
124
+ class customTemplateComponent{
125
+ renderMessage(msgData){
126
+ if(msgData?.message[0]?.component?.payload?.template_type==='custom_stock_template'){
127
+ return '<h2>My Template HTML</h2>';
128
+ }else{
129
+ return false;
130
+ }
131
+ }
132
+ }
133
+
134
+ chatWindowInstance.templateManager.installTemplate(new customTemplateComponent());
135
+ ```
136
+ Other framework UI components like angular and react can also be injected with this
137
+
138
+ ## 💡 Plugins
139
+
140
+ Kore's chatwindow functionlity can be extended with the help of plugins.Newly created plugins can be installed with *installPlugin* method
141
+
142
+ ```bash
143
+ class KoreCustomPlugin{
144
+
145
+ }
146
+
147
+ chatWindowInstance.installPlugin(new KoreCustomPlugin());
148
+ ```
149
+ Kore offered plugins are listed [here](./docs/plugins)
150
+
151
+