Many hosting partners find it difficult to compete with other hosting companies that provide cloud-based website builders. Sitejet Builder is our solution to cloud-based website builders. Sitejet Builder helps partners elevate their hosting platform as a customer-friendly website builder and the best part is that it is already available in Plesk.

This article explains how to provide access to the Sitejet Builder interface directly from your customer portal. This gives your users easy access to a simple website builder without using multiple interfaces.

To do this, you will need to use the Plesk API. To learn more about the Plesk API, read our documentation.

Provide a streamlined website builder experience with Sitejet Builder

To set up a customer in your customer portal:

  1. Retrieve the account’s id with the API

    The account’s ID is required to make changes to the account. In this example, we use the webspace operator to retrieve the account’s ID.

    Your call might resemble the following example:

    <packet version="1.6.3.2">
            <webspace>
                    <get>
                            <filter>
                                    <name>example.com</name>
                            </filter>
                            <dataset>
                                    <hosting/>
                            </dataset>
                    </get>
            </webspace>
    </packet>
    
  2. Create the single sign-on link to edit the account’s website

    You can create the account’s single sign-on link with the plesk-sitejet:edit command:

    Your call might resemble the following example:

    <packet version="1.6.9.1">
            <extension>
                    <call>
                            <plesk-sitejet>
                                    <edit site_id="86"/>
                            </plesk-sitejet>
                    </call>
            </extension>
    </packet>
    

    This call will return the account’s Sitejet Builder single sign-on link in the edit field. It will also create the account or website if needed.

    The response will resemble the following example:

    <packet version="1.6.9.1">
            <extension>
                    <call>
                            <result>
                                    <status>ok</status>
                                    <plesk-sitejet>
                                            <edit>https://my.sitehub.io/website/edit?ssotoken=ONE_TIME_LOGIN_LINK_IS</edit>
                                    </plesk-sitejet>
                            </result>
                    </call>
            </extension>
    </packet>
    
  3. Copy the account’s login token from the edit field

    The account’s login token will resemble the following example in the response:

    https://my.sitehub.io/website/edit?ssotoken=ONE_TIME_LOGIN_LINK_IS
    
  4. Create a link to Sitejet Builder in the user’s portal account

    Use whichever method you prefer to redirect your users to Sitejet Builder in your customer portal. Your application should copy the login token from the edit field in the response, and use it to create the link.

    When a user clicks on the link, they will be logged directly into Sitejet Builder.

  5. Redirect the user back to the portal account

    This step is optional but recommended.

    When a user clicks Publish in Sitejet Builder, two things occur.

    • Sitejet Builder downloads the website’s data to the user’s account to prepare it for publication.
    • The user is redirected to the Plesk control panel.

    Because the user logged in to Sitejet Builder directly, they may not actually be logged in to the Plesk control panel when they are redirected. Instead, they will see a login screen for Plesk. This can cause confusion.

    To avoid this issue, add the following two parameters to the login token link so the user is properly redirected back to the publication option in your portal:

    • website_manager_url - This is the URL to navigate to when a user clicks Exit in Sitejet Builder.
    • publish_url - A URL that will call the plesk-sitejet:publish command and trigger the publication process from your customer portal.

    The expanded login token link might resemble the following example:

    https://my.sitehub.io/website/edit?ssotoken=ONE_TIME_LOGIN_LINK_IS&website_manager_url=https://partner.site/link/to/hosting&publish_url=https.//partner.site/link/to/publish
    

    Your call to the plesk-sitejet:publish command might resemble the following example:

    <packet version="1.6.9.1">
            <extension>
                    <call>
                            <plesk-sitejet>
                                    <publish site_id="86"/>
                            </plesk-sitejet>
                    </call>
            </extension>
    </packet>