Automatically Clone Apps in Cloudways via Zapier Webhooks

Written By

Jonathan Jernigan

1. Create your trigger and then add an action

First, you’re going to create your trigger. This can be literally anything. Gravity Forms submission, new subscriber to an email list, whatever makes sense for your use case.
Step 1 screenshot

2. Select Webhooks by Zapier

You need to have a premium account to add webhooks in Zapier, but this feature alone is worth the extra cost for my agency, because of how much time this is going to save us.
Step 2 screenshot

3. For the Event type, select POST.

This is the first step of the process. You need to authenticate with Cloudways. Once you do, Cloudways will return an access_token that must be included with all further steps. This token is good for 60 minutes, so you’ll have plenty of time to test and run your automations in the real world.

Cloudways API for this step here:!/AuthenticationApi#getOAuthAccessToken
Step 3 screenshot

4. Go to Cloudways API Documentation!/AuthenticationApi#getOAuthAccessToken

5. Copy the authentication API URL

The endpoint URL should look like this:

6. Go back to Zapier

Now, you’re going to take the API endpoint URL you copied from step 5 and paste it into your webhook in the URL field

7. Click on Payload Type and change to json

Step 7 screenshot

8. Now you’re going to add the required query parameters

In the Cloudways documentation, you can see the required data for each API call. In this case, the authentication step requires your Cloudways email address and my Cloudways API key.
Step 8 screenshot

9. Enter your email address as shown

Step 9 screenshot

10. How to get your Cloudways API key

Go to Cloudways dashboard, click the little dots and choose API from the dropdown.
Step 10 screenshot

11. Click to copy your API key

Step 11 screenshot

12. Paste your key into the api_key field as shown

Step 12 screenshot

13. Click on Continue and then Test & Review

What you’ll see in the test data returned from Cloudways is your access_token which is the temporary authentication token you’ll include with all future requests, along with whatever data is required for that API call
Step 13 screenshot

14. Now add another action

Step 14 screenshot

15. Click on Webhooks by Zapier…

This is going to be our “clone” operation step in Cloudways
Step 15 screenshot

16. Again, select event type of POST

Be sure to check the documentation from Cloudways on what event type to select. Sometimes it will be POST, other times it will be FORM. Each API call will show you before the API endpoint url
Step 16 screenshot

17. Go back to Cloudways API documentation

Search the word clone and you’ll see “Application > Clone” which is what we want in this example. Alternatively, you can use Clone to new server which will add just a few extra required data fields to include. Same principle, though.!/ApplicationApi#cloneApp

18. Copy the API endpoint

For this clone operation, we need the endpoint URL of:

19. Paste “” into the URL field

Step 19 screenshot

20. Go back to Cloudways API Documentation

Take note of the required data attributes to include. In this case, we need to include server_id, app_id, and app_label in our API call.!/ApplicationApi#cloneApp

21. Add the parameters for this clone operation

Type in data attribute keys as shown below:
Step 21 screenshot

22. Name your new app (the result of the clone)

The app_label can be anything you want. Include dynamic data from previous steps or give it a static name. In my case, I’d give it some information from my Gravity Forms like the clients business name and the word staging so that the new clone app is standardized and unique.
Step 22 screenshot

23. Find your server ID

Finding your server ID in Cloudways is very simple. All you need to do is browse to the server your source app currently resides on.

When you’re at the server settings screen, look in the address bar and you’ll see a series of digits. That’s your server ID.
Step 23 screenshot

24. Paste that server ID into your Zapier webhook step

Step 24 screenshot

25. Repeat the same process to find your app ID

Browse to the app and again note the ID in the URL
Step 25 screenshot

26. Go back to Zapier and paste in the app_id

Note: this is the source app, the one that you want to clone. Make sure you’ve entered the correct app ID here.
Step 26 screenshot

27. Add another data row

Step 27 screenshot

28. Type “access_token”

Step 28 screenshot

29. Click into that data field to expand the dynamic data dropdown

Step 29 screenshot

30. Click on Access Token from your authentication step earlier

Step 30 screenshot

31. Now, continue and test

Step 31 screenshot

32. Now go to Cloudways as the clone operation should be in progress

33. View all your servers

You should now see a clone operation is in progress!
Step 33 screenshot

34. Add additional steps if you’d like

If you’re going to add any additional steps, considering adding a “Delay by Zapier” of about 5 minutes so the clone operation completes successfully.

Then, you can add another Webhook action for whatever you want. In my case, I am using the app credentials endpoint to automatically add FTP credentials to the newly cloned app.

The same general principle applies: Find the API endpoint, send the required data parameters, and include your access token.


Signup for the most inconsistent newsletter this side of the Mississippi

Delivered on a regular-as-I-can basis, I'll share with you the tl;dr of new blog posts and videos, exciting announcements, and other valuable information from around the WordPress ecosphere. You'll never get more than one email per week from me.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.