Exemplo n.º 1
0
def on_launch(request_id, session):
    # Welcome the User to the App
    util = Util()
    return Util.build_response(
        util, "",
        Util.build_speechlet_response(util, '', "Welcome to Studio", "",
                                      False))
Exemplo n.º 2
0
 def start_callout(self, phone_num: str, intent: str) -> str:
     # Stars a callout camapaign
     self.valid_input([self.api_key, phone_num])
     print("Starting Callout")
     data = requests.post(self.build_url_v2(self.api_key, phone_num))
     print(data)
     util = Util()
     return Util.build_response(
         util, "",
         Util.build_speechlet_response(util, intent,
                                       "Starting Campaign" + '', "", True))
Exemplo n.º 3
0
 def list_all_scripts(self, intent: str) -> str:
     # Lists all the available scripts
     self.retrieve_token()
     self.valid_input([self.token])
     print("Listing Scripts")
     # List Scripts
     payload = {'token': self.token}
     data = requests.post(self.build_url('script', 'list-all'),
                          data=payload)
     print(data)
     util = Util()
     try:
         data = json.loads(data.text)['result']['error']['message']
         print(data)
         return Util.build_response(
             util, "",
             Util.build_speechlet_response(util, intent, data, "", True))
     except Exception:
         print("Failed")
         return Util.build_response(
             util, "",
             Util.build_speechlet_response(util, intent, "Failed", "",
                                           True))
Exemplo n.º 4
0
 def run_workflow(self, workflow_id: str, intent: str) -> str:
     # Runs the workflow that matches the given id
     self.retrieve_token()
     self.valid_input([self.token, workflow_id])
     print("Starting Workflow")
     # Run Workflow
     payload = {'token': self.token, 'workflow_id': workflow_id}
     data = requests.post(self.build_url('workflow', 'run'), data=payload)
     print(data)
     print(json.loads(data.text)['result'])
     util = Util()
     return Util.build_response(
         util, "",
         Util.build_speechlet_response(
             util, intent,
             "Initializing Workflow" + json.loads(data.text)['result'], "",
             True))
Exemplo n.º 5
0
 def update_workflow(self, workflow_id: str, name: str, status: str,
                     intent: str) -> str:
     # updates the workflow given the name and status arguments
     self.retrieve_token()
     self.valid_input([self.token, workflow_id, name, status])
     print("Updating Workflow")
     # Update Workflow
     payload = {
         'token': self.token,
         'workflow_id': workflow_id,
         'name': name,
         'status': status
     }
     data = requests.post(self.build_url('workflow', 'update'),
                          data=payload)
     print(data)
     print(json.loads(data.text)['result']['message'])
     util = Util()
     return Util.build_response(
         util, "",
         Util.build_speechlet_response(
             util, intent, "Updating Workflow" +
             json.loads(data.text)['result']['message'], "", True))
Exemplo n.º 6
0
def on_session_ended(request, session):
    # Say out goodbye to the user of the Alexa Skill
    util = Util()
    return Util.build_response(
        util, "", Util.build_speechlet_response(util, '', "Goodbye", "",
                                                False))