differentiate Twilio TwiML app name between environments
This commit is contained in:
parent
549558142d
commit
9079ed73ac
@ -30,7 +30,7 @@ const setTwilioWebhooks = Queue<Payload>("api/queue/set-twilio-webhooks", async
|
|||||||
.applications.get(organization.twimlAppSid)
|
.applications.get(organization.twimlAppSid)
|
||||||
.fetch()
|
.fetch()
|
||||||
: await twilio(organization.twilioAccountSid, organization.twilioAuthToken).applications.create({
|
: await twilio(organization.twilioAccountSid, organization.twilioAuthToken).applications.create({
|
||||||
friendlyName: "Shellphone",
|
friendlyName: getTwiMLName(),
|
||||||
smsUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/incoming-message`,
|
smsUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/incoming-message`,
|
||||||
smsMethod: "POST",
|
smsMethod: "POST",
|
||||||
voiceUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/incoming-call`,
|
voiceUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/incoming-call`,
|
||||||
@ -52,4 +52,15 @@ const setTwilioWebhooks = Queue<Payload>("api/queue/set-twilio-webhooks", async
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getTwiMLName() {
|
||||||
|
switch (serverRuntimeConfig.app.baseUrl) {
|
||||||
|
case "local.shellphone.app":
|
||||||
|
return "Shellphone LOCAL";
|
||||||
|
case "dev.shellphone.app":
|
||||||
|
return "Shellphone DEV";
|
||||||
|
case "www.shellphone.app":
|
||||||
|
return "Shellphone";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default setTwilioWebhooks;
|
export default setTwilioWebhooks;
|
||||||
|
Loading…
Reference in New Issue
Block a user