File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 44
44
run : export NODE_OPTIONS=--max-old-space-size=6144; npm test
45
45
- name : Test building docs
46
46
run : export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
47
+ - name : Test building examples
48
+ run : |
49
+ cd examples/echo-bot-ts
50
+ npm run build-sdk
51
+ npm install
52
+ npm run build
53
+ cd -
Original file line number Diff line number Diff line change @@ -28,10 +28,14 @@ const client = new messagingApi.MessagingApiClient(clientConfig);
28
28
// Create a new Express application.
29
29
const app : Application = express ( ) ;
30
30
31
+ const isTextEvent = ( event : any ) : event is webhook . MessageEvent & { message : webhook . TextMessageContent } => {
32
+ return event . type === 'message' && event . message && event . message . type === 'text' ;
33
+ } ;
34
+
31
35
// Function handler to receive the text.
32
36
const textEventHandler = async ( event : webhook . Event ) : Promise < MessageAPIResponseBase | undefined > => {
33
37
// Process all variables here.
34
- if ( event . type !== 'message' || ! event . message || event . message . type !== 'text' ) {
38
+ if ( ! isTextEvent ( event ) ) {
35
39
return ;
36
40
}
37
41
You can’t perform that action at this time.
0 commit comments