api-docs: Add instructions to download `zuliprc` files.

- Adds instructions for downloading a zuliprc file for a bot or for
  yourself.
- Updates the button label to "Download zuliprc", since that's the
  filename it downloads.

Fixes #28881.
This commit is contained in:
David Rosa 2024-02-15 17:25:09 -07:00 committed by Tim Abbott
parent 9a6ccba733
commit 948b427de7
4 changed files with 64 additions and 5 deletions

View File

@ -8,12 +8,62 @@ using Zulip's [bot framework](/api/writing-bots).
In order to use them, you need to configure them with your API key and other In order to use them, you need to configure them with your API key and other
settings. There are two ways to achieve that: settings. There are two ways to achieve that:
- With a file called `.zuliprc`, located in your home directory. - With a file called `zuliprc` passed as an argument via the `--config-file`
option.
- With - With
[environment variables](https://en.wikipedia.org/wiki/Environment_variable) [environment variables](https://en.wikipedia.org/wiki/Environment_variable)
set up in your host machine. set up in your host machine.
A `.zuliprc` file is a plain text document that looks like this: ## Download a `zuliprc` file
{start_tabs}
{tab|for-a-bot}
{settings_tab|your-bots}
1. Click the **download** (<i class="fa fa-download"></i>) icon on the profile
card of the desired bot to download the bot's `zuliprc` file.
!!! tip ""
If you save or move a `zuliprc` file to your home directory as `~/.zuliprc`,
the Python API bindings will automatically read it in (you won't have to
pass the `--config-file` option).
!!! warn ""
Anyone with a bot's API key can impersonate the bot, so be careful with it!
{tab|for-yourself}
{settings_tab|account-and-privacy}
1. Under **API key**, click **Manage your API key**.
1. Enter your password, and click **Get API key**. If you don't know your
password, click **reset it** and follow the
instructions from there.
1. Click **Download zuliprc** to download your `zuliprc` file.
!!! tip ""
If you save or move a `zuliprc` file to your home directory as `~/.zuliprc`,
the Python API bindings will automatically read it in (you won't have to
pass the `--config-file` option).
!!! warn ""
Anyone with your API key can impersonate you, so be doubly careful with it.
{end_tabs}
## Configuration keys and environment variables
`zuliprc` is a configuration file written in the
[INI file format](https://en.wikipedia.org/wiki/INI_file),
which contains key-value pairs as shown in the following example:
``` ```
[api] [api]
@ -29,7 +79,7 @@ can be found in the following table:
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th><code>.zuliprc</code> key</th> <th><code>zuliprc</code> key</th>
<th>Environment variable</th> <th>Environment variable</th>
<th>Required</th> <th>Required</th>
<th>Description</th> <th>Description</th>
@ -102,3 +152,10 @@ can be found in the following table:
</td> </td>
</tr> </tr>
</table> </table>
## Related articles
* [Installation instructions](/api/installation-instructions)
* [API keys](/api/api-keys)
* [Running bots](/api/running-bots)
* [Deploying bots](/api/deploying-bots)

View File

@ -38,7 +38,7 @@ is visible and available for anyone to use.
as the **bot type**. as the **bot type**.
Depending on the type of bot you're creating, you may need to download its Depending on the type of bot you're creating, you may need to download its
`.zuliprc` configuration file. For that, click the **download** `zuliprc` configuration file. For that, click the **download**
(<i class="fa fa-download"></i>) icon under the bot's name. (<i class="fa fa-download"></i>) icon under the bot's name.
## Related articles ## Related articles

View File

@ -36,7 +36,7 @@
</button> </button>
<div id="api_key_buttons"> <div id="api_key_buttons">
<button class="modal__btn dialog_submit_button" id="regenerate_api_key" aria-label="{{t 'Generate new API key' }}">{{t "Generate new API key" }}</button> <button class="modal__btn dialog_submit_button" id="regenerate_api_key" aria-label="{{t 'Generate new API key' }}">{{t "Generate new API key" }}</button>
<a class="modal__btn dialog_submit_button" id="download_zuliprc" download="zuliprc" tabindex="0">{{t "Download .zuliprc" }}</a> <a class="modal__btn dialog_submit_button" id="download_zuliprc" download="zuliprc" tabindex="0">{{t "Download zuliprc" }}</a>
</div> </div>
</footer> </footer>
</div> </div>

View File

@ -112,6 +112,8 @@ TAB_SECTION_LABELS = {
"v6": "Zulip Server 6.0+", "v6": "Zulip Server 6.0+",
"v4": "Zulip Server 4.0+", "v4": "Zulip Server 4.0+",
"all-versions": "All versions", "all-versions": "All versions",
"for-a-bot": "For a bot",
"for-yourself": "For yourself",
} }