I am setting up a phone tree using twilio and python. I am trying to get the name of a queue which is to send an agent with an SMS alert. I've gathered that the name of the queue This section This section tells the caller in their status queue, captures music, sends an SMS message. Where is currently Thanks! It turns out that I need to use Twilio & lt; Enqueue & gt; There is a noun within the verb but nothing can be found about how to get that name code.
& lt; Assemble & gt; Answers the verb and specifies the caller in the queue based on what they had entered.
@Apple Root ('/ open', methods = ['post']) DEF open (): response = twiml.response () if request.form ['digit'] == "1": response.enqueue ("normal", Waiting URL = "/ Waiting") Elif Request. Format ['digit'] == "2": reaction. ("Current", wait URL = "/ wait") return str (feedback);
request.form ['QueueSid'] , where I want to place the queue "friendly name" - for example, "normal".
@Apple Route ('/ wait', methods = ['post']) Def wait (): response = twiml.response () response.say ("You are in% s queue."% Request.form ['Position Position'] ) Response. Play ("http://com.twilio.music.classical.s3.amazonaws.com/BusyStrings.mp3") account_sid = "*****" auth_token = "*****" Client = TwilioRestClient (account_sid, Auth_token) from client.sms.messages.create (= "+ 15555555555", _ = "+ 15555555554", body = "caller call is in queue -% (queue) s"% {"in line] Num "}: request.form ['from']," line ": request.form ['queueid']}) return str (feedback)
customers Get queue details based on your SID. Among the details I was looking for,
friendly_name . The solution is the updated code -
@ app.route ('/ wait', methods = ['POST']) def wait (): response = twiml.response () response. ("You are% s in queue."% Request.form ['QueuePosition']) response.play ("http://com.twilio.music.classical.s3.amazonaws.com/BusyStrings.mp3") Account_sid = "*****" auth_token = "*****" Client = TwilioRestClient (account_sid, auth_token) queue = client.queues.get (request.form ['queueSid']) # CID friendly name based on queue = Queue.friendly_name; From the client.sms.messages.create (= "+ 15555555555", _ = "+ 15555555554", body = "Caller in the call queue - # (num) s in queue% (Queue) caller id and queue favorable name # sms with return string (response) Hope that "% {" num ": request.form ['from']," Queue ": friendlyName}) This helps someone .. :)
No comments:
Post a Comment