### Setup Environment Variables Source: https://docs.dograh.com/contribution/setup Copy the example environment variable files for both the API and UI to create their respective configuration files. ```bash cp api/.env.example api/.env && cp ui/.env.example ui/.env ``` ```powershell Copy-Item api/.env.example api/.env Copy-Item ui/.env.example ui/.env ``` -------------------------------- ### Start Dograh AI on Remote Server Source: https://docs.dograh.com/deployment/docker After running the setup script, use this command to start Dograh AI services on your remote server. Ensure you are in the 'dograh' directory. ```bash cd dograh sudo docker compose --profile remote up --pull always ``` -------------------------------- ### Setup Dograh with Docker Source: https://docs.dograh.com Use this command to download the docker-compose.yaml file and start Dograh using Docker. Set ENABLE_TELEMETRY to false to opt out of anonymous usage data collection. ```bash curl -o docker-compose.yaml https://raw.githubusercontent.com/dograh-hq/dograh/main/docker-compose.yaml && REGISTRY=ghcr.io/dograh-hq ENABLE_TELEMETRY=true docker compose up --pull always ``` -------------------------------- ### Quick Start Local Docker Deployment Source: https://docs.dograh.com/deployment/docker Use this command to download and start Dograh AI for local development. It fetches the docker-compose.yaml file and starts all necessary services. ```bash curl -o docker-compose.yaml https://raw.githubusercontent.com/dograh-hq/dograh/main/docker-compose.yaml && REGISTRY=ghcr.io/dograh-hq ENABLE_TELEMETRY=true docker compose up --pull always ``` -------------------------------- ### Start the UI Source: https://docs.dograh.com/contribution/setup Navigate to the UI directory and start the development server using npm. ```bash cd ui && npm run dev ``` -------------------------------- ### Start Backend Services Source: https://docs.dograh.com/contribution/setup Start the backend development services using the provided script. ```bash bash scripts/start_services_dev.sh ``` ```powershell .\scripts\start_services_dev.ps1 ``` -------------------------------- ### Minimal Workflow Example Source: https://docs.dograh.com/developer/workflow-schema A basic workflow structure with start and end nodes, and an edge connecting them. This serves as a foundational example for creating workflows. ```json { "nodes": [ { "id": "start-1", "type": "startCall", "position": { "x": 0, "y": 0 }, "data": { "name": "Start", "prompt": "You are a friendly assistant. Greet the caller and ask how you can help." } }, { "id": "end-1", "type": "endCall", "position": { "x": 400, "y": 0 }, "data": { "name": "End", "prompt": "Thank the caller and say goodbye." } } ], "edges": [ { "id": "edge-1", "source": "start-1", "target": "end-1", "data": { "label": "Done", "condition": "The caller's question has been answered and they want to end the call" } } ] } ``` -------------------------------- ### Automated Custom Domain Setup Script Source: https://docs.dograh.com/deployment/custom-domain Run this script to automatically configure your custom domain, install Certbot, generate SSL certificates, and update Nginx. Ensure you are in the directory where `setup_remote.sh` was run. ```bash curl -o setup_custom_domain.sh https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/setup_custom_domain.sh && chmod +x setup_custom_domain.sh && sudo ./setup_custom_domain.sh ``` -------------------------------- ### Install Dograh SDK for Python Source: https://docs.dograh.com/sdks/introduction Install the Python SDK using pip. This is the first step to programmatically interact with Dograh. ```bash pip install dograh-sdk ``` -------------------------------- ### Start Campaign Source: https://docs.dograh.com/llms.txt Start dialing contacts in a campaign. ```APIDOC ## Start Campaign ### Description Start dialing contacts in a campaign. ### Method POST ### Endpoint `/campaigns/start` ### Request Body - **campaign_id** (string) - Required - The ID of the campaign to start. ``` -------------------------------- ### Install Dograh SDK for TypeScript Source: https://docs.dograh.com/sdks/introduction Install the TypeScript SDK using npm. This is the first step to programmatically interact with Dograh. ```bash npm install @dograh/sdk ``` -------------------------------- ### Install UI Dependencies Source: https://docs.dograh.com/contribution/setup Navigate to the UI directory, install its Node.js dependencies using npm, and return to the root directory. ```bash cd ui && npm install && cd .. ``` -------------------------------- ### Install Python Requirements Source: https://docs.dograh.com/contribution/setup Install all Python dependencies required for the backend API by referencing the requirements file. ```bash pip install -r api/requirements.txt ``` -------------------------------- ### Start Local Docker Services Source: https://docs.dograh.com/contribution/setup Start the local Docker services for the database (Postgres), Redis cache, and Minio object storage using the provided docker compose file. Ensure no conflicting services are running. ```bash docker compose -f docker-compose-local.yaml up -d ``` -------------------------------- ### Setup Pipecat Git Submodule Source: https://docs.dograh.com/contribution/setup Initialize and update the pipecat git submodule using the provided setup script. ```bash bash scripts/setup_pipecat.sh ``` ```powershell .\scripts\setup_pipecat.ps1 ``` -------------------------------- ### Start Campaign Source: https://docs.dograh.com/api-reference/campaigns/start Initiates the execution of a specified campaign. ```APIDOC ## POST /api/v1/campaign/{campaign_id}/start ### Description Start campaign execution. ### Method POST ### Endpoint /api/v1/campaign/{campaign_id}/start ### Parameters #### Path Parameters - **campaign_id** (integer) - Required - The ID of the campaign to start. #### Header Parameters - **authorization** (string) - Optional - Authentication token. - **X-API-Key** (string) - Optional - API key for authentication. ### Responses #### Success Response (200) - **CampaignResponse** (object) - Details of the campaign after starting. #### Error Responses - **404** - Not found. - **422** - Validation Error. ``` -------------------------------- ### Start a campaign Source: https://docs.dograh.com/api-reference/campaigns Initiate a paused or draft campaign to start dialing contacts. ```APIDOC ## POST /campaign/{campaign_id}/start ### Description Starts a campaign, transitioning it to the 'running' state to begin dialing contacts. ### Method POST ### Endpoint /campaign/{campaign_id}/start ### Parameters #### Path Parameters - **campaign_id** (string) - Required - The unique identifier of the campaign to start. ``` -------------------------------- ### Install Certbot on Amazon Linux/RHEL Source: https://docs.dograh.com/deployment/custom-domain Install the Certbot client on systems using yum package manager. ```bash sudo yum install certbot -y ``` -------------------------------- ### Automated Remote Server Setup Script Source: https://docs.dograh.com/deployment/docker Run this script to automate the setup of Dograh AI on a remote server. It configures the environment, including Nginx and SSL certificates. ```bash curl -o setup_remote.sh https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/setup_remote.sh && chmod +x setup_remote.sh && ./setup_remote.sh ``` -------------------------------- ### Install Certbot on Ubuntu/Debian Source: https://docs.dograh.com/deployment/custom-domain Install the Certbot client, which is used to automatically generate and renew SSL certificates from Let's Encrypt. ```bash sudo apt update sudo apt install certbot -y ``` -------------------------------- ### API Key Authentication Example Source: https://docs.dograh.com/api-reference/authentication Demonstrates how to authenticate a request using an API key passed in the `X-API-Key` header. ```APIDOC ## API key authentication API keys are the recommended way to authenticate programmatic requests. Pass your key in the `X-API-Key` request header. ```bash curl https://your-dograh-instance/api/v1/workflow/fetch \ -H "X-API-Key: dg_your_api_key" ``` API keys are scoped to an organization. All resources created or accessed using a key belong to that organization. ``` -------------------------------- ### Log in to get a session token Source: https://docs.dograh.com/api-reference/api-keys/create Use this command to log in and obtain a session token. The token is required for subsequent API requests, including creating an API key. Ensure you replace 'you@example.com' and 'your-password' with your actual credentials. ```bash curl -X POST https://your-dograh-instance/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email": "you@example.com", "password": "your-password"}' ``` -------------------------------- ### Get Campaign Progress Source: https://docs.dograh.com/llms.txt Get the current progress of a campaign. ```APIDOC ## Get Campaign Progress ### Description Get the current progress of a campaign. ### Method GET ### Endpoint `/campaigns/progress/{campaign_id}` ### Parameters #### Path Parameters - **campaign_id** (string) - Required - The ID of the campaign to get progress for. ``` -------------------------------- ### Get Agent Count Source: https://docs.dograh.com/llms.txt Get the total number of agents broken down by status. ```APIDOC ## Get Agent Count ### Description Get the total number of agents broken down by status. ### Method GET ### Endpoint `/agents/count` ``` -------------------------------- ### Initial Context Example Source: https://docs.dograh.com/voice-agent/api-trigger Demonstrates how to use the `initial_context` object to pass data to the voice agent, which can be referenced using template variables. ```APIDOC ## Initial Context ### Description The `initial_context` object allows you to pass custom data to your voice agent. This data can be accessed within your agent's prompts using template variables (e.g., `{{initial_context.user.name}}`). ### Example Request Body ```json { "phone_number": "+14155550100", "initial_context": { "user": { "name": "John" } } } ``` ### Example Usage in Prompt `Hello, {{initial_context.user.name}}!` ``` -------------------------------- ### Get Agent Count Source: https://docs.dograh.com/api-reference/agents Get the total number of voice agents (workflows). ```APIDOC ## GET /workflow/count ### Description Returns the total count of voice agents (workflows). ### Method GET ### Endpoint /workflow/count ### Response #### Success Response (200) - **count** (integer) - The total number of workflows. ### Response Example { "example": "{\n \"count\": 10\n}" } ``` -------------------------------- ### Run Docker Compose with GitHub Container Registry Source: https://docs.dograh.com/getting-started/prerequisites This command initiates the Docker Compose setup using images from the GitHub Container Registry, which is the recommended default. ```bash REGISTRY=ghcr.io/dograh-hq docker compose up --pull always ``` -------------------------------- ### Dograh Data Flow Example Source: https://docs.dograh.com/core-concepts/context-and-variables Illustrates the data exchange between your system, Dograh, and the LLM, showing how initial context is used and gathered context is returned. ```mermaid sequenceDiagram participant App as Your System participant Dog as Dograh participant LLM as LLM App->>Dog: initial_context: {customer_name: "Jane", plan: "premium"} Dog->>LLM: Prompt with {{customer_name}} and {{plan}} substituted LLM-->>Dog: Conversation response Note over Dog,LLM: Call progresses... Dog->>LLM: Extract: did the customer confirm renewal? LLM-->>Dog: gathered_context: {renewal_confirmed: true} Dog-->>App: Run record with gathered_context ``` -------------------------------- ### Get Presigned S3 URL and Upload CSV Source: https://docs.dograh.com/api-reference/campaigns/upload-contacts Use this bash script to first get a presigned S3 URL for uploading a contacts CSV, and then to upload the CSV file to that URL. Ensure you replace 'your-dograh-instance' and 'dg_your_api_key' with your actual values. ```bash # Step 1: Get upload URL curl -X POST https://your-dograh-instance/api/v1/s3/presigned-upload-url \ -H "X-API-Key: dg_your_api_key" # Response: # { "upload_url": "https://...", "s3_key": "campaigns/..." } # Step 2: Upload the CSV curl -X PUT "https://presigned-url..." \ -H "Content-Type: text/csv" \ --data-binary @contacts.csv ``` -------------------------------- ### Get Workflow Run OpenAPI Specification Source: https://docs.dograh.com/api-reference/agents/runs/get This OpenAPI specification defines the GET request for retrieving a single workflow run by its ID. It includes parameters for workflow ID and run ID, and details the structure of the successful response and potential errors. ```yaml GET /api/v1/workflow/{workflow_id}/runs/{run_id} openapi: 3.1.0 info: title: Dograh API description: API for the Dograh app version: 1.0.0 servers: - url: https://app.dograh.com description: Production - url: http://localhost:8000 description: Local development security: [] paths: /api/v1/workflow/{workflow_id}/runs/{run_id}: get: tags: - main summary: Get Workflow Run operationId: get_workflow_run_api_v1_workflow__workflow_id__runs__run_id__get parameters: - name: workflow_id in: path required: true schema: type: integer title: Workflow Id - name: run_id in: path required: true schema: type: integer title: Run Id - name: authorization in: header required: false schema: anyOf: - type: string - type: 'null' title: Authorization - name: X-API-Key in: header required: false schema: anyOf: - type: string - type: 'null' title: X-Api-Key responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/WorkflowRunResponseSchema' '404': description: Not found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: WorkflowRunResponseSchema: properties: id: type: integer title: Id workflow_id: type: integer title: Workflow Id name: type: string title: Name mode: type: string title: Mode created_at: type: string format: date-time title: Created At is_completed: type: boolean title: Is Completed transcript_url: anyOf: - type: string - type: 'null' title: Transcript Url recording_url: anyOf: - type: string - type: 'null' title: Recording Url cost_info: anyOf: - additionalProperties: true type: object - type: 'null' title: Cost Info definition_id: anyOf: - type: integer - type: 'null' title: Definition Id initial_context: anyOf: - additionalProperties: true type: object - type: 'null' title: Initial Context gathered_context: anyOf: - additionalProperties: true type: object - type: 'null' title: Gathered Context call_type: $ref: '#/components/schemas/CallType' logs: anyOf: - additionalProperties: true type: object - type: 'null' title: Logs annotations: anyOf: - additionalProperties: true type: object - type: 'null' title: Annotations type: object required: - id - workflow_id - name - mode - created_at - is_completed - transcript_url - recording_url - cost_info - definition_id - call_type title: WorkflowRunResponseSchema HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError CallType: type: string enum: - inbound - outbound title: CallType ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type type: object required: - loc - msg - type title: ValidationError ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://docs.dograh.com/contribution/setup Create a Python virtual environment named 'venv' and activate it. This isolates project dependencies. ```bash python3 -m venv venv source venv/bin/activate ``` ```powershell python -m venv venv .\venv\Scripts\Activate.ps1 ``` -------------------------------- ### Create an API key Source: https://docs.dograh.com/api-reference/api-keys/create Use the obtained session token to create a new API key. The 'name' field is required and should be a descriptive name for your key. Store the returned key securely as it will only be shown once. ```bash curl -X POST https://your-dograh-instance/api/v1/user/api-keys \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"name": "my-api-key"}' ``` -------------------------------- ### Get Campaign Source: https://docs.dograh.com/llms.txt Retrieve a single campaign by ID. ```APIDOC ## Get Campaign ### Description Retrieve a single campaign by ID. ### Method GET ### Endpoint `/campaigns/{campaign_id}` ### Parameters #### Path Parameters - **campaign_id** (string) - Required - The ID of the campaign to retrieve. ``` -------------------------------- ### Initial Context Example Source: https://docs.dograh.com/voice-agent/api-trigger Pass custom data to your voice agent via the `initial_context` object. This data can be accessed within prompts using template variables like `{{initial_context.user.name}}`. ```json { "phone_number": "+14155550100", "initial_context": { "user": { "name": "John" } } } ``` -------------------------------- ### Get Run Source: https://docs.dograh.com/llms.txt Retrieve a single workflow run by ID. ```APIDOC ## Get Run ### Description Retrieve a single workflow run by ID. ### Method GET ### Endpoint `/agents/runs/{run_id}` ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the run to retrieve. ``` -------------------------------- ### Get a campaign Source: https://docs.dograh.com/api-reference/campaigns Retrieve details for a specific campaign by its ID. ```APIDOC ## GET /campaign/{campaign_id} ### Description Retrieves detailed information about a specific campaign. ### Method GET ### Endpoint /campaign/{campaign_id} ### Parameters #### Path Parameters - **campaign_id** (string) - Required - The unique identifier of the campaign to retrieve. ``` -------------------------------- ### Create Workflow from Template Source: https://docs.dograh.com/api-reference/agents Create a new voice agent (workflow) using a predefined template. ```APIDOC ## POST /workflow/create/template ### Description Creates a new voice agent (workflow) from a template. ### Method POST ### Endpoint /workflow/create/template ### Request Body (Schema not provided in source) ### Response (Schema not provided in source) ``` -------------------------------- ### Retrieve Call Details Source: https://docs.dograh.com/api-reference/calls/get-run Get the details, transcript, and recording for a call. ```APIDOC ## GET /runs/{run_id} ### Description Returns the full run record including call status, duration, transcript URL, recording URL, gathered context, and usage/cost info. ### Method GET ### Endpoint /runs/{run_id} ### Parameters #### Path Parameters - **run_id** (string) - Required - The unique identifier for the run. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the run. - **status** (string) - The current status of the run (e.g., 'completed', 'failed'). - **duration_seconds** (number) - The duration of the call in seconds. - **transcript_url** (string) - The URL to access the call transcript. - **recording_url** (string) - The URL to access the call recording. - **context** (object) - Any gathered context associated with the call. - **usage** (object) - Information about the usage and cost of the call. ``` -------------------------------- ### Making an API Trigger Request Source: https://docs.dograh.com/voice-agent/api-trigger Authenticate with your API key in the `X-API-Key` header. The request body requires a `phone_number` and can optionally include an `initial_context` object for passing data to the voice agent. ```bash curl -X POST https://your-dograh-instance/api/v1/public/agent/{uuid} \ -H "Content-Type: application/json" \ -H "X-API-Key: dg_your_api_key" \ -d '{ "phone_number": "+14155550100", "initial_context": { "customer_name": "Jane", "appointment_date": "March 15" } }' ``` -------------------------------- ### Overview Source: https://docs.dograh.com/llms.txt Interact with Dograh programmatically via the REST API. ```APIDOC ## Overview ### Description Interact with Dograh programmatically via the REST API. ### Base URL `https://api.dograh.com/v1` ``` -------------------------------- ### Initiate a Call (Authenticated) Source: https://docs.dograh.com/llms.txt Start an outbound call with more control than the public endpoint. ```APIDOC ## Initiate a Call (Authenticated) ### Description Start an outbound call with more control than the public endpoint. ### Method POST ### Endpoint `/calls/initiate` ### Request Body - **agent_id** (string) - Required - The ID of the agent to use for the call. - **to_number** (string) - Required - The phone number to call. - **from_number** (string) - Optional - The phone number to display as the caller ID. - **metadata** (object) - Optional - Custom data to associate with the call. ``` -------------------------------- ### Get Campaign Runs Source: https://docs.dograh.com/llms.txt Retrieve individual call records for each contact in a campaign. ```APIDOC ## Get Campaign Runs ### Description Retrieve individual call records for each contact in a campaign. ### Method GET ### Endpoint `/campaigns/runs/{campaign_id}` ### Parameters #### Path Parameters - **campaign_id** (string) - Required - The ID of the campaign to retrieve runs for. ``` -------------------------------- ### API Keys Overview Source: https://docs.dograh.com/llms.txt Create and manage API keys for programmatic access. ```APIDOC ## API Keys Overview ### Description Create and manage API keys for programmatic access. ### Endpoint `/api-keys` (Conceptual - specific operations are detailed in sub-paths) ```