forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
29 lines (25 loc) · 1 KB
/
index.ts
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
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as pulumi from "@pulumi/pulumi";
import * as twilo from "./twilio";
const config = new pulumi.Config();
const phoneNumberSid = config.require("phoneNumberSid");
const handler = new twilo.IncomingPhoneNumber("twilio-example", {
phoneNumberSid: phoneNumberSid,
handler: async p => {
return {
statusCode: 200,
headers: {
"Content-Type": "text/plain",
},
body: `Made with \u2764 and Pulumi.`,
};
},
});
// We export the SMS URL, for debugging, you can post messages to it with curl to test out your handler without
// having to send an SMS. For example:
//
// $ curl -X POST -d "From=+12065555555" -d "Body=Hello!" $(pulumi stack output smsUrl)
//
// There are many additional properties you can provide which will be decoded and presented to your handler,
// see: https://www.twilio.com/docs/sms/twiml#request-parameters
export const smsUrl = handler.smsUrl;