How to Automate Git Deployment Using Webhooks on Cloudways


Hi All,

So I have been ‘playing’ about with webhooks and auto deployment as stated here the thing is I think it would be best for the script to take a backup before deploying. So I have added that like this…

`// Backup server
$accessToken = $tokenResponse->access_token;
$serverBackup = callCloudWaysAPI(‘POST’, ‘/server/manage/backup’, $accessToken, [
‘server_id’ => $_GET[‘server_id’]

echo ("backup started: ".json_encode($serverBackup));`

However, I would like it only then deploy once the backup is complete.

Can anyone help me with that? I can’t seem to figure it out.