Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

app.js 3.9 KB

You have to be logged in to leave a comment. Sign In
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  1. // This loads the environment variables from the .env file
  2. require('dotenv-extended').load();
  3. var builder = require('botbuilder');
  4. var restify = require('restify');
  5. // Setup Restify Server
  6. var server = restify.createServer();
  7. server.listen(process.env.port || process.env.PORT || 3978, function () {
  8. console.log('%s listening to %s', server.name, server.url);
  9. });
  10. // Create chat bot and listen to messages
  11. var connector = new builder.ChatConnector({
  12. appId: process.env.MICROSOFT_APP_ID,
  13. appPassword: process.env.MICROSOFT_APP_PASSWORD
  14. });
  15. server.post('/api/messages', connector.listen());
  16. // Bot setup
  17. var bot = new builder.UniversalBot(connector, function (session) {
  18. var cards = getCardsAttachments();
  19. // create reply with Carousel AttachmentLayout
  20. var reply = new builder.Message(session)
  21. .attachmentLayout(builder.AttachmentLayout.carousel)
  22. .attachments(cards);
  23. session.send(reply);
  24. });
  25. function getCardsAttachments(session) {
  26. return [
  27. new builder.HeroCard(session)
  28. .title('Azure Storage')
  29. .subtitle('Offload the heavy lifting of data center management')
  30. .text('Store and help protect your data. Get durable, highly available data storage across the globe and pay only for what you use.')
  31. .images([
  32. builder.CardImage.create(session, 'https://docs.microsoft.com/en-us/azure/storage/media/storage-introduction/storage-concepts.png')
  33. ])
  34. .buttons([
  35. builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/storage/', 'Learn More')
  36. ]),
  37. new builder.ThumbnailCard(session)
  38. .title('DocumentDB')
  39. .subtitle('Blazing fast, planet-scale NoSQL')
  40. .text('NoSQL service for highly available, globally distributed apps—take full advantage of SQL and JavaScript over document and key-value data without the hassles of on-premises or virtual machine-based cloud database options.')
  41. .images([
  42. builder.CardImage.create(session, 'https://docs.microsoft.com/en-us/azure/documentdb/media/documentdb-introduction/json-database-resources1.png')
  43. ])
  44. .buttons([
  45. builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/documentdb/', 'Learn More')
  46. ]),
  47. new builder.HeroCard(session)
  48. .title('Azure Functions')
  49. .subtitle('Process events with a serverless code architecture')
  50. .text('An event-based serverless compute experience to accelerate your development. It can scale based on demand and you pay only for the resources you consume.')
  51. .images([
  52. builder.CardImage.create(session, 'https://azurecomcdn.azureedge.net/cvt-5daae9212bb433ad0510fbfbff44121ac7c759adc284d7a43d60dbbf2358a07a/images/page/services/functions/01-develop.png')
  53. ])
  54. .buttons([
  55. builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/functions/', 'Learn More')
  56. ]),
  57. new builder.ThumbnailCard(session)
  58. .title('Cognitive Services')
  59. .subtitle('Build powerful intelligence into your applications to enable natural and contextual interactions')
  60. .text('Enable natural and contextual interaction with tools that augment users\' experiences using the power of machine-based intelligence. Tap into an ever-growing collection of powerful artificial intelligence algorithms for vision, speech, language, and knowledge.')
  61. .images([
  62. builder.CardImage.create(session, 'https://azurecomcdn.azureedge.net/cvt-68b530dac63f0ccae8466a2610289af04bdc67ee0bfbc2d5e526b8efd10af05a/images/page/services/cognitive-services/cognitive-services.png')
  63. ])
  64. .buttons([
  65. builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/cognitive-services/', 'Learn More')
  66. ])
  67. ];
  68. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...