Build a channel from scratch - Part 5: Deploying the channel
After building the integration service and admin interface, the next step is to deploy the channel so your support team can start using it.
Here are the steps for deploying the channel:
- Deploying the integration service on the web
- Creating a channel installer
- Installing and testing the channel in Support
This is the final part of a project to build a channel from scratch:
- Part 1: Getting started
- Part 2: Creating the integration service
- Part 3: Connecting to the community
- Part 4: Building the admin interface
- Part 5: Deploying the channel - YOU ARE HERE
Disclaimer: Zendesk provides this article for demonstration and instructional purposes only. The channel developed in the article should not be used in a production environment. Zendesk does not provide support for developing a channel.
Deploying the integration service on the web
You need to deploy your channel's integration service on the web to make it accessible to Zendesk. You can use any hosting service you like so long as it supports Python web apps. The tutorial describes how to use Glitch, a service that lets you host and run web applications in the cloud. If you don't already have a Glitch account, you can sign up for a free one.
You can skip this section if you have another hosting solution for Python web apps.
Deploying the integration service on Glitch consists of the following steps:
- Creating a Glitch project
- Preparing the web app for deployment
- Uploading the integration service to Glitch
Creating a Glitch project
Create an empty project on Glitch.
-
Sign in to Glitch and go to https://glitch.com/edit/#!/simple-blank-project.
-
Click Remix to create your own copy of the Glitch project.
-
As an optional step, change the app's name and description. Click Settings > Edit project details. After editing the name and description, click Save.
-
To get the URL for your project, click Share and copy the Live site link. Example:
https://zendesk-channel-tutorial.glitch.me
-
In your integration service, replace the
{glitch_url}
placeholders in the integration_manifest.json file with the Glitch URL. Example:{
"name": "Community Channel",
"id": "my-community-channel-abc123",
"version": "1.0.0",
"urls": {
"admin_ui": "https://zendesk-channel-tutorial.glitch.me/channels/community/admin_ui",
"pull_url": "https://zendesk-channel-tutorial.glitch.me/channels/community/pull",
"channelback_url": "https://zendesk-channel-tutorial.glitch.me/channels/community/channelback"
}
}
Preparing the integration service for deployment
When deploying, the following configuration files need to be included in the integration service's root directory:
- requirements.txt
- start.sh
-
In the same folder as your service.py file, create a requirements.txt file. Paste the following into the file:
bottle==0.12.23
requests==2.28.1
arrow==1.2.3
python-dotenv==0.21.0
The file lists all the external libraries the service needs to run. If needed, update the version number of each library. To find out the version, run the
pip3 show {package_name}
command. Example:pip3 show bottle
-
In the same folder, create a start.sh file. Paste the following into the file:
python3 service.py
The file contains the shell commands that Glitch runs to start the integration service.
Uploading the integration service to Glitch
Upload the integration service to your Glitch project as a ZIP file.
Tip: If you're familiar with git and GitHub, you can import the integration service from a GitHub repo instead. See Importing Code from GitHub in the Glitch documentation.
-
If running, stop the Bottle server by pressing Ctrl+C.
-
Compress the contents of the integration service project's folder, including the .env file, into a ZIP file named integration_service.zip.
Important: Don't include the folder itself in the ZIP file. You can optionally exclude any config files and folders added by your operating system, such as .DS_Store or __MACOSX. These files aren't needed, but they won't interfere with your Glitch app.
Example:
cd projects/channel_tutorial
zip -r integration_service.zip . -x ".DS_Store" -x "__MACOSX"
-
In your Glitch project, click Assets.
-
Drag integration_service.zip into Assets.
-
After it uploads, click the ZIP file and copy its URL.
You'll use the URL later in this tutorial.
-
At the bottom of the Glitch page, click Terminal.
-
In the Glitch terminal, run:
wget {zip_url}
Replace
{zip_url}
with the URL you copied in step 5.The command returns a message similar to the following:
Saving to: 'integration_service.zip?v=123456'
Copy the quoted file name, including the
?v
parameter. You'll use it in the next step. -
In the same Glitch terminal, run:
unzip {file_name}
Replace
{file_name}
with the file name you copied in the step 7. -
In the Glitch terminal, run:
refresh
The web app's files now appear under your Glitch project's Files.
-
In the Glitch terminal, run:
pip3 install -r requirements.txt
The command installs the Python packages in your app's requirements.txt file.
-
As an optional step, delete the ZIP file and related asset from step 4. They're no longer needed, but they won't interfere with your Glitch app.
Creating a channel installer
You install your new channel in a Zendesk Support account with a Zendesk app.
To create the channel installer
-
In your shell, navigate to the folder where you want to save the app. Example:
cd projects
-
In the folder, run:
zcli apps:new
-
When prompted, enter the following information:
- Directory name: installer
- Author's name: Your name
- Author's email: Your email address
- Author's website: Leave blank and press Enter.
- App name: Community Channel Installer
After you're done, ZCLI creates the required files for a new app in the installer folder.
The properties of the app are recorded in a file named manifest.json, which should not be confused with the channel's integration_manifest.json file. By default the manifest.json file defines a sidebar app in Support. However, the only job your app has is to create a channel in a Zendesk Support instance. This kind of app is known as a requirements-only app. It doesn't display anything or do anything else. You'll change this in the next step.
-
Open the manifest.json file in the installer folder (not the channel's integration_manifest.json file in your project folder) and make the following changes:
- Add
"requirementsOnly": true
to the manifest properties - Add
"singleInstall": true
to the manifest properties - Delete the
"locations"
property - Delete the
"frameworkVersion"
property
The updated manifest file should look like this:
{
"name": "Community Channel Installer",
"requirementsOnly": true,
"singleInstall": true,
"author": {
"name": "J Doe",
"email": "[email protected]"
},
"defaultLocale": "en",
"private": true,
"version": "1.0"
}
- Add
-
Create a file named requirements.json with the other app files in the installer folder.
-
Add the following JSON object to the requirements.json file and save it:
{
"channel_integrations": {
"my-community-channel-abc123": {
"manifest_url": "{glitch_url}/channels/community/manifest"
}
}
}
Specify the
id
in your channel manifest.json file as the name of the integration. In this tutorial, the id is "my-community-channel-abc123".Replace
{glitch_url}
with the host name of your deployed service. Example: "https://zendesk-channel-tutorial.glitch.me". -
In the installer folder, run :
zcli apps:package
ZCLI will create a ZIP file containing your app in a subfolder named tmp.
Installing and testing the channel in Support
-
Sign in as an admin in Admin Center, go to Apps and integrations > Apps > Zendesk Support apps, then follow the instructions to upload and install a private app. For details, see Uploading and installing your private app in Zendesk Support. Make sure your channel installer app is enabled in the account.
-
In Admin Center, go to Apps and integrations > Apps > Channel apps, and select your channel integration from the list. If you don't see your integration, make sure the channel installer app is enabled in the account.
-
Click the Accounts tab, then click the Add Account button. Zendesk displays your admin interface:
-
Enter an id for a community topic and click Save. Your channel is activated.
-
Test the channel.
See Understanding the user experience in part 1 of the project.
Check your Glitch project's logs for issues.
Create posts in the community.
Wait a few minutes for Zendesk to make its first pull request and verify that corresponding tickets are created in Support.
Add a comment to a ticket and verify that the comment is added to the corresponding community post.
Verify that subsequent pull requests pull only new posts.
In this tutorial, you deployed a community channel for Zendesk Support. You can keep tweaking and making enhancements to the channel if you like. For example, you could track more than one community topic.