### Hello World Walkthrough Source: https://zulip.readthedocs.io/en/latest/webhooks/incoming-webhooks-overview.html A basic example to get started with sending messages via incoming webhooks. Requires no special setup. ```python from zulip_bots.integrations.webhooks.hello_world import HelloWord HelloWord().send_message({ "message": { "sender_email": "test@example.com", "type": "stream", "stream": "general", "topic": "hello world", "content": "Hello world!", } }) ``` -------------------------------- ### Quick Guide to Incoming Webhooks Source: https://zulip.readthedocs.io/en/latest/development/using.html A quick guide to setting up incoming webhooks in Zulip. This provides a basic overview and a 'Hello World' example. ```text 1. Go to your Zulip server settings. 2. Navigate to "API Integrations" and select "Incoming Webhooks". 3. Click "Add new webhook" and configure its name and stream. 4. Copy the generated webhook URL. ``` -------------------------------- ### Hello World Incoming Webhook Source: https://zulip.readthedocs.io/en/latest/webhooks/incoming-webhooks-walkthrough.html A basic 'Hello World' example to get started with incoming webhooks. This demonstrates the minimal code required to receive and process a webhook. ```python from django.http import HttpRequest, HttpResponse def hello_world(request: HttpRequest) -> HttpResponse: return HttpResponse("Hello world!") ``` -------------------------------- ### Setup Apache SSO Integration Source: https://zulip.readthedocs.io/en/latest/production/authentication-methods.html Commands to copy the SSO example configuration, create an htpasswd file for testing, and enable the SSO site within Apache. ```bash /home/zulip/deployments/current/scripts/restart-server cd /etc/apache2/sites-available/ cp zulip-sso.example zulip-sso.conf htpasswd -c /home/zulip/zpasswd username@example.com # prompts for a password ``` -------------------------------- ### Hello World Walkthrough for Incoming Webhooks Source: https://zulip.readthedocs.io/en/latest/production/system-configuration.html This walkthrough demonstrates a simple 'Hello World' example for an incoming webhook, showing the basic structure of a payload and how to send it. ```text 1. Set up an incoming webhook integration in Zulip as described in the quick guide. 2. Use `curl` to send a POST request to your webhook URL with a JSON payload: ```bash curl -X POST -H "Content-Type: application/json" \ --data '{"type": "stream", "message": "Hello, Zulip!"}' \ YOUR_WEBHOOK_URL ``` 3. Verify that the message "Hello, Zulip!" appears in your Zulip stream. ``` -------------------------------- ### Enable and Start Docker Service (Ubuntu/Debian) Source: https://zulip.readthedocs.io/en/latest/development/setup-recommended.html Unmasks, enables, and starts the Docker service if it is not running. This is necessary if Docker was previously installed and removed, or if it failed to start automatically. ```bash $ sudo systemctl unmask docker $ sudo systemctl enable docker $ sudo systemctl start docker ``` -------------------------------- ### Install Git for Zulip Development Source: https://zulip.readthedocs.io/en/latest/production/deployment.html Installs Git on Debian/Ubuntu systems. Clone the Zulip repository to get a development version. ```bash # First, install Git if you don't have it installed already sudo apt install git git clone https://github.com/zulip/zulip.git zulip-server-git ``` -------------------------------- ### Hello World Walkthrough for Incoming Webhooks Source: https://zulip.readthedocs.io/en/latest/tutorials/new-feature-tutorial.html A basic example demonstrating how to send a simple message to a stream and topic using an incoming webhook. This is useful for initial setup and testing. ```python import requests webhook_url = "YOUR_ZULIP_WEBHOOK_URL" message = { "type": "stream", "to": "some-stream", "subject": "Hello world", "content": "This is a test message.", } response = requests.post(webhook_url, json=message) if response.status_code == 200: print("Message sent successfully!") else: print(f"Error sending message: {response.text}") ``` -------------------------------- ### Install Python 3 on CentOS/Fedora/RHEL Source: https://zulip.readthedocs.io/en/latest/_sources/development/setup-advanced.md.txt On CentOS, Fedora, and RHEL systems, python3 must be installed manually before proceeding with Zulip setup. This command uses yum to install python3. ```bash # On CentOS/Fedora/RHEL, you must first install python3. # For example, this command installs python3 with yum: yum install python ``` -------------------------------- ### Install and Configure Nginx Source: https://zulip.readthedocs.io/en/latest/_sources/development/remote.md.txt Installs nginx, copies the Zulip development configuration, enables the site, and reloads nginx to apply changes. Use `nginx -t` to verify the configuration before reloading. ```bash apt install -y nginx-full cp -a /home/zulipdev/zulip/tools/droplets/zulipdev /etc/nginx/sites-available/ ln -nsf /etc/nginx/sites-available/zulipdev /etc/nginx/sites-enabled/ nginx -t # Verifies your nginx configuration service nginx reload # Actually enabled your nginx configuration ``` -------------------------------- ### Endpoint Definition Example: Get Presence Source: https://zulip.readthedocs.io/en/latest/_sources/documentation/openapi.md.txt Example of an endpoint definition in OpenAPI format, detailing the HTTP method, parameters, authentication, and response. ```APIDOC ## Endpoint definitions The [Paths Object](https://swagger.io/specification/#pathsObject) contains [Path Item Objects](https://swagger.io/specification/#pathItemObject) for each endpoint. It describes in detail the methods and parameters the endpoint accepts and responses it returns. There is one Path Item Object for each supported method, containing a [Parameters Definition Object](https://swagger.io/specification/#parametersDefinitionObject) describing the required and optional inputs. A [Response Object](https://swagger.io/specification/#responseObject) similarly specifies the content of the response. They may reference schemas from a global Definitions Object (see [Schemas](#schemas), below.) Example: The `/users/{user}/presence` endpoint (defined in a [Path Item Object](https://swagger.io/specification/#pathItemObject)) expects a GET request with one [parameter](https://swagger.io/specification/#parameterObject), HTTP Basic authentication, and returns a JSON response containing `msg`, `result`, and `presence` values. ```yaml /users/{user}/presence: get: description: Get presence data for another user. operationId: getPresence parameters: - name: user in: path description: Enter email address required: true type: string security: - basicAuth: [] responses: '200': description: The response from a successful call schema: type: object required: - msg - result - presence properties: msg: type: string result: type: string presence: type: array ``` ``` -------------------------------- ### Hello World Walkthrough for Incoming Webhooks Source: https://zulip.readthedocs.io/en/latest/development/using.html A 'Hello World' walkthrough for incoming webhooks. This demonstrates the simplest way to send a message to Zulip via a webhook. ```bash curl -X POST -H "Content-Type: application/json" --data '{"type": "stream", "to": "stream-name", "topic": "topic-name", "content": "Hello, Zulip!"}' YOUR_WEBHOOK_URL ``` -------------------------------- ### Provision and Start Zulip Development Environment (Windows WSL) Source: https://zulip.readthedocs.io/en/latest/_sources/development/setup-recommended.md.txt Install/update the Zulip development environment, activate the Python environment, and start the development server. If Windows Firewall prompts, click 'Allow access'. ```bash $ # Install/update the Zulip development environment $ ./tools/provision $ # Enter the Zulip Python environment $ source .venv/bin/activate $ # Start the development server $ ./tools/run-dev ``` -------------------------------- ### User Presence Endpoint Example Source: https://zulip.readthedocs.io/en/latest/documentation/openapi.html This example demonstrates the definition of the `/users/{user}/presence` endpoint, including its GET method, parameters, authentication, and response structure. ```APIDOC ## GET /users/{user}/presence ### Description Get presence data for another user. ### Method GET ### Endpoint `/users/{user}/presence` ### Parameters #### Path Parameters - **user** (string) - Required - Enter email address ### Authentication - basicAuth ### Response #### Success Response (200) - **msg** (string) - **result** (string) - **presence** (array) ``` -------------------------------- ### Example Ubuntu Welcome Message Source: https://zulip.readthedocs.io/en/latest/development/setup-recommended.html This is an example of the welcome message displayed after successfully SSHing into the Ubuntu-based development environment. It confirms the operating system version. ```text Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-92-generic x86_64) ``` -------------------------------- ### Enable and Start Docker Service Source: https://zulip.readthedocs.io/en/latest/development/setup-recommended.html If the Docker service is not running, use these commands to unmask, enable, and start it. This is necessary if an Ubuntu bug prevents automatic startup after installation. ```bash sudo systemctl unmask docker sudo systemctl enable docker sudo systemctl start docker ``` -------------------------------- ### Provision and Run Zulip Development Server Source: https://zulip.readthedocs.io/en/latest/_sources/development/setup-advanced.md.txt After cloning the repository and ensuring Python 3 is installed, run the provisioning script, activate the virtual environment, and start the development server. ```bash # From inside a clone of zulip.git: ./tools/provision source .venv/bin/activate ./tools/run-dev # starts the development server ``` -------------------------------- ### Iterate on Installer Changes Source: https://zulip.readthedocs.io/en/latest/_sources/development/test-install.md.txt Updates specific directories within the release directory using rsync and then re-runs the installer to test the changes. This starts a new container with the updated files. ```bash rsync -az scripts puppet zulip-test-installer/zulip-server/ sudo ./tools/test-install/install \ -r jammy \ ./zulip-test-installer/ \ --hostname=zulip.example.net \ --email=username@example.net ``` -------------------------------- ### Install Core Services (Ubuntu/WSL) Source: https://zulip.readthedocs.io/en/latest/development/setup-recommended.html Installs RabbitMQ, Memcached, Redis, and PostgreSQL, which are essential services for Zulip development. ```bash $ sudo apt install rabbitmq-server memcached redis-server postgresql ```