You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API/components/chat.md
+15-55Lines changed: 15 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,18 +109,21 @@ Fliplet.Hooks.on('beforeChatContactsRendering', function onBeforeChatContactsRen
109
109
The `beforeChatContactsRendering` hook explained above can be useful to modify the contacts list data. In the example below we will add the url from files in the File Manager, by comparing their name to the name entered in the data source's column called "Image". The code seems complex because we are also taking into consideration that the data source column can contain urls, base64 strings and file ids:
You can get the list of public channel for a chat using the following method:
311
314
312
315
```js
313
-
Fliplet.Chat.get().then(function (chat) {
314
-
returnchat.channels.get();
315
-
}).then(function (channels) {
316
-
console.log(channels);
317
-
});
316
+
constchannels=awaitchat.channels.get();
318
317
```
319
318
320
319
### Create a channel
321
320
322
321
Channels can be created by simply running this simple snippet via custom code (or by running it in the console). Make sure to change the channel name with the actual words you want to use:
323
322
324
323
```js
325
-
Fliplet.Chat.get().then(function (chat) {
326
-
returnchat.channels.create('My channel name');
327
-
}).then(function (channel) {
328
-
// Channel has been created
329
-
});
330
-
```
331
-
332
-
<pclass="quote">Please note that <strong>the above snippet only works in a screen with a chat component</strong>. If you want to create a channel from a different screen please use the low-level JS API that follows.</p>
0 commit comments