If you’re looking for a quick and easy way to create tenants in the WPCS Console, using Zapier and the WPCS API is a great option. In this article, we’ll guide you through the steps of setting up a Zapier action that creates a tenant using the WPCS API.
Before we begin, please make sure you have a Zapier account and can use the premium action Webhooks.
Step 1: Add a Webhooks by Zapier Action to Your Zap
Start by adding a Webhooks by Zapier action to your Zap.
1.1 Choose the Webhooks by Zapier app and select “POST” as the Action Event.
1.2 Press “Continue” to proceed.
Step 2: Set Up Your Action
To set up the action, we need to fill in some data.
2.1 In the URL field, fill in https://api.eu1.wpcs.io/v1/tenants.
2.2 In the Payload Type dropdown, select JSON.
2.3 Fill in the data you want to send to the WPCS API. For example, you can create a tenant under the name “Doe Corp” with the customer’s username “johndoe” and email “firstname.lastname@example.org“. The external ID must be unique and can be set to a value such as “9999” if it hasn’t been used before.
Note: If you allow your customers to specify a password, make sure it is never displayed or stored in plain text.
Step 3: Replace Static Values with Zapier Trigger Fields
To avoid creating the same tenant repeatedly, replace the static values you have filled in with fields from the Zapier Trigger that precedes the action.
Step 4: Wrap Request in Array and Unflatten
Pick “No” for “Wrap Request In Array” and “Yes” for “Unflatten”.
Step 5: Add Basic Auth
To authenticate Zapier to allow it to call the WPCS API, you need to add WPCS API keys. Fill in the Basic Auth field with your API key and its secret, separated by a pipe symbol (|).
Step 6: Test Your Action
After setting up the action, you can test it to ensure it works as expected. The test section should show a new tenant being created in the WPCS Console under the product you made your API key for.
Remember to clean up your test tenants to avoid unnecessary costs. Go to the tenant and click “Delete tenant” under the “Actions” dropdown.