integrations: Move Trello webhook docs to markdown.

This commit is contained in:
Umair Khan 2017-04-04 13:20:31 +05:00 committed by Tim Abbott
parent 21c129c93b
commit 5a3f83bba8
3 changed files with 77 additions and 92 deletions

View File

@ -575,6 +575,7 @@ def build_custom_checkers(by_lang):
"docs/migration-renumbering.md",
"docs/readme-symlink.md",
"README.md",
"zerver/webhooks/trello/doc.md",
}
for fn in by_lang['md']:
max_length = None

View File

@ -1,92 +0,0 @@
<p>
This webhook integration for Trello is the recommended way to
integrate with Trello, and should support all the features of
the <a href="#trello-plugin">legacy Trello cron-based
integration</a>.
</p>
<p>
First, create the stream you'd like to use for Trello notifications,
and subscribe all interested parties to this stream. We recommend the
name <code>trello</code>.
</p>
<p>
Your webhook URL is:<br/>
<code>{{ external_api_uri_subdomain }}/v1/external/trello?api_key=abcdefgh&stream=trello</code><br/>
where <code>api_key</code> is the API key of your Zulip bot,
and <code>stream</code> is the stream name you want the notifications sent to.
</p>
<p>
Trello doesn't support creating webhooks on their website; you
have to do it using their API. So before you create a webhook,
you'll need to follow the steps below to get from Trello
an <b>APPLICATION_KEY</b>, and a <b>UserToken</b>, and to fetch
the board's <b>idModel</b>.
</p>
<p>
To generate the <b>APPLICATION_KEY</b>, open this URL in your web browser:<br/>
<code>https://trello.com/1/appkey/generate</code>.
</p>
<p>
To generate a read access token, fill in and open this URL in the browser while logged into your Trello account:
<code>https://trello.com/1/authorize?key=&ltAPPLICATION_KEY&gt&name=Issue+Manager&expiration=never&response_type=token&scope=read</code><br/>
You will receive your <b>UserToken</b>. Note it.
</p>
<p>
Within the the board URL, you can find the <b>TRELLO_BOARD_SHORT_ID</b>.
The Trello URL format is:<br/>
<code>https://trello.com/b/TRELLO_BOARD_SHORT_ID/boardName</code>.
</p>
<p>
Now you have the <b>APPLICATION_KEY</b>, <b>UserToken</b> and <b>TRELLO_BOARD_SHORT_ID</b>.<br/>
Construct this URL and open it in your web browser:<br/>
<code>https://api.trello.com/1/board/&ltTRELLO_BOARD_SHORT_ID&gt?key=&ltAPPLICATION_KEY&gt&token=&ltUserToken&gt</code><br/>
You'll receive some JSON. Within that, find the <b>id</b> value. That's your <b>idModel</b>; note it.
</p>
<p>
Now you have all the ingredients you need. To actually create the
Trello webhook, you will need to send an <code>HTTP POST</code>
request to the trello API webhook endpoint
(<code>https://api.trello.com/1/tokens/&ltUserToken&gt/webhooks/?key=&ltAPPLICATION_KEY&gt</code>)
with the following data:
</p>
<pre>{
"description": "Webhook for Zulip integration",
"callbackURL": "&ltURL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP&gt",
"idModel": "&ltID_MODEL&gt",
}
</pre>
<p>You can do this using the <code>curl</code> program as follows:</p>
<pre>curl 'https://api.trello.com/1/tokens/&ltUserToken&gt/webhooks/?key=&ltAPPLICATION_KEY&gt'
-H 'Content-Type: application/json' -H 'Accept: application/json'
--data-binary $'{\n "description": "Webhook for Zulip integration",\n "callbackURL": "&ltURL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP&gt",\n "idModel": "&ltID_MODEL&gt"\n}'
--compressed
</pre>
<p>
The response from Trello should look like:<br/>
</p>
<pre>{
"id": "&ltWEBHOOK_ID&gt",
"description": "Webhook for Zulip integration",
"idModel": "&ltID_MODEL&gt",
"callbackURL": "&ltURL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP&gt",
"active": true
}
</pre>
<p>
Congratulations! You've created a webhook and your integration is live.
</p>
<p>
When you make changes in on this board in Trello, you will
receive Zulip notifications like this:
</p>
<p><img class="screenshot" src="/static/images/integrations/trello/001.png"/></p>

View File

@ -0,0 +1,76 @@
This webhook integration for Trello is the recommended way to
integrate with Trello, and should support all the features of
the [legacy Trello cron-based integration](#trello-plugin).
First, create the stream you'd like to use for Trello notifications,
and subscribe all interested parties to this stream. We recommend the
name `trello`.
Your webhook URL is:
`{{ external_api_uri_subdomain }}/v1/external/trello?api_key=abcdefgh&stream=trello`
where `api_key` is the API key of your Zulip bot,
and `stream` is the stream name you want the notifications sent to.
Trello doesn't support creating webhooks on their website; you
have to do it using their API. So before you create a webhook,
you'll need to follow the steps below to get from Trello
an **APPLICATION_KEY**, and a **UserToken**, and to fetch
the board's **idModel**.
To generate the **APPLICATION_KEY**, open this URL in your web browser:
`https://trello.com/1/appkey/generate`.
To generate a read access token, fill in and open this URL in the browser while logged into your Trello account:
`https://trello.com/1/authorize?key=<APPLICATION_KEY>&name=Issue+Manager&expiration=never&response_type=token&scope=read`
You will receive your **UserToken**. Note it.
Within the the board URL, you can find the **TRELLO_BOARD_SHORT_ID**.
The Trello URL format is:
`https://trello.com/b/TRELLO_BOARD_SHORT_ID/boardName`.
Now you have the **APPLICATION_KEY**, **UserToken** and **TRELLO_BOARD_SHORT_ID**.
Construct this URL and open it in your web browser:
`https://api.trello.com/1/board/<TRELLO_BOARD_SHORT_ID>?key=<APPLICATION_KEY>&token=<UserToken>`
You'll receive some JSON. Within that, find the **id** value. That's your **idModel**; note it.
Now you have all the ingredients you need. To actually create the
Trello webhook, you will need to send an `HTTP POST`
request to the trello API webhook endpoint
(`https://api.trello.com/1/tokens/<UserToken>/webhooks/?key=<APPLICATION_KEY>`)
with the following data:
```
{
"description": "Webhook for Zulip integration",
"callbackURL": "<URL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP>",
"idModel": "<ID_MODEL>",
}
```
You can do this using the `curl` program as follows:
```
curl 'https://api.trello.com/1/tokens/<UserToken>/webhooks/?key=<APPLICATION_KEY>'
-H 'Content-Type: application/json' -H 'Accept: application/json'
--data-binary $'{\n "description": "Webhook for Zulip integration",\n "callbackURL": "<URL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP>",\n "idModel": "<ID_MODEL>"\n}'
--compressed
```
The response from Trello should look like:
```
{
"id": "<WEBHOOK_ID>",
"description": "Webhook for Zulip integration",
"idModel": "<ID_MODEL>",
"callbackURL": "<URL_TO_ZULIP_WEBHOOK_FROM_SECOND_STEP>",
"active": true
}
```
Congratulations! You've created a webhook and your integration is live.
When you make changes in on this board in Trello, you will
receive Zulip notifications like this:
![](/static/images/integrations/trello/001.png)