### Set Up Development Environment with Docker Source: https://docs.chiefonboarding.com/development This snippet demonstrates the initial setup for the ChiefOnboarding development environment. It involves copying an example environment file and then starting the Docker containers. Ensure Docker is installed and running. ```bash cp .example_env .env docker-compose up ``` -------------------------------- ### OAuth Example Configuration Source: https://docs.chiefonboarding.com/integrations/oauth A concrete JSON example demonstrating the structure of the OAuth configuration, including refresh token logic. ```APIDOC ## OAuth Example Configuration ### Description This example illustrates a complete OAuth configuration, showing how to set up the `refresh`, `access_token`, and `authenticate_url` properties, including placeholders for client IDs, secrets, and redirect URLs. ### Request Body Example ```json { "oauth": { "refresh": { "url": "https://oauth2.googleapis.com/token", "data": { "client_id": "{{ CLIENT_ID }}", "grant_type": "refresh_token", "client_secret": "{{ CLIENT_SECRET }}", "refresh_token": "{{ oauth.refresh_token }}" }, "method": "POST" }, "access_token": { "url": "https://oauth2.googleapis.com/token?client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}&grant_type=authorization_code&redirect_uri={{redirect_url}}", "method": "POST" }, "authenticate_url": "https://accounts.google.com/o/oauth2/v2/auth?client_id={{CLIENT_ID}}&redirect_uri={{redirect_url}}&response_type=code&scope=https://www.googleapis.com/auth/admin.directory.user&access_type=offline&prompt=consent" } } ``` ``` -------------------------------- ### ChiefOnboarding SSO Configuration Example Source: https://docs.chiefonboarding.com/config/oidc Provides a complete configuration example for setting up OIDC SSO in ChiefOnboarding. It includes settings for social account providers, user auto-creation, role mapping patterns, and the path to role information within the OIDC return data. ```python SOCIALACCOUNT_PROVIDERS={"openid_connect": {"APPS": [{"provider_id": "other-server",...}]}} SSO_AUTO_CREATE_USER=True OIDC_ROLE_NEW_HIRE_PATTERN='^cn=Newhires.*' OIDC_ROLE_ADMIN_PATTERN='^cn=Administrators.*' OIDC_ROLE_MANAGER_PATTERN='^cn=Managers.*' OIDC_ROLE_PATH_IN_RETURN='groups' ALLAUTH_PROVIDERS="openid_connect" ``` -------------------------------- ### Exists Configuration Example (JSON) Source: https://docs.chiefonboarding.com/integrations/exists This example demonstrates the structure of the 'exists' configuration in JSON format. It specifies the API endpoint, HTTP method, expected response content, and acceptable status codes for verifying user existence. ```json { "exists": { "url": "https://app.asana.com/api/1.0/users/{{email}}", "method": "GET", "expected": "{{email}}", "status_code": [200, 201] } } ``` -------------------------------- ### Example JSON Headers for API Requests Source: https://docs.chiefonboarding.com/integrations/headers This example demonstrates the structure of JSON headers typically sent with API requests. It includes common headers like Accept, Content-Type, and Authorization, with a placeholder for an authentication token. ```json { "headers": { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer {{TOKEN}}" } } ``` -------------------------------- ### Authenticate API Request (bash) Source: https://docs.chiefonboarding.com/api Example of how to authenticate an API request using a generated token. The `Authorization` header should contain `Token` followed by the actual token obtained from the `drf_create_token` command. This is a general example for making authenticated calls. ```bash curl -H "Authorization: Token xxxxxxxxxxxxxxx" https://YOURDOMAIN/api/employees/ ``` -------------------------------- ### Run Docker Compose for ChiefOnboarding Source: https://docs.chiefonboarding.com/deployment/docker Command to start ChiefOnboarding services defined in the docker-compose.yml file. This command brings up all defined services, including the database and the web application. ```bash docker-compose up ``` -------------------------------- ### OAuth Configuration Example (JSON) Source: https://docs.chiefonboarding.com/integrations/oauth This JSON snippet demonstrates the configuration structure for OAuth2 authentication. It includes settings for token refresh, token access, and the authentication URL, utilizing template variables for dynamic values. ```json "oauth": { "refresh": { "url": "https://oauth2.googleapis.com/token", "data": { "client_id": "{{ CLIENT_ID }}", "grant_type": "refresh_token", "client_secret": "{{ CLIENT_SECRET }}", "refresh_token": "{{ oauth.refresh_token }}" }, "method": "POST" }, "access_token": { "url": "https://oauth2.googleapis.com/token?client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}&grant_type=authorization_code&redirect_uri={{redirect_url}}", "method": "POST" }, "authenticate_url": "https://accounts.google.com/o/oauth2/v2/auth?client_id={{CLIENT_ID}}&redirect_uri={{redirect_url}}&response_type=code&scope=https://www.googleapis.com/auth/admin.directory.user&access_type=offline&prompt=consent" } ``` -------------------------------- ### Form Configuration: Dynamic Options JSON Example Source: https://docs.chiefonboarding.com/integrations/form Illustrates how to configure a form item to fetch options dynamically from a URL. This includes specifying the URL, HTTP method, headers, and how to extract the relevant data from the response. ```json { "data": { "items": [ {"id": "123", "name": "option"}, {"id": "124", "name": "option2"} ] } } ``` -------------------------------- ### Example JSON Response with Employee Data Source: https://docs.chiefonboarding.com/integrations/data-structure This is an example of the JSON response structure expected from a third-party service when using 'data_from':'employees'. It contains an array of employee objects, each with 'firstName', 'lastName', and 'workEmail' properties. ```json { "employees": [ { "firstName": "John", "lastName": "Do", "workEmail": "john@do.com" }, { "firstName": "Jane", "lastName": "Do", "workEmail": "jane@do.com" } ] } ``` -------------------------------- ### Get Sequences Source: https://docs.chiefonboarding.com/api Retrieves a list of all available sequences. This is used to get the IDs of sequences that should be assigned to a new hire. ```APIDOC ## GET /api/sequences/ ### Description Retrieves a list of all available sequences. ### Method GET ### Endpoint /api/sequences/ ### Parameters #### Query Parameters None ### Request Example ```bash curl -H "Authorization: Token xxxxxxxxxxxxxxx" https://YOURDOMAIN/api/sequences/ ``` ### Response #### Success Response (200) - **list** (array) - A list of sequence objects. #### Response Example ```json [ { "id": 3, "name": "Onboarding Sequence A" } ] ``` ``` -------------------------------- ### Configure Google SSO Environment Variables Source: https://docs.chiefonboarding.com/config/google-sso These environment variables are essential for enabling and configuring Google SSO within the ChiefOnboarding application. Ensure these are set in your environment to activate the 'Log in with Google' functionality. ```shell ALLOW_GOOGLE_SSO=True GOOGLE_SSO_CLIENT_ID=xxxxx GOOGLE_SSO_SECRET=xxxxx ``` ```shell SSO_AUTO_CREATE_USER=True ``` ```shell ALLOW_LOGIN_WITH_CREDENTIALS=False ``` -------------------------------- ### Deploy ChiefOnboarding with Docker Compose (Caddy) Source: https://docs.chiefonboarding.com/deployment/docker This Docker Compose configuration sets up ChiefOnboarding with a PostgreSQL database and Caddy as a reverse proxy for HTTPS. Ensure Docker and Docker Compose are installed. Environment variables like SECRET_KEY and DATABASE_URL should be customized. ```yaml version: '3' services: db: image: postgres:latest restart: always expose: - "5432" volumes: - pgdata:/var/lib/postgresql/data/ environment: - POSTGRES_DB=chiefonboarding - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres networks: - global web: image: chiefonboarding/chiefonboarding:latest restart: always expose: - "8000" environment: - SECRET_KEY=somethingsupersecret - DATABASE_URL=postgres://postgres:postgres@db:5432/chiefonboarding - ALLOWED_HOSTS=test.chiefonboarding.com depends_on: - db networks: - global caddy: image: caddy:2.3.0-alpine restart: unless-stopped ports: - "80:80" - "443:443" volumes: - $PWD/Caddyfile:/etc/caddy/Caddyfile - $PWD/site:/srv - caddy_data:/data - caddy_config:/config networks: - global volumes: pgdata: caddy_data: caddy_config: networks: global: ``` -------------------------------- ### Get List of Sequences (bash) Source: https://docs.chiefonboarding.com/api Retrieve a list of all available sequences. This is necessary to obtain the IDs of sequences that can be assigned to a new hire during the creation process. Requires token authentication. ```bash curl -H "Authorization: Token xxxxxxxxxxxxxxx" https://YOURDOMAIN/api/sequences/ ``` -------------------------------- ### Form Configuration: Fixed Options JSON Example Source: https://docs.chiefonboarding.com/integrations/form Defines a form item with a predefined list of options. The 'items' field takes an array of objects, each with an 'id' and 'name' for the option. ```json [ {"id": "233", "name": "option 1"}, {"id": "234", "name": "option 2"} ] ``` -------------------------------- ### OIDC Role Mapping Example Source: https://docs.chiefonboarding.com/config/oidc Demonstrates how to map user roles from an OpenID Connect server to ChiefOnboarding roles. It shows how to specify nested JSON paths for role information and provides patterns for Admin, Manager, and Newhire roles using regex. ```json { "A": "A", "B": { "roles": [ "ROLE_A", "ROLE_B" ] } } ``` -------------------------------- ### New Hire Payload Structure (json) Source: https://docs.chiefonboarding.com/api Example JSON structure for creating a new hire. This defines the required and optional fields, including `first_name`, `last_name`, `email`, `role`, and other attributes like `buddy`, `manager`, `timezone`, and `sequences` which reference IDs obtained from other API calls. ```json { "first_name": "James", "last_name": "Weller", "email": "james@chiefonboarding.com", "phone": "1233444", "position": "Technical lead", "language": "en", "message": "This is our new hire....", "start_day": "2020-12-04", "buddy": 4, "manager": 3, "timezone": "UTC", "sequences": [5, 3], "role": 0 } ``` -------------------------------- ### Accessing Previous Request Data in Integrations Source: https://docs.chiefonboarding.com/integrations/intro Demonstrates how to reference data from previous requests within an integration sequence. This allows for dynamic updates and data chaining between integration steps. The `responses` object stores data from prior requests, indexed starting from 0. ```json { "form_id": 134 } ``` ```N/A {{ responses.0.form_id }} ``` -------------------------------- ### Common Request Headers Source: https://docs.chiefonboarding.com/integrations/headers This section details the default headers that should be sent with every request to the ChiefOnboarding API. These can be overridden on a per-request basis. It includes examples for authentication tokens and content type. ```APIDOC ## Common Request Headers ### Description These headers are sent with every request by default, but can be overwritten by headers set on a specific request. These headers often include authentication tokens and content type specifications. ### Method N/A (Describes general request structure) ### Endpoint N/A (Applies to all endpoints) ### Parameters #### Header Parameters - **Accept** (string) - Required - Specifies the desired response format, typically 'application/json'. - **Content-Type** (string) - Required - Indicates the media type of the request body, typically 'application/json'. - **Authorization** (string) - Optional - Contains authentication credentials, often a Bearer token in the format 'Bearer {{TOKEN}}'. ### Request Example ```json { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer {{TOKEN}}" } ``` ### Response #### Success Response (200) N/A (This section describes request headers, not specific responses) #### Response Example N/A ``` -------------------------------- ### Save API Response as a File in ChiefOnboarding Source: https://docs.chiefonboarding.com/integrations/execute The 'save_as_file' option allows saving a file returned in an API response to a specified filename. This file can then be referenced and used in subsequent requests within the same integration flow, for example, when uploading files. ```json "save_as_file": "filename.png" ``` -------------------------------- ### Twilio Environment Variables Configuration (INI) Source: https://docs.chiefonboarding.com/config/textmessages Example configuration for Twilio environment variables required to send text messages. These variables include the Twilio phone number, account SID, and authentication token. Ensure these are set in your environment or a .env file for authentication and message origination. ```ini TWILIO_FROM_NUMBER=+XXXXXXXXX TWILIO_ACCOUNT_SID=ACXXXXXXXXX TWILIO_AUTH_TOKEN=XXXXXXXXX ``` -------------------------------- ### AWS S3 Environment Variables (INI) Source: https://docs.chiefonboarding.com/config/objectstorage Example environment variables for configuring ChiefOnboarding to use AWS S3 for storage. These variables include the S3 endpoint URL, access key ID, secret access key, bucket name, and default region. ```ini AWS_S3_ENDPOINT_URL=https://s3.eu-west-1.amazonaws.com AWS_ACCESS_KEY_ID=AKIAXXXXXXXX AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXX AWS_STORAGE_BUCKET_NAME=bucket-name AWS_DEFAULT_REGION=eu-west-1 ``` -------------------------------- ### Data Payload Example for Revoke Request Source: https://docs.chiefonboarding.com/integrations/revoke This example shows the structure of the data payload that can be sent with a revoke request. It typically includes identifying information for the user whose access is being revoked. ```json { "id": 123 } ``` -------------------------------- ### Create New Hire (bash) Source: https://docs.chiefonboarding.com/api Create a new hire by sending a POST request to the `/api/users/` endpoint. The request must include a JSON payload with required fields like `first_name`, `last_name`, `email`, and `role`, along with optional fields such as `buddy`, `manager`, `timezone`, and `sequences`. Token authentication is mandatory. ```bash curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Token xxxxxxxxxxxxxxx" -d '{"first_name":"James","last_name":"Weller","email":"james@chiefonboarding.com","phone":"","position":"Technical lead","language":"en","message":"","start_day":"2020-12-04","buddy":4,"timezone":"UTC","sequences":[3], "role":0}' https://YOURDOMAIN/api/users/ ``` -------------------------------- ### Get Employees Source: https://docs.chiefonboarding.com/api Retrieves a list of all employees currently in ChiefOnboarding. This is useful for obtaining employee IDs to assign as buddies or managers to new hires. ```APIDOC ## GET /api/employees/ ### Description Retrieves a list of all employees. ### Method GET ### Endpoint /api/employees/ ### Parameters #### Query Parameters None ### Request Example ```bash curl -H "Authorization: Token xxxxxxxxxxxxxxx" https://YOURDOMAIN/api/employees/ ``` ### Response #### Success Response (200) - **list** (array) - A list of employee objects. #### Response Example ```json [ { "id": 1, "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com" } ] ``` ``` -------------------------------- ### Get Redirect URL (Template) Source: https://docs.chiefonboarding.com/integrations/oauth This template variable provides the unique redirect URL for each integration, which is often required by OAuth providers during the authorization flow. ```template {{ redirect_url }} ``` -------------------------------- ### POST /api/users/ Source: https://docs.chiefonboarding.com/api Creates a new hire. Requires authentication with a token. This endpoint allows specifying details like name, email, position, buddy, manager, timezone, and assigned sequences. ```APIDOC ## POST /api/users/ ### Description Creates a new hire with specified details. ### Method POST ### Endpoint /api/users/ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **first_name** (string) - Required - The first name of the new hire. - **last_name** (string) - Required - The last name of the new hire. - **email** (string) - Required - The business email address of the new hire. - **phone** (string) - Optional - The phone number of the new hire. - **position** (string) - Optional - The job position of the new hire. - **language** (string) - Optional - The preferred language for communications (e.g., 'en'). - **message** (string) - Optional - A custom message for the new hire. - **start_day** (string) - Optional - The start date of the new hire (YYYY-MM-DD). Defaults to the current day if not provided. - **buddy** (integer) - Optional - The ID of the employee to be assigned as a buddy. - **manager** (integer) - Optional - The ID of the employee to be assigned as a manager. - **timezone** (string) - Optional - The timezone for the new hire (e.g., 'UTC'). Defaults to the organization's timezone if not provided. - **sequences** (array of integers) - Optional - An array of sequence IDs to assign to the new hire. - **role** (integer) - Required - The role of the user. Options: 0 (new hire), 1 (administrator), 2 (manager), 3 (other). ### Request Example ```json { "first_name": "James", "last_name": "Weller", "email": "james@chiefonboarding.com", "phone": "1233444", "position": "Technical lead", "language": "en", "message": "This is our new hire....", "start_day": "2020-12-04", "buddy": 4, "manager": 3, "timezone": "UTC", "sequences": [3], "role": 0 } ``` ### Response #### Success Response (200) - **object** (object) - The full new hire object including the ID of the newly created hire. #### Response Example ```json { "id": 10, "first_name": "James", "last_name": "Weller", "email": "james@chiefonboarding.com", "phone": "1233444", "position": "Technical lead", "language": "en", "message": "This is our new hire....", "start_day": "2020-12-04", "buddy": 4, "manager": 3, "timezone": "UTC", "sequences": [3], "role": 0 } ``` ``` -------------------------------- ### Configure Caddy Reverse Proxy for ChiefOnboarding Source: https://docs.chiefonboarding.com/deployment/docker This Caddyfile configures Caddy to act as a reverse proxy, forwarding requests for a specified domain to the ChiefOnboarding web service running on port 8000. Replace 'test.chiefonboarding.com' with your actual domain. ```ini test.chiefonboarding.com { reverse_proxy web:8000 } ``` -------------------------------- ### Enable Debug Logging Source: https://docs.chiefonboarding.com/development To enable more detailed log messages for development and debugging purposes, set the DEBUG_LOGGING environment variable to True. This is a configuration setting within the project's environment. ```ini DEBUG_LOGGING = True ``` -------------------------------- ### Schedule Integration with Cron Notation (JSON) Source: https://docs.chiefonboarding.com/integrations/schedule This JSON object demonstrates how to schedule background integrations for user creation and updates. By providing a `schedule` property with cron notation, the integration will run automatically in the background. This eliminates the need for manual execution and ensures continuous user management. ```json { "schedule": "* 1 * * * *" } ``` -------------------------------- ### Update Existing Translations Source: https://docs.chiefonboarding.com/development This command updates all current translation files based on the latest changes in the source code. It ensures that existing translations are kept up-to-date with the project's codebase. ```bash docker-compose run --rm web django-admin makemessages -a ``` -------------------------------- ### Docker Compose Configuration for ChiefOnboarding Services Source: https://docs.chiefonboarding.com/config/objectstorage Defines the services, networks, and volumes for the ChiefOnboarding project. It includes configurations for a PostgreSQL database, the main web application, Caddy for reverse proxying, and Minio for object storage. Environment variables are set for each service to control their behavior and connections. ```yaml version: '3' services: db: image: postgres:latest restart: always expose: - "5432" volumes: - pgdata:/var/lib/postgresql/data/ environment: - POSTGRES_DB=chiefonboarding - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres networks: - global web: image: chiefonboarding/chiefonboarding:latest restart: always expose: - "8000" environment: - SECRET_KEY=somethingsupersecret - DATABASE_URL=postgres://postgres:postgres@db:5432/chiefonboarding - ALLOWED_HOSTS=test.chiefonboarding.com - AWS_S3_ENDPOINT_URL=https://minio.chiefonboarding.com - AWS_ACCESS_KEY_ID=chief - AWS_SECRET_ACCESS_KEY=chiefpass - AWS_STORAGE_BUCKET_NAME=test-bucket - AWS_DEFAULT_REGION=us-east-1 depends_on: - db networks: - global caddy: image: caddy:2.3.0-alpine restart: unless-stopped ports: - "80:80" - "443:443" volumes: - $PWD/Caddyfile:/etc/caddy/Caddyfile - $PWD/site:/srv - caddy_data:/data - caddy_config:/config networks: - global minio-server: image: minio/minio expose: - "9000" - "9001" volumes: - ./storage/minio:/data environment: - MINIO_ROOT_USER=chief - MINIO_ROOT_PASSWORD=chiefpass - MINIO_DOMAIN=http://minio.chiefonboarding.com command: server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /data networks: - global volumes: pgdata: caddy_data: caddy_config: networks: global: ``` -------------------------------- ### Configure SMTP Email Server Source: https://docs.chiefonboarding.com/config/email Sets up email sending via a generic SMTP server. Requires host, port, user credentials, and TLS/SSL configuration. Only one of EMAIL_USE_TLS or EMAIL_USE_SSL should be True. ```ini EMAIL_HOST=smtp.chiefonboarding.com EMAIL_PORT=587 EMAIL_HOST_USER=exampleuser EMAIL_HOST_PASSWORD=examplePass EMAIL_USE_TLS=False EMAIL_USE_SSL=True ``` -------------------------------- ### Caddy Reverse Proxy Configuration for ChiefOnboarding Services Source: https://docs.chiefonboarding.com/config/objectstorage Configures Caddy to act as a reverse proxy for different domain names pointing to the ChiefOnboarding web application and Minio services. It specifies how incoming requests are routed to the respective backend services based on the requested domain. ```bash test.chiefonboarding.com { reverse_proxy web:8000 } minio.chiefonboarding.com { reverse_proxy minio-server:9000 } minio-console.chiefonboarding.com { reverse_proxy minio-server:9001 } ``` -------------------------------- ### Define Initial Data Form - JSON Source: https://docs.chiefonboarding.com/integrations/initial-data-form This JSON structure defines the fields for the initial data form. Each field has an 'id' for referencing, a 'name' for the label, and an optional 'description' for help text. Fields with 'name' set to 'generate' are not displayed in the form but are used to generate secret values. ```json "initial_data_form": [ { "id": "TOKEN", "name": "Please put your token here", "description": "You can find your token here: https://...." }, { "id": "ORG", "name": "Organization id", "description": "You can find your organization id here: https://..." }, { "id": "PASSWORD", "name": "generate" }, { "id": "EMAIL_HASH", "name": "generate" } ] ``` -------------------------------- ### Enable API Access (ini) Source: https://docs.chiefonboarding.com/api To enable the API, set the `API_ACCESS` environment variable to `True`. This is a simple configuration setting required before using the API functionalities. ```ini API_ACCESS=True ``` -------------------------------- ### Add New Language Translations Source: https://docs.chiefonboarding.com/development This command generates new translation files for a specified language. Replace 'lang' with the shortname of the language you wish to add. The output is a .po file that needs to be filled in. After generating the file, the language must be added to the project's settings. ```bash docker-compose run --rm web django-admin makemessages -l lang ``` -------------------------------- ### Default Custom Email Template Structure Source: https://docs.chiefonboarding.com/config/email An example of the default HTML structure for custom email templates in ChiefOnboarding. It uses Django template tags for dynamic content rendering, such as paragraphs, headers, lists, images, files, and buttons. Content within brackets should not be modified. ```html {% autoescape off %} {% for i in content %} {% if i.type == 'paragraph' %}
{{i.data.text|personalize:user}}
{% endif %} {% if i.type == 'header' %}