File tree 2 files changed +18
-8
lines changed
packages/create-twilio-function/templates/typescript/src/functions
2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' create-twilio-function ' : minor
3
+ ---
4
+
5
+ fix hello-world template
Original file line number Diff line number Diff line change @@ -5,25 +5,30 @@ import {
5
5
Context ,
6
6
ServerlessCallback ,
7
7
ServerlessFunctionSignature ,
8
+ ServerlessEventObject ,
8
9
} from '@twilio-labs/serverless-runtime-types/types' ;
9
10
10
11
type MyEvent = {
11
- Body ?: string
12
- }
12
+ Body ?: string ;
13
+ } ;
13
14
14
15
// If you want to use environment variables, you will need to type them like
15
16
// this and add them to the Context in the function signature as
16
17
// Context<MyContext> as you see below.
17
18
type MyContext = {
18
- GREETING ?: string
19
- }
19
+ GREETING ?: string ;
20
+ } ;
20
21
21
- export const handler : ServerlessFunctionSignature = function (
22
+ export const handler : ServerlessFunctionSignature = function (
22
23
context : Context < MyContext > ,
23
- event : MyEvent ,
24
+ event : ServerlessEventObject < MyEvent > ,
24
25
callback : ServerlessCallback
25
26
) {
26
27
const twiml = new Twilio . twiml . VoiceResponse ( ) ;
27
- twiml . say ( `${ context . GREETING ? context . GREETING : 'Hello' } ${ event . Body ? event . Body : 'World' } !` ) ;
28
+ twiml . say (
29
+ `${ context . GREETING ? context . GREETING : 'Hello' } ${
30
+ event . Body ? event . Body : 'World'
31
+ } !`
32
+ ) ;
28
33
callback ( null , twiml ) ;
29
- } ;
34
+ } ;
You can’t perform that action at this time.
0 commit comments