File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
packages/create-twilio-function/templates/typescript/src/functions Expand file tree Collapse file tree 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 {
55 Context ,
66 ServerlessCallback ,
77 ServerlessFunctionSignature ,
8+ ServerlessEventObject ,
89} from '@twilio-labs/serverless-runtime-types/types' ;
910
1011type MyEvent = {
11- Body ?: string
12- }
12+ Body ?: string ;
13+ } ;
1314
1415// If you want to use environment variables, you will need to type them like
1516// this and add them to the Context in the function signature as
1617// Context<MyContext> as you see below.
1718type MyContext = {
18- GREETING ?: string
19- }
19+ GREETING ?: string ;
20+ } ;
2021
21- export const handler : ServerlessFunctionSignature = function (
22+ export const handler : ServerlessFunctionSignature = function (
2223 context : Context < MyContext > ,
23- event : MyEvent ,
24+ event : ServerlessEventObject < MyEvent > ,
2425 callback : ServerlessCallback
2526) {
2627 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+ ) ;
2833 callback ( null , twiml ) ;
29- } ;
34+ } ;
You can’t perform that action at this time.
0 commit comments