code: @Override
      public JSONObject handleEvent(SlackEvent event) throws ServiceException {
          if (event.getCallbackId() != null && event.getCallbackId().indexOf('_') > 0 && event.getCallbackId().indexOf('/') > 0 && event.getTs() != null) {
              Long instanceId = Long.parseLong(event.getCallbackId().substring(event.getCallbackId().lastIndexOf('/') + 1));
              new Thread(() -> {
                  Map<String,String> indexes = new HashMap<>();
                  logger.debug("Saving slack:message_ts=" + event.getTs() + " for task " + instanceId);
                  indexes.put("slack:message_ts", event.getTs());
                  try {
                      ServiceLocator.getTaskServices().updateIndexes(instanceId, indexes);
                  }
                  catch (Exception ex) {
                      logger.severeException("Error updating indexes for task " + instanceId + ": " + ex, ex);
                  }
              }).start();
          }
          else if (event.getThreadTs() != null && event.getUser() != null) {
              new Thread(() -> {
                  try {
                      TaskServices taskServices = ServiceLocator.getTaskServices();
                      Query query = new Query();
                      query.setFilter("index", "slack:message_ts=" + event.getThreadTs());
                      List<TaskInstance> instances = taskServices.getTasks(query).getTasks();
                      for (TaskInstance instance : instances) {
                          // add a corresponding note
                          Comment comment = new Comment();
                          comment.setCreated(Date.from(Instant.now()));
                          // TODO: lookup (or cache) users
                          comment.setCreateUser(event.getUser().equals("U4V5SG5PU") ? "Donald Oakes" : event.getUser());
                          comment.setContent(event.getText());
                          comment.setOwnerType(OwnerType.TASK_INSTANCE);
                          comment.setOwnerId(instance.getTaskInstanceId());
                          comment.setName("slack_message");
                          ServiceLocator.getCollaborationServices().createComment(comment);
                      }
                  }
                  catch (Exception ex) {
                      logger.severeException(ex.getMessage(), ex);
                  }
              }).start();
          }
          return null;
      }
docs: Messages posted on the "tasks" channel.