From 0879513bd2991caebe1e5d348964a6978374fb53 Mon Sep 17 00:00:00 2001 From: Andre Lars Da Cunha Date: Fri, 24 Jan 2025 14:43:33 +0100 Subject: [PATCH 1/2] fix(create-twilio-function): fix hello-world template --- .../typescript/src/functions/hello-world.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts b/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts index b06ce621..8e0b6f44 100644 --- a/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts +++ b/packages/create-twilio-function/templates/typescript/src/functions/hello-world.ts @@ -5,25 +5,30 @@ import { Context, ServerlessCallback, ServerlessFunctionSignature, + ServerlessEventObject, } from '@twilio-labs/serverless-runtime-types/types'; type MyEvent = { - Body?: string -} + Body?: string; +}; // If you want to use environment variables, you will need to type them like // this and add them to the Context in the function signature as // Context as you see below. type MyContext = { - GREETING?: string -} + GREETING?: string; +}; -export const handler: ServerlessFunctionSignature = function( +export const handler: ServerlessFunctionSignature = function ( context: Context, - event: MyEvent, + event: ServerlessEventObject, callback: ServerlessCallback ) { const twiml = new Twilio.twiml.VoiceResponse(); - twiml.say(`${context.GREETING ? context.GREETING : 'Hello'} ${event.Body ? event.Body : 'World'}!`); + twiml.say( + `${context.GREETING ? context.GREETING : 'Hello'} ${ + event.Body ? event.Body : 'World' + }!` + ); callback(null, twiml); -}; \ No newline at end of file +}; From 141da11abaae1fe4fb763e99c2c385ba89b5a39f Mon Sep 17 00:00:00 2001 From: Andre Lars Da Cunha Date: Fri, 24 Jan 2025 14:48:59 +0100 Subject: [PATCH 2/2] fix(create-twilio-function): add changeset --- .changeset/sour-impalas-sing.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sour-impalas-sing.md diff --git a/.changeset/sour-impalas-sing.md b/.changeset/sour-impalas-sing.md new file mode 100644 index 00000000..ef8a72b1 --- /dev/null +++ b/.changeset/sour-impalas-sing.md @@ -0,0 +1,5 @@ +--- +'create-twilio-function': minor +--- + +fix hello-world template