get('rockchat_title'), 'username' => get('rocketchat_username'), 'attachments' => [[ 'text' => get('rocketchat_text'), 'color' => get('rocketchat_color'), ]] ]; if (get('rocketchat_channel')) { $body['channel'] = get('rocketchat_channel'); } if (get('rocketchat_room_id')) { $body['roomId'] = get('rocketchat_room_id'); } if (get('rocketchat_icon_url')) { $body['avatar'] = get('rocketchat_icon_url'); } elseif (get('rocketchat_icon_emoji')) { $body['emoji'] = get('rocketchat_icon_emoji'); } Httpie::post(get('rocketchat_webhook'))->jsonBody($body)->send(); }); desc('Notifies RocketChat about deploy finish'); task('rocketchat:notify:success', function() { if (null === get('rocketchat_webhook')) { return; } $body = [ 'text' => get('rockchat_title'), 'username' => get('rocketchat_username'), 'attachments' => [[ 'text' => get('rocketchat_success_text'), 'color' => get('rocketchat_success_color'), ]] ]; if (get('rocketchat_channel')) { $body['channel'] = get('rocketchat_channel'); } if (get('rocketchat_room_id')) { $body['roomId'] = get('rocketchat_room_id'); } if (get('rocketchat_icon_url')) { $body['avatar'] = get('rocketchat_icon_url'); } elseif (get('rocketchat_icon_emoji')) { $body['emoji'] = get('rocketchat_icon_emoji'); } Httpie::post(get('rocketchat_webhook'))->jsonBody($body)->send(); }); desc('Notifies RocketChat about deploy failure'); task('rocketchat:notify:failure', function() { if (null === get('rocketchat_webhook')) { return; } $body = [ 'text' => get('rockchat_title'), 'username' => get('rocketchat_username'), 'attachments' => [[ 'color' => get('rocketchat_failure_color'), 'text' => get('rocketchat_failure_text') ]] ]; if (get('rocketchat_channel')) { $body['channel'] = get('rocketchat_channel'); } if (get('rocketchat_room_id')) { $body['roomId'] = get('rocketchat_room_id'); } if (get('rocketchat_icon_url')) { $body['avatar'] = get('rocketchat_icon_url'); } elseif (get('rocketchat_icon_emoji')) { $body['emoji'] = get('rocketchat_icon_emoji'); } Httpie::post(get('rocketchat_webhook'))->jsonBody($body)->send(); });