/**
  * @inheritdoc
  */
 protected function createPayload()
 {
     $payload = new ChatDeletePayload();
     $payload->setChannelId('C1234567');
     $payload->setSlackTimestamp('12345678');
     return $payload;
 }
 /**
  * @return ChatDeletePayload
  */
 protected function createPayload()
 {
     $payload = new ChatDeletePayload();
     $payload->setChannelId($this->input->getArgument('channel-id'));
     $payload->setSlackTimestamp($this->input->getArgument('timestamp'));
     return $payload;
 }
 protected function notifySlack($message, $project, $env, $user, $resolverArray, $color = "#FFCC00", $update = false)
 {
     if ($update) {
         $payload = new ChatDeletePayload();
         $payload->setSlackTimestamp($this->ts);
         $payload->setChannelId($this->channel);
         $response = $this->slackApiClient->send($payload);
         if ($response->isOk()) {
             if ($response instanceof ChatPostMessagePayloadResponse) {
                 /** @var ChatPostMessagePayloadResponse $response */
                 $this->ts = $response->getSlackTimestamp();
             }
         } else {
             // something went wrong, but what?
             // simple error (Slack's error message)
             echo $response->getError();
             // explained error (Slack's explanation of the error, according to the documentation)
             echo $response->getErrorExplanation();
             exit(1);
         }
     }
     $payload = new ChatPostMessagePayload();
     $payload->setChannel("#" . getenv("slack_channel"));
     $payload->setIconUrl("https://www.dropbox.com/s/ivrj3wcze7cwh54/masterjenkins.png?dl=1");
     $payload->setUsername("Master Jenkins");
     $attachment = new Attachment();
     $attachment->setColor($color);
     $attachment->setFallback("[" . $project . "#" . getenv("BUILD_NUMBER") . " - branch *" . getenv("GIT_BRANCH") . "* to *" . $env . "* by _" . $user . "_] " . $message);
     $attachment->setText("[" . $project . "#" . getenv("BUILD_NUMBER") . " - branch *" . getenv("GIT_BRANCH") . "* to *" . $env . "* by _" . $user . "_] " . $message . "\n<" . getenv("BUILD_URL") . "console|Jenkins Console> - <" . getenv("BUILD_URL") . "changes|Changes>" . (isset($resolverArray["shared_package_target"]) && file_exists($resolverArray["shared_package_target"]) ? " - <" . $resolverArray["shared_package_url"] . "|Download>" : ""));
     $payload->addAttachment($attachment);
     $response = $this->slackApiClient->send($payload);
     if ($response->isOk()) {
         if ($response instanceof ChatPostMessagePayloadResponse) {
             /** @var ChatPostMessagePayloadResponse $response */
             $this->ts = $response->getSlackTimestamp();
             $this->channel = $response->getChannelId();
         }
     } else {
         // something went wrong, but what?
         // simple error (Slack's error message)
         echo $response->getError();
         // explained error (Slack's explanation of the error, according to the documentation)
         echo $response->getErrorExplanation();
         exit(1);
     }
 }