protected function getPayload() : array
{
$payload = ['text' => $this->text, 'channel' => $this->channel, 'link_names' => true, 'unfurl_links' => true, 'unfurl_media' => true, 'mrkdwn' => true, 'response_type' => $this->responseType, 'attachments' => $this->attachments->map(function (Attachment $attachment) {
return $attachment->toArray();
})->toArray()];
if (!empty($this->icon)) {
$payload[$this->getIconType()] = $this->icon;
}
return $payload;
}