Esempio n. 1
0
  @OnAlias("update")
  public void update(TeamchatAPI api) {
    zd =
        new Zendesk.Builder("https://teamchat.zendesk.com") // Zendesk account id
            .setUsername("*****@*****.**") // email of zendesk account
            .setPassword("webaroo")
            .build(); // or setToken("0cf1d94606")

    String upCom = api.context().currentReply().getField("upCom");

    // Getting existing ticket id associated with formid
    String[] data = ticketData.getData(api.context().currentReply().getFormId());
    String ticketId = data[2];

    // Creating or getting existing ticket by it id, Only Admin
    Ticket t = zd.getTickets(Long.parseLong(ticketId)).get(0);
    Comment c = new Comment();
    c.setBody(upCom);
    t.setComment(c);

    // updating existing ticket in out database
    zd.updateTicket(t);
    System.out.println("Tested");
    //		zd.getTicketComments(Long.parseLong(ticketId));
    //		Room r = api.context().byId(roomId);
    //		Chatlet cer = api.context().chatletById(formId);
    //		Reply rep = cer.createReply().addField("upCom", upCom);
    //		api.perform(r.reply(rep));

  }
Esempio n. 2
0
  @OnKeyword("help")
  public void help(TeamchatAPI api) {

    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestionHtml(
                        "<h4><b>Hi, I'm Pingdom Bot.</b></h4>"
                            + "<img src=\"http://monitorama.com/2014/images/logo_pingdom.png\" height=\"90\" width=\"230\">"
                            + "<br />"
                            + "<br /><b>You can use me to check the status of your website, using following keywords:</b>"
                            + "<br />"
                            + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:black\";><b>ping - </b></a1><a2 style=\"color:#359FD8\";>"
                            + "Type this command to Check the status for your website added in your pingdom account."
                            + "</a2></li><li><a3 style=\"color:black\";><b>addcheck - </b></a3><a4 style=\"color:#359FD8\";>"
                            + "Type this command to create any check i.e to add any website in your pingdom account."
                            + "</a4></li><li><a5 style=\"color:black\";><b>deletecheck - </b></a5><a6 style=\"color:#359FD8\";>"
                            + "Type this command to delete any check i.e to delete any website in your pingdom account."
                            + "</a6></li><li><a7 style=\"color:black\";><b>login - </b></a5><a6 style=\"color:#359FD8\";>"
                            + "Type this command if you are logging for the first time from this room or you want to log in from other account."
                            + "</a6></li><li><a7 style=\"color:black\";><b>logout - </b></a7><a8 style=\"color:#359FD8\";>"
                            + "Type this command to log out from your existing account."
                            + "</a8></li></ul>")));

    // list of keywords
    // 1.)ping
    // 2.)add
    // 3.)delete

  }
Esempio n. 3
0
  @OnKeyword("tcsupport")
  public void support(TeamchatAPI api) {

    zd =
        new Zendesk.Builder("https://teamchat.zendesk.com") // Zendesk account id
            .setUsername("*****@*****.**") // email of zendesk account
            .setPassword("webaroo")
            .build(); // or setToken("0cf1d94606")

    // Setting up Trigger
    // trigger ();

    Form f = api.objects().form();
    f.addField(api.objects().input().label("Subject").name("subject"));
    f.addField(api.objects().input().label("Comment").name("comment"));
    f.addField(api.objects().input().label("Contact No.").name("contact"));

    PrimaryChatlet prime = new PrimaryChatlet();
    prime
        .setQuestionHtml(
            "<img src=\"http://p3.zdassets.com/hc/settings_assets/481529/200038422/Q2xRKEc55HY0Oxq8hxzRaw-teamchatsupportlogo.png\" height=\"90\" width=\"230\">"
                + "<br /><b>Enter your query below:</b>")
        .setReplyScreen(f)
        .setReplyLabel("Enter")
        .setDetailsLabel("Queries")
        .showDetails(true)
        .alias("query");

    api.perform(api.context().currentRoom().post(prime));
  }
  @OnAlias("selectedproject")
  public void select_story(TeamchatAPI api) {
    String[] Project = api.context().currentReply().getField("project_name").split("-");
    pid = Long.valueOf(Project[Project.length - 1]);
    String URL = "https://www.pivotaltracker.com/services/v5/projects/" + pid + "/stories";
    String URL_parameter = "";
    SendGet sg = new SendGet();
    Field field_story = null;
    try {
      String jsonData = sg.sendGet(URL, USER_AGENT, URL_parameter, pb.getAccess_token());

      Gson gson = new Gson();
      Data[] Story = gson.fromJson(jsonData, Data[].class);

      field_story = api.objects().select().name("story_name").label("Story");
      for (Data story : Story) {
        field_story.addOption(story.getName() + "-" + story.getId());
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestion("Select story to be deleted")
                    .setReplyScreen(api.objects().form().addField(field_story))
                    .alias("deleteselectedstory")));
  }
  @OnKeyword("Notification")
  public void Notification(TeamchatAPI api) {

    String URL = "https://www.pivotaltracker.com/services/v5/my/notifications";
    String URL_parameter = "envelope=true";
    Database_Handler db = new Database_Handler();
    pb = db.GetBasicStuff(api.context().currentSender().getEmail());
    SendGet sg = new SendGet();
    // list of messages
    String responseHTML = "";
    @SuppressWarnings("unused")
    Field f = null;
    try {
      String jsonData = sg.sendGet(URL, USER_AGENT, URL_parameter, pb.getAccess_token());
      @SuppressWarnings("unused")
      Gson gson = new Gson();
      JSONArray jsonArray = new JSONObject(jsonData).getJSONArray("data");
      for (int i = 0; i < jsonArray.length(); i++) {
        responseHTML += jsonArray.getJSONObject(i).get("message").toString() + "<br />";
      }
      System.out.println("Notifications are:" + responseHTML);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    api.perform(
        api.context().currentRoom().post(new PrimaryChatlet().setQuestionHtml(responseHTML)));
  }
Esempio n. 6
0
 @OnKeyword("help")
 public void box(TeamchatAPI api) {
   api.perform(
       api.context()
           .currentRoom()
           .post(
               new PrimaryChatlet().setQuestionHtml("'Share' - Share multiple file or folders")));
 }
Esempio n. 7
0
  // communicating with pingdomintegrator class
  @OnAlias("sendreqdel")
  public void sendreqdel(TeamchatAPI api) throws IOException {

    int i;
    String chks[] = new String[count - 1];
    int s = 1;
    for (i = 0; i < count - 1; i++) {

      chks[i] = api.context().currentReply().getField("Checks" + String.valueOf(s));
      s++;
    }

    s = 1;
    url = "https://api.pingdom.com/api/2.0/checks";
    pingdomintegrator ob1 = new pingdomintegrator();

    String resp = ob1.getChecks(Username, Password, App_key, url);
    Gson gson = new Gson();
    Checks checks = gson.fromJson(resp, Checks.class);

    int k = 0;

    int del[] = new int[count - 1];

    for (Check check : checks.getChecks()) {
      if (check.getHostname().equals(chks[k])) {

        del[k] = check.getId();
      } else {

        del[k] = 1;
      }
      k++;
    }

    k = 1;

    String respdel = ob1.delChecks(Username, Password, App_key, del);

    if (respdel.equals("Error")) {
      PrimaryChatlet prime = new PrimaryChatlet();
      api.perform(
          api.context()
              .currentRoom()
              .post(
                  prime.setQuestionHtml(
                      "<br /><b>Error :</b>"
                          + "<br /><b>Status Code: 403</b>"
                          + "<br /><b>StatusDesc: Forbidden</b>"
                          + "<br /><b>Something went wrong!</b>")));

    } else {
      PrimaryChatlet prime = new PrimaryChatlet();
      api.perform(
          api.context().currentRoom().post(prime.setQuestionHtml("<br /><b>" + respdel + "</b>")));
    }
  }
  @OnAlias("createproject")
  public void create_project(TeamchatAPI api) throws IOException {
    String ProjectName = api.context().currentReply().getField("project_name");

    String[] Account = api.context().currentReply().getField("account_name").split("-");
    long id = Long.valueOf(Account[Account.length - 1]);
    System.out.println(id);
    String URL = "https://www.pivotaltracker.com/services/v5/projects",
        URL_parameter = "name=" + ProjectName + "&account_id=" + id;
    new SendPost().sendPost(URL, USER_AGENT, URL_parameter, pb.getAccess_token());
    api.perform(api.context().currentRoom().post(new TextChatlet("Project Created!")));
  }
  @OnAlias("deleteselectedstory")
  public void delete_task(TeamchatAPI api) {

    String[] Project = api.context().currentReply().getField("story_name").split("-");
    long id = Long.valueOf(Project[Project.length - 1]);
    String URL = "https://www.pivotaltracker.com/services/v5/projects/" + pid + "/stories/" + id;
    String URL_parameter;
    URL_parameter = "";
    SendDelete sd = new SendDelete();
    sd.sendDelete(URL, USER_AGENT, URL_parameter, pb.getAccess_token());
    api.perform(api.context().currentRoom().post(new TextChatlet("Story Deleted!")));
  }
Esempio n. 10
0
  @OnAlias("getdatafeed")
  public void getdatafeed(TeamchatAPI api) {

    zd =
        new Zendesk.Builder("https://teamchat.zendesk.com") // Zendesk account id
            .setUsername("*****@*****.**") // email of zendesk account
            .setPassword("webaroo")
            .build(); // or setToken("0cf1d94606")

    api.perform(api.context().currentRoom().post(new TextChatlet("Thank You !!")));

    DBHandler datacng = new DBHandler();

    String Tkt = api.context().currentReply().getField("TicketID");
    String rate = api.context().currentReply().getField("Rating");
    String rcom = api.context().currentReply().getField("rcomment");

    System.out.println(Tkt);
    System.out.println(rate);
    System.out.println(rcom);

    try {
      datacng.stmt.executeUpdate(
          "UPDATE "
              + datacng.configProps.getProperty("dbname").trim()
              + "."
              + datacng.configProps.getProperty("tablename").trim()
              + " SET rating ='"
              + rate
              + "'"
              + ",Rcomment ='"
              + rcom
              + "'"
              + " where ticketId='"
              + Tkt
              + "'");
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    Ticket t = zd.getTicket(Long.parseLong(Tkt));
    SatisfactionRating sr = new SatisfactionRating();
    sr.setScore(rate);
    sr.setComment(rcom);
    t.setSatisfactionRating(sr);

    // updating existing ticket in out database
    zd.updateTicket(t);
    System.out.println("Tested");
  }
 public static Field getOptions(TeamchatAPI api, String[] name) {
   Field f = api.objects().select().label("Buckets").name("bucket");
   for (int i = 0; i < name.length; i++) {
     f.addOption(name[i]);
   }
   return f;
 }
Esempio n. 12
0
  @OnKeyword("login")
  public void login(TeamchatAPI api) {

    Form f = api.objects().form();
    f.addField(api.objects().input().label("Username").name("Username"));
    f.addField(api.objects().input().label("Password").name("Password"));
    f.addField(api.objects().input().label("App_key").name("App_key"));

    PrimaryChatlet prime = new PrimaryChatlet();
    prime
        .setQuestionHtml("<h4><b>Enter your login credentials :</b></h4>")
        .setReplyScreen(f)
        .setReplyLabel("Enter")
        .alias("setdata");

    api.perform(api.context().currentRoom().post(prime));
  }
Esempio n. 13
0
 @OnKeyword(value = "help")
 public void help(TeamchatAPI api) {
   api.perform(
       api.context()
           .currentRoom()
           .post(
               new PrimaryChatlet()
                   .setQuestionHtml(
                       "<h4><b>Hi, I'm Room Bot.</b></h4>"
                           + "<img src=\"https://slack.global.ssl.fastly.net/1e47/plugins/room/assets/service_128.png\" height=\"120\" width=\"120\">"
                           + "<br />"
                           + "<br /><b>I'll help you to interact with your friends or relatives with the help of video chat.</b>"
                           + "<br />"
                           + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:black\";><b>Room - </b></a1><a2 style=\"color:#359FD8\";>"
                           + "Use This keyword to continue with video chat"
                           + "</a2></li></ul>")));
 }
  @OnKeyword("Deletestory")
  public void deleteStory(TeamchatAPI api) {
    Database_Handler db = new Database_Handler();
    pb = db.GetBasicStuff(api.context().currentSender().getEmail());
    GetProjects gp = new GetProjects();
    Field f = null;
    f = gp.getProject(pb.getAccess_token(), api);

    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestion("Select project in which the story exists")
                    .setReplyScreen(api.objects().form().addField(f))
                    .alias("selectedproject")));
  }
  @OnKeyword("Deleteproject")
  public void deleteProject(TeamchatAPI api) throws ClientProtocolException, IOException {
    Database_Handler db = new Database_Handler();
    pb = db.GetBasicStuff(api.context().currentSender().getEmail());
    GetProjects gp = new GetProjects();
    Field f = null;
    f = gp.getProject(pb.getAccess_token(), api);

    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestion("Select project to be deleted")
                    .setReplyScreen(api.objects().form().addField(f))
                    .alias("deleteproject")));
  }
 @OnAlias("onSelect")
 public void Display(TeamchatAPI api) {
   String bucket = api.context().currentReply().getField("bucket");
   int i;
   for (i = 0; i < name.length; i++) if (name.equals(bucket)) break;
   String id = key[i - 1];
   JSONArray j = RunscopeFetch.getTest(id);
   desc = new String[j.length()];
   rslt = new String[j.length()];
   for (int k = 0; k < j.length(); k++) {
     JSONObject j1 = j.getJSONObject(k);
     desc[k] = j1.getString("name");
     rslt[k] = j1.getString("result");
     api.performPostInCurrentRoom(
         new PrimaryChatlet()
             .setQuestionHtml("<b>" + desc[k] + ":</b><br>" + RunscopeFetch.getResutls(rslt[k])));
   }
 }
Esempio n. 17
0
 @OnAlias(value = "adduser")
 public void adduser(TeamchatAPI api) {
   String Name = api.context().currentReply().getField("Name");
   String EmailId = api.context().currentReply().getField("EmailId");
   String roomlink = api.context().currentReply().getField("roomlink");
   Room roo = api.context().create().setName("RoomBot").add(EmailId);
   api.perform(
       roo.post(
           new PrimaryChatlet()
               .setQuestionHtml(
                   "<h4><b>Room Details:</b></h4>"
                       + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:black\";><b>Contact Person- </b></a1><a2 style=\"color:#359FD8\";>"
                       + Name
                       + "</a2></li></ul>"
                       + "<br /><b>Click on the link below to join the Video Chat.</b>"
                       + "<br /><a href=\""
                       + roomlink
                       + "\"><b style=\"color:#359FD8\";>Go To Room</b></a>")));
 }
 @OnKeyword("onenote")
 public void ononenote(TeamchatAPI api) throws Exception {
   System.out.println(c.configProps.getProperty("client_id"));
   Token.api1 = api;
   api.perform(
       api.context()
           .currentRoom()
           .post(
               new PrimaryChatlet()
                   .setQuestionHtml(
                       "<h4 style=\"display:block;margin:0 auto;\">Login with OneNote</h4>"
                           + "<hr/>"
                           + "<a class=\"login-button\" target=\"_blank\" href=\""
                           + "https://login.live.com/oauth20_authorize.srf?client_id="
                           + c.configProps.getProperty("client_id")
                           + "&scope=office.onenote_update&response_type=token&redirect_uri="
                           + URLEncoder.encode(c.configProps.getProperty("redirect_url"), "UTF-8")
                           + "\" style=\"display: block;box-sizing: border-box; margin: 0 auto;font-size: 21px;color: #fff;padding: 15px;border-radius: 6px;background-color: rgb(128, 57, 123);\">Login</a>")));
 }
 @OnKeyword("select")
 public static void selectBucket(TeamchatAPI api) {
   JSONArray j = RunscopeFetch.getBuckets();
   name = new String[j.length()];
   key = new String[j.length()];
   for (int i = 0; i < j.length(); i++) {
     JSONObject j1 = j.getJSONObject(i);
     name[i] = j1.getString("name");
     key[i] = j1.getString("key");
   }
   Form f = api.objects().form();
   f.addField(getOptions(api, name));
   api.performPostInCurrentRoom(
       new PrimaryChatlet()
           .setQuestionHtml("Select the bucket for which you want results.")
           .setReplyScreen(f)
           .setReplyLabel("Select")
           .alias("onSelect"));
 }
Esempio n. 20
0
  // inserting the data into the database.
  @OnAlias("setdata")
  public void setdata(TeamchatAPI api) throws SQLException {

    String Username = api.context().currentReply().getField("Username");
    String Password = api.context().currentReply().getField("Password");
    String App_key = api.context().currentReply().getField("App_key");

    this.Username = Username;
    this.Password = Password;
    this.App_key = App_key;
    roomId = api.context().currentRoom().getId();
    DBHandler ob4 = new DBHandler();
    boolean flag;
    flag = ob4.roomchk(roomId);
    if (flag == false) {
      DBHandler ob1 = new DBHandler();
      ob1.setData(Username, Password, this.App_key, roomId);
    } else {
      DBHandler datacng = new DBHandler();
      datacng.stmt.executeUpdate(
          "UPDATE Bot.pingdom_auth"
              + " SET username ='******'"
              + ", pass ='******'"
              + ", appkey ='"
              + App_key
              + "'"
              + " where roomId='"
              + roomId
              + "'");
      datacng.conn.close();
    }
    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestionHtml("<h5><b>You are logged in successfully!!</b></h5>")));
  }
Esempio n. 21
0
  @OnKeyword("share")
  public void share(TeamchatAPI api) {
    String roomId = api.context().currentRoom().getId();

    try {
      configProps = loadPropertyFromClasspath("box-config.properties", BoxBot.class);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    String url = configProps.getProperty("server").trim() + "Select.jsp?roomid=" + roomId;

    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestionHtml(
                        "<a href='" + url + "' target=_blank>Select files or folders</a>")));
  }
  @OnAlias("createstory")
  public void create_story(TeamchatAPI api) {
    String StoryName = api.context().currentReply().getField("story_name");
    String Notes = api.context().currentReply().getField("notes");

    String[] Project = api.context().currentReply().getField("project_name").split("-");
    long pid = Long.valueOf(Project[Project.length - 1]);

    String URL = "https://www.pivotaltracker.com/services/v5/projects/" + pid + "/stories";
    String URL_parameter;
    URL_parameter = "name=" + StoryName + "&description=" + Notes;
    SendPost sp = new SendPost();
    try {
      sp.sendPost(URL, USER_AGENT, URL_parameter, pb.getAccess_token());
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    api.perform(api.context().currentRoom().post(new TextChatlet("Story Created!")));
    ;
  }
  @OnKeyword("Createproject")
  public void createProject(TeamchatAPI api) throws IOException {

    Database_Handler db = new Database_Handler();
    pb = db.GetBasicStuff(api.context().currentSender().getEmail());
    GetAccount ga = new GetAccount();
    Field f = null;
    f = ga.getAccount(pb.getAccess_token(), api);
    PrimaryChatlet chtlet =
        new PrimaryChatlet()
            .setQuestion("Fill in details of the project")
            .setReplyScreen(
                api.objects()
                    .form()
                    .addField(api.objects().input().label("Project Name").name("project_name"))
                    .addField(f));

    chtlet.alias("createproject");

    api.performPostInCurrentRoom(chtlet);
  }
Esempio n. 24
0
  @OnKeyword("tcfeed")
  public void feedbackform(TeamchatAPI api) {

    Form fo = api.objects().form();

    fo.addField(api.objects().input().name("TicketID").label("TicketID"));

    fo.addField(
        api.objects().select().name("Rating").label("Rating").addOption("good").addOption("bad"));

    fo.addField(api.objects().input().name("rcomment").label("Comment"));

    PrimaryChatlet prime = new PrimaryChatlet();

    api.perform(
        api.context()
            .currentRoom()
            .post(
                prime
                    .setQuestionHtml(
                        "<h3 style=\"color:black\";><b>Give Us Feedback</b></h3>"
                            + "<br />We value your feedback and product suggestions. While we don't respond to suggestions directly, we do review them. If you'd like to give general feedback about Teamchat support, give your feedback here.")
                    .setReplyScreen(fo)
                    .setReplyLabel("Enter")
                    .alias("getdatafeed")));
  }
Esempio n. 25
0
  @OnAlias("sendreqadd")
  public void sendreqadd(TeamchatAPI api) throws IOException {
    String name = api.context().currentReply().getField("name");
    String host = api.context().currentReply().getField("host");
    String Protocol = api.context().currentReply().getField("Protocol");

    pingdomintegrator ob1 = new pingdomintegrator();

    String resp = ob1.addChecks(Username, Password, App_key, host, name, Protocol);

    if (resp.equals("Error")) {
      PrimaryChatlet prime = new PrimaryChatlet();
      api.perform(
          api.context()
              .currentRoom()
              .post(
                  prime.setQuestionHtml(
                      "<br /><b>Error :</b>"
                          + "<br /><b>Status Code: 403</b>"
                          + "<br /><b>StatusDesc: Forbidden</b>"
                          + "<br /><b>Something went wrong!</b>")));

    } else {

      api.perform(
          api.context()
              .currentRoom()
              .post(new PrimaryChatlet().setQuestionHtml("<br /><b>" + resp + "</b>")));
    }
  }
Esempio n. 26
0
  @OnKeyword("logout")
  public void logout(TeamchatAPI api) throws SQLException {

    String rmid;
    rmid = api.context().currentRoom().getId();

    DBHandler chk = new DBHandler();
    boolean flag;
    flag = chk.roomchk(rmid);
    if (flag == true) {
      DBHandler datacng = new DBHandler();
      datacng.stmt.executeUpdate("DELETE FROM Bot.pingdom_auth" + " WHERE roomId='" + rmid + "'");
      datacng.conn.close();
      PrimaryChatlet prime = new PrimaryChatlet();
      prime.setQuestionHtml("<h5><b>You are successfully logged out!!</b></h5>");
      api.perform(api.context().currentRoom().post(prime));
    } else {
      PrimaryChatlet prime = new PrimaryChatlet();
      prime.setQuestionHtml("<h5><b>You are not logged in!!</b></h5>");
      api.perform(api.context().currentRoom().post(prime));
    }
  }
 @OnKeyword("help")
 public void Login(TeamchatAPI api) {
   Servlet.api = api;
   String intro =
       "Hey this is Runscope Bot. You can use me to view the results of API tests currently assigned to any of your buckets.<table style=width:100%><tr><th>Keywords</th><th>Function</th></tr><tr><td>select</td><td>Select from a list of buckets</td></tr><tr><td>help</td><td>Log in to Runscope</td></tr>You have to log in first to select your buckets.<br>";
   String msg =
       "<a href=https://www.runscope.com/signin/oauth/authorize?response_type=code&client_id="
           + client_id
           + "&redirect_uri="
           + callback_url
           + "&scope=api:read%20account:email%20message:write%20bucket:auth_token%20bucket:write&state=PLACEHOLDER target=_blank>Click here to Login</a>";
   api.performPostInCurrentRoom(new PrimaryChatlet().setQuestionHtml(intro + msg));
 }
Esempio n. 28
0
 @OnKeyword(value = "Room")
 public void Room(TeamchatAPI api) {
   Form fo = api.objects().form();
   fo.addField(api.objects().input().name("Name").label("Your Name:"));
   fo.addField(api.objects().input().name("roomlink").label("Room Link:"));
   fo.addField(api.objects().input().name("EmailId").label("Recepient's email-Id:"));
   api.perform(
       api.context()
           .currentRoom()
           .post(
               new PrimaryChatlet()
                   .setQuestionHtml(
                       "<center><h4 style=\"color:black\";><b>Click on the button below:-</b></h4></center>"
                           + "<br />"
                           + "<center><a href=\"https://room.co/#/\" target=\"_blank\"><img src=\"https://slack.global.ssl.fastly.net/1e47/plugins/room/assets/service_128.png\" border=\"0\" height=\"64\" width=\"64\" ></a></center>"
                           + "<br />"
                           + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:#484848\";><b>It will redirect you to a page, Where you will find a Start video chat button</b></a1></li></ul>"
                           + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:#484848\";><b>Clicking on it will redirect you to a page Where you will find a link</b></a1></li></ul>"
                           + "<ul type=\"square\"; style=\"color:#359FD8\";><li><a1 style=\"color:#484848\";><b>Copy that link and paste it in the reply with the Email Id of the person you want to interact with</b></a1></li></ul>")
                   .setReplyScreen(fo)
                   .setReplyLabel("Connect")
                   .alias("adduser")));
 }
  @OnKeyword("Createstory")
  public void createStory(TeamchatAPI api) {
    Database_Handler db = new Database_Handler();
    pb = db.GetBasicStuff(api.context().currentSender().getEmail());

    GetProjects gp = new GetProjects();
    Field f_pid = null;
    f_pid = gp.getProject(pb.getAccess_token(), api);

    api.perform(
        api.context()
            .currentRoom()
            .post(
                new PrimaryChatlet()
                    .setQuestion("Fill in details of the story")
                    .setReplyScreen(
                        api.objects()
                            .form()
                            .addField(api.objects().input().label("Story Name:").name("story_name"))
                            .addField(api.objects().input().label("Description").name("notes"))
                            .addField(f_pid))
                    .alias("createstory")));
  }
Esempio n. 30
0
  @OnKeyword("addcheck")
  public void addcheck(TeamchatAPI api) throws IOException, SQLException {
    String rmid;
    rmid = api.context().currentRoom().getId();
    DBHandler ob4 = new DBHandler();
    boolean flag;
    flag = ob4.roomchk(rmid);

    if (flag == false) {
      PrimaryChatlet prime = new PrimaryChatlet();
      prime.setQuestionHtml(
          "<br /><b>First you have to sign in!!</b>"
              + "<br /><b>Note: </b><a1  style=\"color:#359FD8\";>For Signing in type \"login\" command</a1>");

      api.perform(api.context().currentRoom().post(prime));
    } else {
      DBHandler ob5 = new DBHandler();
      String[] usrpassapp = ob5.getusrpassapp(rmid);
      Username = usrpassapp[0];
      Password = usrpassapp[1];
      App_key = usrpassapp[2];
      url = "https://api.pingdom.com/api/2.0/checks";
      PrimaryChatlet prime = new PrimaryChatlet();
      Form f = api.objects().form();
      f.addField(api.objects().input().label("Check Name :").name("name"));
      f.addField(api.objects().input().label("Hostname :").name("host"));
      f.addField(
          api.objects()
              .select()
              .name("Protocol")
              .label("Select any protocol :")
              .addOption("http")
              .addOption("https"));

      prime
          .setQuestionHtml("<h5><b>Enter the Check details below:</b></h5>")
          .setReplyScreen(f)
          .setReplyLabel("Enter")
          .alias("sendreqadd");
      api.perform(api.context().currentRoom().post(prime));
    }
  }