### Start Pipecat Voice Agent Bot Server Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/websocket/README.md This snippet demonstrates how to set up and run the Pipecat voice agent bot server. It involves creating a virtual environment, installing Python dependencies, and configuring environment variables with API keys. The server is then launched using a Python script. ```bash python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` ```bash pip install -r requirements.txt ``` ```bash cp env.example .env ``` ```bash python server/server.py ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel-chatbot/inbound/README.md Installs project dependencies using the 'uv' package manager within a virtual environment. This is a crucial setup step for running the chatbot. ```sh cd inbound uv sync ``` -------------------------------- ### Get ExoPhone Beta using Python (requests) Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Python example demonstrates how to use the 'requests' library to send a POST request to the Exotel API to get an ExoPhone. It defines the request data and sends the POST request, capturing the response. ```python import requests data = { 'PhoneNumber': 'XXXXX30240' } requests.post('https://:/v2_beta/Accounts//IncomingPhoneNumbers', data=data) ``` -------------------------------- ### Get Campaign Call Details with cURL Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Example using cURL to fetch call details for a campaign. It demonstrates how to set authentication headers and query parameters for filtering and pagination. ```shell curl https://:/v2/accounts//campaigns/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0 ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel-chatbot/outbound/README.md Installs project dependencies using the 'uv' package manager. Assumes 'uv' is installed and the project has a 'uv.lock' file. ```bash cd outbound uv sync ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/whatsapp/README.md Installs project dependencies using the 'uv' package manager. Ensure 'uv' is installed in your environment before running this command. ```bash uv sync ``` -------------------------------- ### Fetch Call Records using Python Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Python example uses the 'requests' library to make a GET request to the Pipecat API endpoint for fetching call records. Ensure you have the 'requests' library installed (`pip install requests`). ```python import requests\n\nrequests.get('https://:/v1/Accounts//Calls') ``` -------------------------------- ### Get Campaign Details using Go Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Go program demonstrates fetching campaign details using the standard 'net/http' package. It encodes credentials for the Authorization header and makes an HTTP GET request. The response status and body are then printed. ```go package main import ( b64 "encoding/base64" "fmt" "io/ioutil" "net/http" ) func main() { // Please provide accountSid, authToken from your Exotel account accountSid := "XXXXXXXXX" authToken := "YYYYYYYY" authKey := "ZZZZZZZZZZ" // Encoding the accountSid and authToken, used in Authorization header encoding := b64.StdEncoding.EncodeToString([]byte(authKey + ":" + authToken)) url := "https://api.exotel.com/v2/accounts/" + accountSid + "/campaigns/491dd6c97d64475ba0ce346a18530ce5" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Basic "+encoding) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Campaign Details using Node.js Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Node.js example uses the 'request' library to fetch campaign details. It constructs the authorization header using base64 encoding of your API key and token. The response body containing campaign details is then logged to the console. ```javascript var request = require("request"); var accountSid = "XXXXXXXXX"; var accountToken = "YYYYYYYYY"; var authKey = "ZZZZZZZZZZ"; var encoding = Buffer.from(authKey + ':' + accountToken).toString('base64') var options = { method: 'GET', url: 'https://api.exotel.com/v2/accounts/'+ accountSid +'/campaigns/491dd6c97d64475ba0ce346a18530ce5', headers: { Authorization: 'Basic ' + encoding } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Get Campaign Call Details with Node.js Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Node.js example using the 'request' library to call the API for campaign call details. It shows base64 encoding for authentication and handling the response. ```javascript var request = require("request"); var accountSid = "XXXXXXXXX"; var accountToken = "YYYYYYYYY"; var authKey = "ZZZZZZZZZZ"; var encoding = Buffer.from(authKey + ':' + accountToken).toString('base64') var options = { method: 'GET', url: 'https://api.exotel.com/v2/accounts/'+ accountSid +'/campaigns/491dd6c97d64475ba0ce346a18530ce5/call-details?status=no-answer,failed&sort_by=date_created:desc&limit=3&offset=0', headers: { Authorization: 'Basic ' + encoding } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Get ExoPhone Beta using Node.js (request) Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Node.js example uses the 'request' library to send a POST request to the Exotel API for acquiring an ExoPhone. It configures the request URL, method, and data payload, handling the response accordingly. ```javascript var request = require('request'); var dataString = 'PhoneNumber=XXXXX30240'; var options = { url: 'https://:/v2_beta/Accounts//IncomingPhoneNumbers', method: 'POST', body: dataString }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } } request(options, callback); ``` -------------------------------- ### Start ngrok for Local Development Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel-chatbot/outbound/README.md Starts the ngrok tunneling service to expose the local server to the internet. This is crucial for receiving inbound WebSocket connections from Exotel during local development. ```bash ngrok http 7860 ``` -------------------------------- ### Get Campaign Details using Python Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Python script employs the 'requests' library to fetch campaign details. It prepares the authentication header using base64 encoding and sends a GET request. The response text is printed, followed by a prettified JSON representation of the response. ```python import requests, base64, json accountSid = "XXXXXXXXX" authToken = "YYYYYYYYY" authKey = "ZZZZZZZZZZ" encoding = base64.b64encode(authKey + ":" + authToken) url = "https://api.exotel.com/v2/accounts/"+ accountSid +"/campaigns/491dd6c97d64475ba0ce346a18530ce5" payload = "" headers = { 'Authorization': "Basic " + encoding } response = requests.request("GET", url, data=payload, headers=headers) print(response.text) print(json.dumps(json.loads(response.text), indent = 4, sort_keys = True)) ``` -------------------------------- ### GET /v2/accounts/{your_sid}/campaigns Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Retrieves a list of campaigns with support for offset, limit, name search, status filtering, sorting, and campaign type. ```APIDOC ## GET /v2/accounts//campaigns ### Description Fetches a list of campaigns with options for pagination, searching by name, filtering by status, and sorting. ### Method GET ### Endpoint `https://:@/v2/accounts//campaigns` ### Parameters #### Query Parameters - **offset** (integer) - Optional - The position in the dataset of a particular record. Zero-based. - **limit** (integer) - Optional - The number of records to return per page. Default is 20, maximum is 500. - **name** (string) - Optional - Filters campaigns by name. - **status** (string) - Optional - Filters campaigns by status. Multiple statuses can be comma-separated (e.g., `in-progress,created`). - **sort_by** (string) - Optional - Specifies the order of sorting. Format: `field:direction` (e.g., `date_created:asc`, `name:desc`). Defaults to `date_created:asc`. - **type** (string) - Optional - Filters campaigns by type. Allowed value is 'trans'. Defaults to 'trans'. ### Request Example ```bash curl -X GET \ 'https://:@/v2/accounts//campaigns?offset=0&status=Created,Completed&limit=3' \ -H 'Authorization: Basic ' ``` ### Response #### Success Response (200) - **campaigns** (array) - A list of campaign objects. - **id** (string) - The unique identifier for the campaign. - **name** (string) - The name of the campaign. - **status** (string) - The current status of the campaign. - **type** (string) - The type of the campaign. - **date_created** (string) - The date and time when the campaign was created. #### Response Example ```json { "campaigns": [ { "id": "campaign_id_1", "name": "Example Campaign 1", "status": "Completed", "type": "trans", "date_created": "2023-10-27T10:00:00Z" }, { "id": "campaign_id_2", "name": "Example Campaign 2", "status": "In Progress", "type": "trans", "date_created": "2023-10-27T09:00:00Z" } ] } ``` ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel-chatbot/outbound/README.md Copies the example environment file and prompts the user to edit it with their API keys. This is a standard practice for managing sensitive configuration. ```bash cp env.example .env # Edit .env with your API keys ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/whatsapp/README.md Copies the example environment file to a new file named '.env'. This file should then be edited to include your specific API keys and configuration values. ```bash cp env.example .env ``` -------------------------------- ### Create Campaign with Go Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Go program demonstrates creating a campaign using the standard 'net/http' package. It constructs an HTTP POST request with a JSON payload and sets the 'Content-Type' header. The response body is then read and printed to the console. ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://:/v2/accounts//campaigns" method := "POST" payload := strings.NewReader(`{ "campaigns": [ { "caller_id":"0XXXX683280", "lists":["b7799a24becf436da672163858e8165d"], "campaign_type":"dynamic", "flow_type":"ivr", "read_via_text":"Hi @@Name @@Last name , your order ID is @@Order ID . Press 1 to proceed, press 2 to abort", "retries": { "number_of_retries": 1, "interval_mins": 1, "mechanism": "Exponential", "on_status": [ "failed", "busy" ] }, "status_callback": "https://mycallback.sampledomain.in/1gvta9f1", "call_status_callback": "https://mycallback.sampledomain.in/1gvta9f1", "call_schedule_callback": "https://mycallback.sampledomain.in/1gvta9f1", "custom_field": "{\"name\": \"yo\"}" } ] }`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### POST /v2/accounts//campaigns Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Creates a new campaign with specified configurations. This endpoint allows for detailed setup including scheduling, callback URLs, retry mechanisms, and custom fields. ```APIDOC ## POST /v2/accounts//campaigns ### Description Creates a new campaign with specified configurations. This endpoint allows for detailed setup including scheduling, callback URLs, retry mechanisms, and custom fields. ### Method POST ### Endpoint `/v2/accounts//campaigns` ### Parameters #### Request Body - **campaigns** (Array) - Required - An array of campaign objects to be created. - **name** (String) - Required - The name of the campaign. - **caller_id** (String) - Required - The caller ID to be used for the campaign. - **lists** (Array) - Required - An array of list IDs to be used in the campaign. - **campaign_type** (String) - Required - The type of campaign (e.g., "dynamic"). - **flow_type** (String) - Required - The type of call flow (e.g., "ivr"). - **read_via_text** (String) - Optional - Text to be read to the user during the call. - **retries** (Object) - Optional - Configuration for call retries. - **number_of_retries** (Number) - Optional - The number of times to retry a call. - **interval_mins** (Number) - Optional - The interval in minutes between retries. - **mechanism** (String) - Optional - The retry mechanism (e.g., "Exponential"). - **on_status** (Array) - Optional - An array of call statuses on which to retry. - **schedule** (Object) - Optional - Defines when to start and end a campaign. - **send_at** (String) - Optional - Time when the campaign should start (RFC 3339 format). Defaults to now. - **end_at** (String) - Optional - Time when the campaign should end (RFC 3339 format). Defaults to +30 days from now or send_at time. - **call_status_callback** (String) - Optional - URL to receive POST requests when a call completes. - **call_schedule_callback** (String) - Optional - URL to receive POST requests when all calls for a schedule are completed. - **status_callback** (String) - Optional - URL to receive POST requests when the campaign starts or ends. - **mode** (String) - Optional - Campaign mode ("auto" or "custom"). - **throttle** (Number) - Optional - Applicable only if mode is "custom". The allowed value is between 1 and (Campaign account throttle - 1). - **custom_field** (String) - Optional - Any application-specific value passed back in reports or GET requests. ### Request Example ```json { "campaigns": [ { "name": "Exotel_2022-08-08 16:33:22", "caller_id": "0xxxx83280", "lists": ["b7799a24becf436da672163858e8165d"], "campaign_type": "dynamic", "flow_type": "ivr", "read_via_text": "Hi @@Name @@Last name , your order ID is @@Order ID . Press 1 to proceed, press 2 to abort", "retries": { "number_of_retries": 1, "interval_mins": 1, "mechanism": "Exponential", "on_status": [ "failed", "busy" ] }, "status_callback": "https://mycallback.sampledomain.in/1gvta9f1" } ] } ``` ### Response #### Success Response (200) - **status** (String) - Indicates the success of the operation (e.g., "success"). - **data** (Object) - Contains details of the created campaign. - **campaign_id** (String) - The unique identifier of the created campaign. #### Response Example ```json { "status": "success", "data": { "campaign_id": "c00d49d1-55d6-4d80-b22a-5628e3b1506e" } } ``` ``` -------------------------------- ### Initialize HTTP Client for Campaign Call Details in Go Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Go code snippet to initialize variables for making an HTTP request to fetch campaign call details. It sets up account credentials needed for authentication. ```go package main import ( b64 "encoding/base64" "fmt" "io/ioutil" "net/http" ) func main() { // Please provide accountSid, authToken from your Exotel account accountSid := "XXXXXXXXX" authToken := "YYYYYYYY" authKey := "ZZZZZZZZZZ" ``` -------------------------------- ### Fetch Call Records using Node.js Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Node.js example demonstrates fetching call records using the 'request' library. It makes a GET request to the API endpoint and logs the response body if the request is successful (status code 200). ```javascript var request = require('request');\n\nvar options = {\n url: 'https://:/v1/Accounts//Calls'\n};\n\nfunction callback(error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body);\n }\n}\n\nrequest(options, callback); ``` -------------------------------- ### POST /v2/accounts/{your_sid}/campaigns Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Creates a new campaign with specified details. This endpoint allows for dynamic campaign setup including IVR flows, retry mechanisms, and callback configurations. ```APIDOC ## POST /v2/accounts//campaigns ### Description Creates a new campaign with specified details. This endpoint allows for dynamic campaign setup including IVR flows, retry mechanisms, and callback configurations. ### Method POST ### Endpoint `https://:/v2/accounts//campaigns` ### Parameters #### Request Body - **campaigns** (array) - Required - An array containing campaign objects. - **caller_id** (string) - Required - The caller ID for the campaign. - **lists** (array of strings) - Required - A list of IDs for the contact lists to be used in the campaign. - **campaign_type** (string) - Required - The type of campaign (e.g., "dynamic"). - **flow_type** (string) - Required - The type of flow for the campaign (e.g., "ivr"). - **read_via_text** (string) - Required - The text to be read out to the recipient, can include placeholders like @@Name. - **retries** (object) - Optional - Configuration for retrying calls. - **number_of_retries** (integer) - Required if retries object is present - The number of times to retry a failed call. - **interval_mins** (integer) - Required if retries object is present - The interval in minutes between retries. - **mechanism** (string) - Required if retries object is present - The retry mechanism (e.g., "Exponential"). - **on_status** (array of strings) - Required if retries object is present - A list of call statuses that should trigger a retry (e.g., ["failed", "busy"]). - **status_callback** (string) - Optional - A URL to receive status updates for the campaign. - **call_status_callback** (string) - Optional - A URL to receive call status updates. - **call_schedule_callback** (string) - Optional - A URL to receive callback notifications for scheduled calls. - **custom_field** (string) - Optional - A JSON string representing custom fields for the campaign. ### Request Example ```json { "campaigns": [ { "caller_id": "0XXXX83280", "lists": [ "b7799a24becf436da672163858e8165d" ], "campaign_type": "dynamic", "flow_type": "ivr", "read_via_text": "Hi @@Name @@Last name , your order ID is @@Order ID . Press 1 to proceed, press 2 to abort", "retries": { "number_of_retries": 1, "interval_mins": 1, "mechanism": "Exponential", "on_status": [ "failed", "busy" ] }, "status_callback": "https://mycallback.sampledomain.in/1gvta9f1", "call_status_callback": "https://mycallback.sampledomain.in/1gvta9f1", "call_schedule_callback": "https://mycallback.sampledomain.in/1gvta9f1", "custom_field": "{\"name\": \"yo\"}" } ] } ``` ### Response #### Success Response (200) - **request_id** (string) - A unique identifier for the request. - **method** (string) - The HTTP method used for the request. - **http_code** (integer) - The HTTP status code of the response. - **response** (array) - An array containing the result of the campaign creation. - **code** (integer) - The status code of the operation within the response. - **error_data** (object or null) - Contains error details if the operation failed. - **status** (string) - The status of the operation (e.g., "success"). - **data** (object) - Contains data related to the created campaign. - **id** (string) - The unique identifier of the created campaign. - **account_sid** (string) - The account SID associated with the campaign. - **name** (string) - The name of the campaign. #### Response Example ```json { "request_id": "0a6d6fccb66e48699b77058554b507e9", "method": "POST", "http_code": 200, "response": [ { "code": 200, "error_data": null, "status": "success", "data": { "id": "59beaff7d1c887e877a3b5942bc389fd1688", "account_sid": "Exotel", "name": "Exotel_2022-08-08 16:33:22" } } ] } ``` ``` -------------------------------- ### Get Incoming Calls by Agent and Date Range Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This example shows how to retrieve all incoming calls received by a specific agent (identified by their To number) within a given date range. It uses the `DateCreated` parameter for the date range and the `To` parameter to specify the agent's phone number. ```http GET https:///v1/Accounts//Calls.json?DateCreated=gte:2019-12-03+00:00:00%3Blte:2019-12-04+00:00:00&To=%2B91xxxxxxxxxx ``` -------------------------------- ### Fetch Exotel Campaigns with Go Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Go program retrieves campaign data from the Exotel API. It handles base64 encoding for authentication, constructs the API request, and prints the response status and body. Ensure you replace placeholder credentials with your actual Exotel account details. ```go package main import ( b64 "encoding/base64" "fmt" "io/ioutil" "net/http" ) func main() { // Please provide accountSid, authToken from your Exotel account accountSid := "XXXXXXXXX" authToken := "YYYYYYYY" authKey := "ZZZZZZZZZZ" // This is typically accountSid + auth_token concatenated // Encoding the accountSid and authToken, used in Authorization header encoding := b64.StdEncoding.EncodeToString([]byte(authKey + ":" + authToken)) url := "https://api.exotel.com/v2/accounts/" + accountSid + "/campaigns?offset=0&status=Created,Completed&limit=3" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Basic "+encoding) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### GET /v1/Accounts//Calls/{CallSid} Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Retrieves the details of a specific call recording. The response includes information such as the call SID, creation and update timestamps, account SID, caller and receiver numbers, call status, start and end times, duration, price, direction, and the URL for the call recording. ```APIDOC ## GET /v1/Accounts//Calls/{CallSid} ### Description Retrieves the details of a specific call recording. The response includes information such as the call SID, creation and update timestamps, account SID, caller and receiver numbers, call status, start and end times, duration, price, direction, and the URL for the call recording. ### Method GET ### Endpoint /v1/Accounts//Calls/{CallSid} ### Parameters #### Path Parameters - **your_sid** (string) - Required - Your unique account SID. - **CallSid** (string) - Required - The unique identifier for the call. ### Request Example ```json { "example": "GET /v1/Accounts/Exoid_12345/Calls/b6cfaf5f5cef3ca0fc937749ef960e25" } ``` ### Response #### Success Response (200) - **Call** (object) - Contains call details. - **Sid** (string) - The unique identifier for the call. - **ParentCallSid** (string) - The SID of the parent call, if this is a sub-call. - **DateCreated** (string) - The timestamp when the call was created. - **DateUpdated** (string) - The timestamp when the call was last updated. - **AccountSid** (string) - Your account SID. - **To** (string) - The phone number the call was made to. - **From** (string) - The phone number the call was made from. - **PhoneNumberSid** (string) - The SID of the phone number used for the call. - **Status** (string) - The status of the call (e.g., 'completed', 'ringing'). - **StartTime** (string) - The timestamp when the call started. - **EndTime** (string) - The timestamp when the call ended. - **Duration** (string) - The duration of the call in seconds. - **Price** (string) - The price of the call. - **Direction** (string) - The direction of the call (e.g., 'outbound-api', 'inbound'). - **AnsweredBy** (string) - Indicates if the call was answered by a human or the system. - **ForwardedFrom** (string) - The number from which the call was forwarded, if applicable. - **CallerName** (string) - The name of the caller, if available. - **Uri** (string) - The API endpoint for this call resource. - **RecordingUrl** (string) - The URL where the call recording can be accessed. - **PreSignedRecordingUrl** (string) - A pre-signed URL for the call recording, if available. #### Response Example ```json { "Call": { "Sid": "b6cfaf5f5cef3ca0fc937749ef960e25", "ParentCallSid": "", "DateCreated": "2016-11-29 15:58:45", "DateUpdated": "2016-11-29 16:00:09", "AccountSid": "Exotel", "To": "0XXXXX20000", "From": "0XXXXX30240", "PhoneNumberSid": "0XXXXXX4890", "Status": "completed", "StartTime": "2016-11-29 15:59:10", "EndTime": "2016-11-29 15:59:27", "Duration": "17", "Price": "1.500", "Direction": "outbound-api", "AnsweredBy": "human", "ForwardedFrom": "", "CallerName": "", "Uri": "/v1/Accounts//Calls/b6cfaf5f5cef3ca0fc937749ef960e25", "RecordingUrl": "https://s3-ap-southeast-1.amazonaws.com/exotelrecordings//b6cfaf5f5cef3ca0fc937749ef960e25.mp3", "PreSignedRecordingUrl": "https://exotelrecordings.s3.amazonaws.com//b6cfaf5f5cef3ca0fc937749ef960e25.mp3?AWSAccessKeyId=ASIAVC7Z5JMLS3I3GKFA&Expires=1739169539&x-amz-security-token=IQoJb3JpZ2luX2VjEJ7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkcwRQIgZ5BXmyJx29N42KbJ8n9Vfpc%2B0SruFPJjEzvtFkHANvcCIQC57uHTPntMOjA5YRMNBWwikVFZgEJHrZ5gmADSaBoATirIBQi3%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDM1MDAyNzA3NDMyNyIM3yhfaDtI0Fm%2BtuNSKpwFmMreUlHGThvNRjo3Jp9bAxLP1R5hAlukwM1phqzKaX%2FefOOJIfr8b1HvCB1uzywrZvXoPLmbSd9C%2BfYC0dBCSaqp3QDqmnLV%2FnB19Tb1qqLk7M830e1PTIeAAG8OdL9vRsT9Yxri6m2jco9VKrR26VqKkmMxqfQqaxypMZ%2ByKkbcEsTkEZwEsPjfyiSAPy01vA8zY2uQ9JX5VxNDEj5s4nAo2ZYRpFkXKglt2KGfKErFT%2BaZYP%2FsyUOMgC9fZWw7B0yUlYsY9%2Ftoo4Oq%2BPk0qxp379639rMzSLE4%2BSkf0jnkc1k2JYtLYHShy9SGgEAKTN0ihPINDdZiMfdZ7dj47G%2F2mlT8xDdqy%2FPcsys0PH4n2vpqDPHV9%2BOX8BbTUZ%2FxC2Alros61rAH30wBCk57BIvl8L%2FHmGdsgm6lm716u4d7UKkLXpnMnpUgueif46N3fTLWm5wkUJEJByuhy%2FVznnRnRCPQGfT93zkYe%2BxsfoDMUF4xP0ULUMk808qMrvUK%2Fp1k4gFvnUwHhnXzuzEQ%2FUDXMo5HAcrmOtNBMN6FqPg%2B9B7Ymu8Np3V4v6oSmshliZLm706Y09S4jPv%2Fz4ALnsg7PxEyjnPjoDHXRVQ7UJ01tQUJY96bR%2Fz3Tww9x1%2BGpjov5DtmIyjjgom6COqqbMFBD2uxmShYIOxcXZLgcIo4rrSfpCfbEzeDBm31ZfppSOLuhXHvaDfAQEwnSmtREHHrqQMCrL6mhQMNzyh32uMyDWcKxB6q3YL55LxIk6yFMHc8XWzDJyzjydeFyqJpsA1GmxA2eBltMy1dk00vqcFBzgQ461SKjRa6oC%2BQXhHfYpkj%2BpYG9a%2Frf%2Bf64pkBZBIQt03VgM6Qj3kHpzG%2BUmuAMv8WiA7E%2F7ovFlQw756mvQY6sQHcnohFNIkaLra7nT1C01FQwfR4bxFmzo0P2toEtmwPkh59yjEhwtEEtsJDNxPUyv5ldetyH5xnd0zsBPNsKZjGfknx%2FY9Q8wgeuBXRAbDmcfZFURehk43KzXpK3X9OHYNz9l6BYY%2FoQRcomuX7NeCiR6%2F99fbfAGG6y3NpQWx9TY51VIr6KpQegX4rF7nhdA3fPNZgKNUTiUkOrL9%2FyMH4XWCgX8Hh8FNjrRQ6Djk%2B52E%3D&Signature=UHR%2B0KUPGldELeNHTjf3OTdyCQs%3D" } } ``` ``` -------------------------------- ### Fetch Exotel Campaigns with Python Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Python script demonstrates how to fetch campaign data from the Exotel API. It constructs the API URL, sets up basic authentication using account SID and auth token, and prints the raw response and a pretty-printed JSON version. Requires the 'requests' and 'json' libraries. ```python import requests import json # Replace with your actual Exotel credentials and account SID accountSid = "YOUR_ACCOUNT_SID" encoding = "YOUR_BASE64_ENCODED_AUTH" url = "https://api.exotel.com/v2/accounts/"+ accountSid +"/campaigns?offset=0&status=Created,Completed&limit=3" payload = "" headers = { 'Authorization': "Basic " + encoding } response = requests.request("DELETE", url, data=payload, headers=headers) print(response.text) print(json.dumps(json.loads(response.text), indent = 4, sort_keys = True)) ``` -------------------------------- ### Campaign Creation Parameters Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This section details the optional parameters available when creating a campaign. ```APIDOC ## Campaign Creation Parameters ### Description This endpoint allows for the creation of campaigns with various configurations, including different flow types, IVR settings, and retry mechanisms. ### Method POST ### Endpoint `/campaigns` ### Parameters #### Query Parameters - **flow_type** (string) - Optional - In case of Creating an IVR through the campaign module, defining "ivr" is mandatory. The parameter name is "ivr". If read_via_text is opted then this value will be "greeting". This is not applicable if you are selecting a flow. - **repeat_menu_attempts** (integer) - Optional - If the flow_type is selected as "ivr" then this value can be specified to repeat the IVR menu. The default value will be 0 if the flow_type is set as "ivr". This field is not applicable if flow_type is "greeting". - **url** (string) - Optional - Only applicable if you are selecting a call flow. Example: `http://my.exotel.com/{your_sid}/exoml/start_voice/{app_id}` where app_id is the identifier of the flow (or applet) that you want to connect to once the from number picks up the call. - **read_via_text** (string) - Optional - If the flow_type is opted for "ivr" or "greeting", then this field has to be entered with the content that has to be played out to the caller. You can enter a static content(no variables) or Dynamic content. In case, dynamic content is entered then "@@" has to be entered with the header value. Ensure that the header is the exact match from the list uploaded. For ex: If the header name in the file is FirstName then in the content entered here the dynamic variable has to be "@@FirstName". If flow/url is opted then this field would not be required. - **name** (string) - Optional - It's an optional parameter in the request but mandatory in the response. It is used to define the name of the campaign. It should be greater than 3 characters and if not passed, its default value will be created using the 'AccountSID CurrentDate CurrentTime' and passed in the response. Example: `exotel 2021-06-04 11:11:10` - **type** (string) - Optional - It's an optional parameter in the request but mandatory in the response. It's allowed (and default) value is 'trans'. If not passed in the request, we will create campaign as type 'trans' and pass this parameter in the API response. As per regulations, we support only transactional type of campaigns. - **call_duplicate_numbers** (boolean) - Optional - Allowed Values: 'true' & 'false'. Default Value: 'false'. If 'true', Campaign will try calling the duplicate numbers present in the list(s). If 'false', Campaign will call any number in the list(s) only once. It is independent of the 'retry' functionality. - **retries** (object) - Optional - Retry logic in case the calls are not successful. - **number_of_retries** (integer) - The number of times a call to a phone number should be attempted. Default is 0 and max is 3. - **interval_mins** (integer) - The time interval between retries in mins. Mandatory when number_of_retries is specified. - **mechanism** (string) - either "Linear" or "Exponential". If the retry should be equally spaced or exponentially. Default is linear. - **on_status** (array of strings) - Determines when should campaign treat a call as an unsuccessful attempt. Could be "busy", "no-answer", "failed". ### Request Example ```json { "flow_type": "ivr", "read_via_text": "Welcome to our service. @@FirstName, please listen carefully as our menu options have recently changed.", "name": "Welcome Campaign", "retries": { "number_of_retries": 2, "interval_mins": 5, "mechanism": "Linear", "on_status": ["busy", "no-answer"] } } ``` ### Response #### Success Response (200) - **flow_type** (string) - The type of flow used for the campaign. - **repeat_menu_attempts** (integer) - The number of times the IVR menu will repeat. - **url** (string) - The URL for call flow integration. - **read_via_text** (string) - The text content to be played to the caller. - **name** (string) - The name of the campaign. - **type** (string) - The type of the campaign (e.g., 'trans'). - **call_duplicate_numbers** (boolean) - Indicates if duplicate numbers will be called. - **retries** (object) - Details of the retry mechanism. #### Response Example ```json { "flow_type": "ivr", "repeat_menu_attempts": 0, "url": null, "read_via_text": "Welcome to our service. John Doe, please listen carefully as our menu options have recently changed.", "name": "Welcome Campaign", "type": "trans", "call_duplicate_numbers": false, "retries": { "number_of_retries": 2, "interval_mins": 5, "mechanism": "Linear", "on_status": ["busy", "no-answer"] } } ``` ``` -------------------------------- ### GET /v1/Accounts/{your_sid}/Calls Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt Fetches a list of call details based on specified parameters. You can get the response in JSON format by appending '.json' to the endpoint. ```APIDOC ## GET /v1/Accounts//Calls ### Description Retrieves bulk details for calls, including status and price. This endpoint does not provide information for ongoing calls. The response can be formatted as JSON by appending `.json` to the endpoint. ### Method GET ### Endpoint `https://:@/v1/Accounts//Calls` ### Parameters #### Query Parameters - **RecordingUrlValidity** (Integer) - Optional - An integer between 5 and 60 minutes to control the TTL of the PreSignedRecordingUrl. Values outside this range will result in a 4XX error. - **Sid** (string) - Optional - One or multiple Call SIDs, comma-separated. Recommended limit: 20 SIDs, maximum: 100 SIDs. If `DateCreated` is not set, defaults to the last 31 days. For SIDs older than 31 days, `DateCreated` must be provided. - **DateCreated** (string) - Optional - Date and time in the format `gte:YYYY-MM-DD HH:MM:SS;lte:YYYY-MM-DD HH:MM:SS`. Supported operators are `gte` (greater than or equal to) and `lte` (less than or equal to). You can query call records up to 6 months old with a maximum date range of 1 month. Defaults to the last 31 days. - **To** (string) - Optional - The customer's phone number in E.164 format. One or multiple numbers can be provided, comma-separated. Maximum limit: 5 numbers. ### Request Example ```json { "example": "GET https://:@api.exotel.com/v1/Accounts/ACxxxxxxxxxxxx/Calls?Sid=abc123,def456&DateCreated=gte:2023-01-01 00:00:00;lte:2023-01-31 23:59:59&To=+1234567890" } ``` ### Response #### Success Response (200) - **calls** (Array) - An array of call objects, each containing details like Call SID, Status, Price, etc. #### Response Example ```json { "example": "{\"calls\": [{\"Sid\": \"ca123...\", \"Status\": \"completed\", \"Price\": \"0.05\"}, ...] }" } ``` ``` -------------------------------- ### Get Available ExoPhone Numbers (Python) Source: https://github.com/mhussam-ai/important-pipecat-examples/blob/main/exotel/exotel-llms-full.txt This Python snippet demonstrates fetching available ExoPhone numbers using the 'requests' library. It performs a simple GET request to the API endpoint. ```python import requests\nrequests.get('https://:/v2_beta/Accounts//AvailablePhoneNumbers') ```