1
관리자 전화 번호로 경고 SMS를 보내고 로컬 언어 버전의 STOP 응답을 사용하여 원래 SMS에 답장하려고합니다. 이 번호에 대한 자동 응답 해제).Twilio 기능 : STOP 요청을 처리하기 위해 들어오는 SMS 경고를 보내려고합니다.
아래 코드는 orignator에게 응답을 보내는 데 사용되지만 원하는 번호 (현재 + 447824636xxx)로 경고 SMS를 보내지 않습니다.
Twilio 기능에서 어떻게 작동하는지 도움말 문서, StackOverflow 또는 Google Twilio 개발자 그룹에서 찾을 수없는 항목이 있습니다.
강조 표시된 코드를 얻는 방법을 알려주십시오.
exports.handler = function(context, event, callback) {
console.log ("Incoming SMS")
console.log (event.From)
console.log (event.Body)
if (event.Body == "STOP" || event.Body == "Stop" || event.Body == "stop") {
console.log ("Received a STOP message")
// ***** BELOW CODE DOES NOT SEND SMS ****
// Send a warning message to Chloe
let client = context.getTwilioClient()
let c = client.messages.create({
body: "We have a STOP message on Fresenius NO from ",
to: "+447824636xxx",
from: event.To
})
// ***** ABOVE CODE DOES NOT SEND ANYTHING *****
console.log ("Sent warning to Admin")
// Respond to the user/patient with STOP message in local language
let twiml = new Twilio.twiml.MessagingResponse();
twiml.message("Du har nå meldt deg av MyFresubin og vil ikke motta flere meldinger fra dette nummeret.");
twiml.message.to = event.From
twiml.message.from = "+4759444xxx"
callback(null, twiml);
}
else {callback(null)}
}