Files
upstream-mirror 64898b2c79
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

83 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Fetch tweets from Twitter in Zulip! This is great for seeing and
discussing who is talking about you, friends, competitors, or
important topics in real time.
1. {!create-channel.md!}
1. {!create-an-incoming-webhook.md!}
The API keys for "Incoming webhook" bots are limited to only
sending messages via webhooks. Thus, this bot type lessens
the security risks associated with exposing the bot's API
key to third-party services.
1. Download your new bot's `zuliprc` configuration file.
1. {!download-python-bindings.md!}
1. The Twitter bot should be set up on a trusted machine, because your API
key is visible to local users through the command line or config
file.
1. Next, install **version 1.0 or later** of the `python-twitter`
library. If your operating system distribution doesn’t package a new
enough version, you can install the library from source from
[the GitHub repository](https://github.com/bear/python-twitter).
1. Next, set up Twitter authentication. This bot uses OAuth to
authenticate with Twitter, and in order to obtain a consumer key &
secret, you must register a new application under your Twitter
account:
1. Log in to <https://apps.twitter.com/>.
1. Click on `Create New App` and fill out the form.
1. Click on the application you created and click **create my access
token**. Fill in the requested values.
1. Create a `~/.zulip_twitterrc` with the following contents:
```
[twitter]
consumer_key =
consumer_secret =
access_token_key =
access_token_secret =
```
1. Place your bot's `zuliprc` in a directory of your choice (for the next step,
`~/zuliprc` is used).
1. Test the script by running it manually:
/usr/local/share/zulip/integrations/twitter/twitter-bot --search="@nprnews,quantum
physics" --config-file=~/zuliprc
/usr/local/share/zulip/integrations/twitter/twitter-bot --twitter-name="<@your-
twitter-handle>" --config-file=~/zuliprc
Note: `twitter-bot` may install to a different location on
your operating system distribution.
1. Configure a crontab entry for this script. A sample crontab entry
that will process tweets every minute is:
```
* * * * * /usr/local/share/zulip/integrations/twitter/twitter-bot --search="@nprnews,
quantum physics" --config-file=~/zuliprc
```
1. When someone tweets a message containing one of your search terms,
get a Zulip on your specified stream, with the search term as
the topic.
{!congrats.md!}
![Twitter bot message](/static/images/integrations/twitter/001.png)
Note that the Twitter search bot integration **just sends links to
tweets**; the pretty inline previews of tweets are generated by the
Twitter card rendering integration configured in
`/etc/zulip/settings.py` on the Zulip server.