### Get Planfix Project List using PHP Source: https://planfix.com/help/Planfix_API%3A_Example_of_getting_a_list_of_projects_on_PHP This snippet demonstrates how to make an authenticated API request to get a list of projects. Ensure your API key, token, and account are correctly configured. SSL verification is disabled for simplicity in this example. ```php '); $requestXml->account = 'your_account'; $requestXml->pageCurrent = 1; // he rest of the parameters are optional, experiment yourself $ch = curl_init($api_server); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // do not output the response to stdout curl_setopt($ch, CURLOPT_HEADER, 1); // get headers // do not check SSL certificate curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // do not check Host SSL certificate curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $api_key . ':' . $api_token); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXml->asXML()); echo $requestXml->asXML(); $response = curl_exec($ch); $error = curl_error($ch); var_dump($error); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $responseBody = substr($response, $header_size); curl_close($ch); var_dump($responseBody); ?> ``` -------------------------------- ### Call API using curl Source: https://planfix.com/help/XML_API_v1 Example of how to call the Planfix API using curl. This demonstrates a basic GET request. ```bash curl -X POST -H "Content-Type: application/xml" -d "account.get" https://api.planfix.com/xml ``` -------------------------------- ### Example using curl for authentication Source: https://planfix.com/help/Planfix_API%3A_Authentication_using_username_and_password This example demonstrates how to authenticate with the Planfix API using curl, including setting the Accept and Content-Type headers, providing the API key for basic authentication, and sending a sample request body. ```bash curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \\ -u 4db09df5a62a8a32a9522fcac02d3c6f: -k -d '...' https://api.planfix.ru/xml/ ``` -------------------------------- ### XML API v1 Authentication Example Source: https://planfix.com/help/Planfix_API%3AAuthentication_by_token This example demonstrates how to authenticate an API request to the Planfix XML API v1 using a token. The API Key is used as the username and the authentication token as the password in the basic HTTP authentication header. ```APIDOC ## Authenticate XML API v1 Request with Token ### Description This endpoint requires basic HTTP authentication using an API Key and an authentication token. ### Method POST (implied by example) ### Endpoint https://api.planfix.ru/xml/ ### Parameters #### Request Headers - **Accept**: application/xml - Required - **Content-Type**: application/xml - Required - **Authorization**: Basic [base64 encoded 'ApiKey:Token'] - Required ### Request Example ```bash curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \ -u 4db09df5a62a8a32a9522fcac02d3c6f:06540b851b466ccf84558573aff11b65 -k -d '...' https://api.planfix.ru/xml/ ``` ### Response #### Success Response (200) - The response format depends on the specific API call made. Refer to the XML API v1 documentation for details. #### Response Example (Response content will vary based on the request) ``` -------------------------------- ### Date Formatting Examples in Planfix Variables Source: https://planfix.com/help/Formatting_dates These examples demonstrate various date and time formatting options available in Planfix templates. The 'Format' string dictates how the date 'July 3, 1996 at 2:14 PM' is displayed. ```planfix {{Task.Date::FormatDate=dd/MM/yy}} ``` ```planfix {{Task.Date::FormatDate=dd MMM yyyy}} ``` ```planfix {{Task.Date::FormatDate=yyyy-MM-dd}} ``` ```planfix {{Task.Date::FormatDate=dd-MM-yyyy h:mm a}} ``` ```planfix {{Task.Date::FormatDate=dd-MM-yyyy HH:mm:ss}} ``` ```planfix {{{Task.Date::FormatDate=yyyy-MM-dd HH:mm:ss.SSS}}} ``` ```planfix {{Task.Date::FormatDate=yyMMddHHmmssSSS}} ``` ```planfix {{Task.Date::FormatDate=EEEE, hh a}} ``` -------------------------------- ### Example: Create and Link a New Task Source: https://planfix.com/help/Working_with_Planfix_bots_for_Telegram Demonstrates the sequence of commands to create a new task using /task, confirm its creation, and optionally link the chat to receive task updates. ```bash /task New task name ``` -------------------------------- ### Date Filter: Another Period Source: https://planfix.com/help/Planfix_API%3ATask_filters Example of setting a date filter for a specific period using 'anotherperiod' with start and end dates. ```xml anotherperiod 01-01-2015 01-02-2015 ``` -------------------------------- ### Table with Header, Data, and Total Rows Source: https://planfix.com/help/Variables_in_Text This example constructs a table with a header row, data rows, and a total row. It uses specific Planfix syntax to define the table structure and calculate the sum of amounts for the total row. ```Planfix Syntax %%$TABLE({{Data Tag.Service}};1;1)$%% # | Name | Price --- {{Data tag.Service.Record Number}} | {{Data tag.Service.Service Name}} | {{Data tag.Service.Amount}} Total | %%%SUM({{Data tag.Service.Amount}})%%% ``` -------------------------------- ### Setup Integration Source: https://planfix.com/help/VoIP_API This command is triggered when you activate the integration in Planfix. It automatically enables the integration on the PBX side. If the response status is not 200, an error message with the response text will be shown in Planfix. ```APIDOC ## POST /planfix_api.php ### Description Sets up the integration between the cloud PBX and Planfix. ### Method POST ### Endpoint https://domain/planfix_api.php ### Parameters #### Query Parameters - **cmd** (string) - Required - type of operation, in this case setup - **token** (string) - Required - cloud PBX key (token) set in the integration settings - **planfix_token** (string) - Required - Planfix key (token), specified in the integration settings - **planfix_url** (string) - Required - The URL for sending requests to Planfix ### Request Example ``` POST https://domain/planfix_api.php cmd=setup token=YOUR_PBX_TOKEN planfix_token=YOUR_PLANFIX_TOKEN planfix_url=https://your_planfix_domain.planfix.com ``` ### Response #### Success Response (200) Indicates successful setup. No specific body is detailed, but an error message will be shown in Planfix if not 200. ``` -------------------------------- ### DATEDIF Examples for Remaining Months Calculation (ym) Source: https://planfix.com/help/DATEDIF_Function Calculates the difference in full months, ignoring years. The start date's month and day are compared against the end date's month and day, adjusting the start year if necessary. ```Planfix Formula DATEDIF("01.02.2007"; "01.03.2009"; "ym") ``` ```Planfix Formula DATEDIF("01.04.2007"; "01.03.2009"; "ym") ``` -------------------------------- ### SEARCH() Function Examples Source: https://planfix.com/help/SEARCH_function Demonstrates the usage of the SEARCH() function with wildcards and escaping special characters. The function is not case-sensitive and returns the starting position of the match. ```planfix SEARCH("BOAT*down?he stream";"Row, row, row your boat, gently down the stream") //returns 20 ``` ```planfix SEARCH("What's up~?"; "Did he ask you what's up?") //returns 16 ``` ```planfix SEARCH("apple?";"one apple two apples") //returns 5 ``` -------------------------------- ### Sample Webhook URL for Task Creation Source: https://planfix.com/help/Webhooks_with_GET_requests This is a sample webhook URL structure for creating a task in Planfix using a GET request. It includes placeholders for account, project, and task name. ```url https:///your_account.planfix.ru/webhook/get/create_task?project=project&name=taskname ``` -------------------------------- ### DATEDIF Examples for Full Years Calculation Source: https://planfix.com/help/DATEDIF_Function Calculates the difference in full years between two dates. The end date must be on or after the anniversary of the start date in the end year. ```Planfix Formula DATEDIF("01.02.2007"; "01.03.2009"; "y") ``` ```Planfix Formula DATEDIF("01.04.2007"; "01.03.2009"; "y") ``` -------------------------------- ### Configure Global Variables in globals_custom.conf Source: https://planfix.com/help/FreePBX Set the PBX_URL, PF_URL, and PF_KEY in globals_custom.conf to establish communication between FreePBX and Planfix. ```asterisk ;PBX_URL = {your_pbx_url} ;PF_URL = {planfix_callback_url} ;PF_KEY = {planfix_api_key} ``` -------------------------------- ### Extract Day of Month using DAY Function Source: https://planfix.com/help/DAY_Function Use the DAY function to get the day of the month from a column or date string. This example checks if the day is the 7th. ```Planfix Formula IF(DAY(B)=7;"7thday of the month";"") ``` -------------------------------- ### Filter by Creation Date (Date Range) Source: https://planfix.com/help/REST_API%3A_Complex_task_filters Example of a date filter for the creation date, specifying an exact date range. Use dateFrom and dateTo for the start and end dates of the range. ```json { "value": { "dateType": "otherRange", "dateFrom": "20-03-2022", "dateTo": "22-03-2022" } } ``` -------------------------------- ### Create Project Source: https://planfix.com/help/Planfix_API_project.add_/_Create_a_project This method allows users to create a new project in Planfix. Regular users can call this function. If the creator is not specified or set to 0, the user making the request will be assigned as the creator. The counterparty is an optional parameter. ```APIDOC ## project.add ### Description Creates a new project in Planfix. ### Method POST (implied by XML request structure) ### Endpoint Not explicitly defined, assumed to be a general API endpoint for method calls. ### Parameters #### Request Body (XML) - **sid** (string) - Required - Session key obtained from authentication. - **project** (object) - Required - Contains project details. - **title** (string) - Required - The name of the project. - **description** (string) - Optional - A detailed description of the project. - **owner** (object) - Optional - Specifies the project owner. - **id** (int) - Optional - Identifier of the user who will be the project creator. If 0 or omitted, the current user is the creator. - **client** (object) - Optional - Specifies the client associated with the project. - **id** (int) - Optional - Identifier of the counterparty. - **status** (enum) - Optional - The initial status of the project. Refer to the project statuses section for valid values. - **hidden** (bool) - Optional - Indicates if the project is hidden. - **hasEndDate** (bool) - Optional - Specifies whether the project has an end date. - **endDate** (DateTime) - Optional - The end date of the project. Only used if `hasEndDate` is true. - **group** (object) - Optional - Specifies the project group. - **id** (int) - Optional - Identifier of the project group. - **parent** (object) - Optional - Specifies the parent project. - **id** (int) - Optional - Identifier of the parent project. - **auditors** (array) - Optional - A list of project auditors. - **id** (int) - Optional - Identifier of a project auditor. - **managers** (array) - Optional - A list of project managers. - **id** (int) - Optional - Identifier of a project manager. - **assignees** (array) - Optional - A list of default project assignees. - **id** (int) - Optional - Identifier of a default project assignee. - **customData** (array) - Optional - Custom fields for the project. - **customValue** (object) - Represents a custom field value. - **id** (string) - Required - Identifier of the custom field. - **value** (string) - Required - The value for the custom field. For specific field types (task set, employee list, directory entry set), use comma-separated identifiers within square brackets. - **signature** (string) - Required - Signature for the request. ### Request Example ```xml YOUR_SESSION_KEY New Project Title This is a sample project description. 123 456 active false true 2024-12-31T00:00:00Z 7 8 9 10 11 custom_field_1 Some Value YOUR_SIGNATURE ``` ### Response #### Success Response (200 OK) Returns the ID of the newly created project. - **project.id** (int) - The unique identifier of the created project. #### Response Example ```xml 12345 ``` #### Error Response Returns an error status and code if the project creation fails. ```xml ERROR_CODE ``` ``` -------------------------------- ### DATEDIF Examples for Full Months Calculation Source: https://planfix.com/help/DATEDIF_Function Calculates the difference in full months between two dates. The result is zero if the end date is not at least one full month after the start date. ```Planfix Formula DATEDIF("01.02.2007"; "01.03.2007"; "m") ``` ```Planfix Formula DATEDIF("01.03.2007"; "31.03.2007"; "m") ``` ```Planfix Formula DATEDIF("01.02.2007"; "01.03.2009"; "m") ``` ```Planfix Formula DATEDIF("31.03.2007"; "01.05.2007"; "m") ``` ```Planfix Formula DATEDIF("01.04.2007"; "01.05.2007"; "m") ``` ```Planfix Formula DATEDIF("31.03.2007"; "30.04.2007"; "m") ``` -------------------------------- ### Planfix Integration Settings Source: https://planfix.com/help/Brevo_Conversations In Planfix integration settings, add a title, your email, and paste the Brevo API key. Also, copy the 'Address for accepting requests' link for webhook setup. ```text In the integration settings, add a title, enter your email, and paste the copied Brevo API key: Also, copy and save the "Address for accepting requests" link; you will need it later to create a webhook. ``` -------------------------------- ### DATEDIF Examples for Remaining Days Calculation (md) Source: https://planfix.com/help/DATEDIF_Function Calculates the difference in days, ignoring months and years. The start date is aligned to the end date's month and year, with adjustments for invalid dates (e.g., April 31st becomes April 30th) and leap years. ```Planfix Formula DATEDIF("31.08.2007"; "01.05.2008"; "md") ``` -------------------------------- ### Enable and Start AMI Listener Service Source: https://planfix.com/help/FreePBX These commands enable the AMI listener service to start on boot and then start the service immediately. ```bash sudo systemctl enable crm-asterisk-listener sudo systemctl start crm-asterisk-listener ``` -------------------------------- ### Initiate Call with makeCall API Source: https://planfix.com/help/VoIP_API Use this command to initiate a call from a manager to a client within Planfix. It requires the manager's short code, the client's number, and the cloud PBX token. ```http POST https://domain/planfix_api.php cmd=makeCall from=101 to=79101234567 token=202cb962ac59075b964b07152d234b70 ``` -------------------------------- ### Get Help with @planfix_bot Commands Source: https://planfix.com/help/Working_with_Planfix_bots_for_Telegram Use the /help command to view a comprehensive list of available bot commands and their descriptions. ```bash /help ``` -------------------------------- ### Example Viber Chatbot Link Source: https://planfix.com/help/Viber This is an example of a Viber chatbot link for the Planfix support bot. ```text viber://pa?chatURI=planfix ``` -------------------------------- ### Configure Brevo Webhook Source: https://planfix.com/help/Brevo_Conversations Create a new webhook in Brevo's Integrations settings, providing a name and the 'Address for accepting requests' link copied from Planfix. Select the events to receive. ```text Give the webhook a name and insert the "Address for accepting requests" link that you copied from Planfix: At the bottom, select the events you want to receive, as shown in the screenshot above. ``` -------------------------------- ### Date Filter Example Source: https://planfix.com/help/REST_API%3A_Complex_contact_filters An example of a filter for the 'Creation date' type, specifying a date range. ```APIDOC ## Date Filter Example ### Description This example demonstrates how to filter contacts by creation date using a specific date range. ### Request Body Example ```json { "type": 12, "operator": "equal", "value": { "dateType": "otherDate", "dateFrom": "01-07-2022" } } ``` ``` -------------------------------- ### Extract and Display Task Data in a Table Source: https://planfix.com/help/Variables_in_Text This example demonstrates extracting specific data tags from a task and presenting them as a table. It includes column headers and a total amount calculation using Planfix's text formatting functions. ```Planfix Syntax %%$TABLE({{Data tag.Service}})$%% {{Data tag.Service.Service Name}} | {{Data tag.Service.Amount}} --- ``` -------------------------------- ### User Filter Example Source: https://planfix.com/help/REST_API%3A_Complex_contact_filters Example of filtering by a specific user ID. The format is 'user:ID'. ```json "value": "user:5" ``` -------------------------------- ### Install 'panoramisk' Library Source: https://planfix.com/help/FreePBX Ensure the 'panoramisk' library is installed for the script to function correctly. This command should be run in your terminal. ```bash pip install panoramisk ``` -------------------------------- ### Configured Webhook URL with Specific Values Source: https://planfix.com/help/Webhooks_with_GET_requests An example of a fully configured webhook URL with specific values for the 'project' and 'name' parameters, ready to be used to create a Planfix task. ```url https://your_account.planfix.ru/webhook/get/create_task?project=SEO&name=onboarding ``` -------------------------------- ### Request API using PHP Source: https://planfix.com/help/XML_API_v1 Example of how to request the Planfix API using PHP. This snippet shows how to send an XML request and handle the response. ```php account.get'); $headers = array(); $headers[] = 'Content-Type: application/xml'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); $xml = simplexml_load_string($result); if ($xml->error) { echo 'Error: ' . $xml->error->code . ' - ' . $xml->error->message; } else { // Process successful response print_r($xml); } ?> ``` -------------------------------- ### Example Summary of Task Progress Source: https://planfix.com/help/AI-agent_Summarizer This is an example of the concise summary generated by the AI-agent Summarizer, showing the current status of a task discussion. ```text The contract was sent to the customer on July 3 and still needs to be revised. The customer asked for a reminder on July 10. In the last message, the payment terms were clarified. ```