/
index.js
34 lines (26 loc) · 933 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require('@ciscospark/internal-plugin-board');
require('@ciscospark/internal-plugin-conversation');
const CiscoSpark = require('@ciscospark/spark-core').default;
const spark = new CiscoSpark({
credentials: {
authorization: {
access_token: process.env.CISCOSPARK_ACCESS_TOKEN
}
}
});
// register the device is necessary
spark.internal.device.register()
// list all of the conversations and choose one to get boards from.
.then(() => spark.internal.conversation.list())
// choose a conversations
.then((conversations) => conversations[0])
// create a new board
.then((conversation) => spark.internal.board.createChannel(conversation))
// display the board
.then((board) => {
console.log('================= BOARD ================');
console.log(board);
console.log('================= BOARD ================');
return board;
})
.then(() => spark.internal.device.unregister())