ZAT commands
Using the Zendesk Apps Tools (ZAT)
Note:ZAT is in maintenance mode. For the best experience, use theZendesk Command Line Interface (ZCLI)to develop Zendesk apps.
ZAT is a collection of command-line tools that simplify building and deploying Zendesk apps. The tools let you create, test, validate, and package your apps locally.
$ zat create
Available commands for building apps:
ZAT also includes a command forpreviewing changes to Zendesk Guide themes locally.
Installing and updating ZAT
To install the tools, seeInstalling and using ZAT. See theknown issuesif you run into any problems installing or using the tools.
To update your tools to the latest version, run$ gem update zendesk_apps_tools
.
Authentication
以下命令需要访问你的Zendesk亚博account:create
,update
, andtheme
. Each command prompts you for your subdomain, username, and password.
If password access is disabled for your account, you can use an API token instead of a password. If you do, the username must be in the format[email protected]/token
. SeeAPI tokenin the REST API docs.
ZAT saves the subdomain and username in a file named.zatin the local folder so you don't have to enter them again the next time you run the command. Example:
{
"subdomain":"your_subdomain",
"username":"your_username"
}
Optionally, you can include apassword
parameter in your.zat
file so you are not prompted for this every time you run thecreate
,update
ortheme
command. Example:
{
"subdomain":"your_subdomain",
"username":"your_username",
"password":"your_password or api_token"
}
Note: If you use thepassword
parameter in the.zat
file, it will be stored as plain text. Use this parameter with caution. If you are using source control, we recommend adding.zat
to your.gitignore
file.
If you use an API token, your.zat
file should look similar to:
{
"subdomain":"your_subdomain",
"username":"[email protected]/token",
"password":"[TOKEN]"
}
If you make a mistake typing your subdomain, username, or password the first time you run the command, change the values in the.zatfile.
Note: Files with a leading period are hidden by default in macOS. SeeShow Hidden Files on Mac OS Xon osxdaily.com.
new
Creates all the files necessary to start building a Zendesk app. Use the--scaffold
option to download and use the亚博Zendesk反应应用脚手架as the base of your app. For more instructions on using the React app scaffold, see thereadme.
$ zat new
$ zat new --scaffold
validate
Runs a suite of validation tests against your app. Because the same tests are run when you upload the app, you probably won't be able to upload the app until your app passes thevalidate
tests.
$ zat validate
server
Starts a local HTTP server that lets you run and test your apps locally.
$ zat server
Run the command in the app's local root folder. Switch to the product interface and append?zat=true
to the page URL.
Because the app runs locally in an iframe in the Zendesk page, your browser may block it as mixed content. Firefox doesn't block this content but Safari does and has no option to disable blocking. Chrome blocks it by default but you can unblock it. Click the lock icon on the left side of the address bar, select网站设置>Privacy and Security, then select theAllowoption underInsecure content.
To serve apps on custom ports, run the commandzat server --port 4254
. Then, load each app by switching to the product interface and append?zat=4254
to the appropriate port number.
For details, refer toTesting your app locally in a browser.
You can also test apps with secure settings or requirements locally. Refer toPackaging and installing a private Zendesk appandUpdating a private Zendesk app.
To stop the server, switch to your command-line interface and pressControl+C.
create
Packages, uploads, and installs the app into the Zendesk products specified in the app manifest.
$ zat create
Thecreate
command performs the following actions:
- Packages the app's files into a zip file and saves it in a local folder namedtmp
- After prompting you for a subdomain, username, and password, uploads and installs the package into the Zendesk products specified in the app's manifest file
- After uploading the app, saves the app ID and other metadata in a file named.zatin the local folder
The command prompts you for a subdomain, username, and password. SeeAuthentication.
Requirements
- API access is enabled in theAdmin Centerinterface (Apps and integrations>APIs>Zendesk APIs)
- ZAT v2.0 or later for installing. All versions for packaging and uploading. Run
扎- - v
to get your version
Options
Thecreate
command has the following options:
no-install- Prevents the app from installing in the product instance. The app will still be uploaded and appear in the "Not Installed Apps" section of the Private Apps tab in the admin interface. Example:
zat create --no-install
path- Specifies a folder containing the app files to package and upload. Example:
zat create --path=./dev/zendesk_app
zipfile- Specifies a folder containing a packaged zip file. Use this option if you used
package
to package the app and you want to upload and install it. Example:zat create --zipfile=~/my_app/tmp/app-2017033340.zip
update
Updates an existing private app in the Zendesk products specified in the app's manifest file.
$ zat update
The command packages the app's files and uploads the package.
The command prompts you for a subdomain, username, and password. SeeAuthentication.
Requirement
- API access is enabled in the Zendesk Support admin interface (Admin>Channels>API).
Options
Theupdate
command has the following options:
path- Specifies a folder containing the app files to package and upload. Example:
zat update --path=./dev/zendesk_app
zipfile- Specifies a folder containing a packaged zip file. Use this option if you used
package
to package the updated app and you want to upload and install it. Example:zat update --zipfile=~/my_app/tmp/app-2017033340.zip
If you didn't usecreate
to upload the app initially (for example, if you uploaded the file using the product admin interface), you must create a file named.zatwith the following content in the app's local root directory:
{
"subdomain":"your_subdomain",
"username":"your_username",
"app_id":1234
}
Note: Thecreate
command creates this file for you.
Theusername
value is the email address you use to sign in.
To get theapp_id
value, sign in to the Zendesk product for the app as an admin. Then open the respective page for the product in the same browser:
- Support:
https://{子域名}.zendesk.com/api/support/apps/installations.json
- Chat:
https://{子域名}.zendesk.com/api/chat/apps/installations.json
- Sell:
https://{子域名}.zendesk.com/api/sell/apps/installations.json
Replace{subdomain}
with your Zendesk subdomain. Find theapp_id
for your app on the page.
For details, refer toUpdating a private Zendesk app.
package
Creates a zip file that you can upload and install in a Zendesk account.
$ zat package
The command saves the zip file in a folder namedtmp.
You can upload and install the app from theproduct admin interfaceor from the command line using thecreate
command with thezipfile
option.
clean
Removes the zip files in thetmpfolder that's created when you package the app.
$ zat clean
theme preview
Starts a local HTTP server to preview a Zendesk Guide theme locally while you make changes to it. This feature is available only on the Zendesk Suite Professional plan or above.
$ zat theme preview
For details, seePreviewing theme changes locallyin the Guide documentation.
The command prompts you for a subdomain, username, and password. SeeAuthentication.