-
Notifications
You must be signed in to change notification settings - Fork 2
/
Echo.js
33 lines (32 loc) · 1.06 KB
/
Echo.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
/**
*
* This action will take an inbound message (that was not generated by this app)
* and return a response message if the content matches specific criteria.
*
* The inbound params should contain the following properties:
* myEvent - Bool - Was the message generated by this app. Use this to avoid message loops
* spaceId - string - the space that the message originated from
* content - string - the content of the message
*
* The results are intended to be input for the WWSendMessage action:
* spaceId - string - the target space for the new message
* title - string - the title used for the new message
* text: - string - the text for the new message
*
*/
function main(params) {
if (params.hasOwnProperty("content") &&
params.content.toLowerCase().startsWith("can you echo") &&
params.hasOwnProperty("spaceId")) {
return {
spaceId: params.spaceId,
title: "From Echo Bot",
actor: { name: "Cloud Functions"},
text: "Why yes I can!"
}
} else {
return Promise.reject({
status: "nothing to see here"
})
}
}