Backend Service Apps

Backend services typically provide additional functionality for a site owner’s website, often without requiring an element to be dropped onto a page. Site owners browse the App Center and choose to install a service onto their site. When they do, that app can be configured and managed from a dashboard card or remotely from a designated URL that displays on their My Apps page. Once installed, the app runs natively on the site.

​For example, say you create a backend service that manages a site’s data about its members. Let’s call it Subscribe. A site owner finds out about Subscribe in the App Center and decides to install it. On install, the OAuth flow is started, which allows the Subscribe app to gain access to the Weebly API, as well as get information about the site owner and the site it’s being installed into. The app uses this information to authenticate the site owner on the Subscribe site and to create a Subscribe account for them. Once the site owner confirms access to the app, the zip containing the app is installed into the site.

The installation flow is configured so that the site owner is taken to Site Home where a Welcome dashboard card is highlighted. The site owner clicks the Welcome card and a takeover opens displaying further onboarding steps. When a new version of Subscribe is posted to the App Center, the site owner is notified and the app updates to the new version.

Snippets

​You can also create a snippet of code to be installed on every page in a site owner’s published site. To create a snippet, create the HTML and save it as an HTML template file (you can save it to the root of your directory with the manifest). Then include the path to the snippet in the manifest. When installed, the code is appended to every page.

This example shows the snippet.tpl - a very simple snippet.

<script>
    console.log("a4 snippet found");
</script>
<div>here is snippet from test app 4 (a4-snippet)</div>

And here’s the manifest entry for it.

{
    "manifest": "1",
    "version": "1.0.4",
    "snippet": "files/html/snippet.tpl"
}

Snippets are active only on published sites and not in the Weebly editor. So when a site owner installs a snippet, they won’t see the snippet when they’re returned to the editor. You can configure your app so that instead, the site owner is given the option to publish the site and see the snippet in action.

Create a Backend Service or Snippet

​To create a backend service or snippet, aside from the code for the app’s functionality that need to live on your server, you need to provide log in, configure, and manage capabilities at an external web site (if needed). Once you’ve created those sites and your app, follow the steps for developing an app.


Help make these docs better!