### Perform Batch Call with PHP SDK Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Illustrates how to perform a batch API call using the Bitrix24 PHP SDK. This example calls the getApplicationInfo method. ```php // Batch call example $batch = $serviceBuilder->getMainScope()->main()->getApplicationInfo(); ``` -------------------------------- ### Deploy Automation Rules Library Template Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Clone and deploy the Docker-based automation rules template. Configure environment variables and start the services using Docker Compose. ```bash # Clone and deploy the automation rules template git clone https://github.com/bitrix24/app-template-automation-rules.git cd app-template-automation-rules # Copy and configure environment variables cp .env.example .env # Edit .env: set BITRIX24_CLIENT_ID, BITRIX24_CLIENT_SECRET, APP_URL # Start all services with Docker Compose docker compose up -d # The app will be available at http://localhost:3000 # Register it as a Bitrix24 application via the developer portal ``` -------------------------------- ### Initialize PHP SDK via Webhook and Fetch User Profile Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Initializes the PHP SDK using incoming webhook credentials and demonstrates fetching the current user's profile. Ensure the vendor directory is autoloaded. ```php getMainScope()->main()->getCurrentUserProfile(); echo $result->getUserProfile()->NAME . ' ' . $result->getUserProfile()->LAST_NAME; ``` -------------------------------- ### Initialize JavaScript SDK in Bitrix24 Iframe and List Contacts Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Initializes the JavaScript SDK within a Bitrix24 iframe application and demonstrates fetching a list of CRM contacts. Includes error handling and logging. ```typescript import { initializeB24Frame, LoggerBrowser, B24LangList } from '@bitrix24/b24jssdk'; async function main() { // Initialize inside a Bitrix24 iframe application const $b24 = await initializeB24Frame(); const logger = LoggerBrowser.build('MyApp'); try { // Call a REST method const result = await $b24.callMethod('crm.contact.list', { filter: { TYPE_ID: 'CONTACT' }, select: ['ID', 'NAME', 'LAST_NAME', 'EMAIL'], order: { DATE_CREATE: 'DESC' }, }); logger.info('Contacts:', result.getData()); // Batch multiple calls in a single request const batchResult = await $b24.callBatch({ user: { method: 'user.current' }, profile: { method: 'profile' }, }); logger.info('User:', batchResult.getData()); } catch (error) { logger.error('API error:', error); } } main(); ``` -------------------------------- ### Create CRM Contact with PHP SDK Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Demonstrates creating a new CRM contact using the Bitrix24 PHP SDK. Requires the CRM scope to be available. ```php // Create a new CRM contact $contactService = $serviceBuilder->getCRMScope()->contact(); $newContact = $contactService->add([ 'NAME' => 'John', 'LAST_NAME'=> 'Doe', 'PHONE' => [['VALUE' => '+1234567890', 'VALUE_TYPE' => 'WORK']], 'EMAIL' => [['VALUE' => 'john.doe@example.com', 'VALUE_TYPE' => 'WORK']], ]); echo 'Created contact ID: ' . $newContact->getId(); ``` -------------------------------- ### Fetch CRM Deals with Python SDK Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Connects to Bitrix24 using the Python SDK via an incoming webhook and fetches a list of new CRM deals. It then iterates and prints deal information. ```python from b24pysdk import BitrixWebhook # Connect via incoming webhook bx = BitrixWebhook('https://your-portal.bitrix24.com/rest/1/your_webhook_token/') # Fetch a list of CRM deals deals = bx.call('crm.deal.list', { 'filter': {'STAGE_ID': 'NEW'}, 'select': ['ID', 'TITLE', 'OPPORTUNITY', 'CURRENCY_ID'], }) for deal in deals: print(f"Deal {deal['ID']}: {deal['TITLE']} — {deal['OPPORTUNITY']} {deal['CURRENCY_ID']}") ``` -------------------------------- ### Batch Call to Create Contacts with Python SDK Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Demonstrates how to use the Python SDK to create multiple CRM contacts simultaneously using a batch API call. The 'halt' parameter is set to 0 to continue processing even if one command fails. ```python # Batch call to create multiple contacts at once batch_payload = { 'halt': 0, 'cmd': { 'contact1': 'crm.contact.add?fields[NAME]=Alice&fields[LAST_NAME]=Smith', 'contact2': 'crm.contact.add?fields[NAME]=Bob&fields[LAST_NAME]=Jones', } } batch_result = bx.call('batch', batch_payload) print(batch_result) ``` -------------------------------- ### Implement Custom Automation Rule Logic in PHP Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Add custom automation rules by implementing the rule interface in PHP. The template handles Bitrix24 integration, allowing you to focus on your specific business logic. ```php // backend/src/AutomationRules/MyCustomRule.php // Add your own automation rule by implementing the rule interface: namespace App\AutomationRules; use B24\AutomationRules\BaseRule; class SendSlackNotificationRule extends BaseRule { public function execute(array $context): void { $dealTitle = $context['DOCUMENT_FIELDS']['TITLE'] ?? 'Unknown Deal'; $webhookUrl = $this->getOption('slack_webhook_url'); // Custom business logic — the template handles all Bitrix24 wiring file_get_contents($webhookUrl . '?payload=' . urlencode(json_encode([ 'text' => "Deal moved to new stage: {$dealTitle}", ]))); } } ``` -------------------------------- ### Simple REST Call via Webhook with CRest Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Use this snippet for making simple REST API calls to Bitrix24 via webhooks. Ensure the 'crest.php' file is included and handle potential errors from the API response. ```php ['STAGE_ID' => 'WON'], 'select' => ['ID', 'TITLE', 'OPPORTUNITY'], ]); if ($result['error']) { echo 'Error: ' . $result['error_description']; } else { foreach ($result['result'] as $deal) { echo "Won deal: {$deal['TITLE']} ({$deal['OPPORTUNITY']})\n"; } } ``` -------------------------------- ### Configure Tailwind CSS with B24Style Design Tokens Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Integrate B24Style design tokens into your Tailwind CSS configuration. This ensures your application's styling aligns with Bitrix24's native look and feel. ```javascript // tailwind.config.js import b24style from '@bitrix24/b24style'; export default { content: ['./src/**/*.{vue,ts,html}'], presets: [b24style], }; ``` -------------------------------- ### Apply Bitrix24 Design Tokens using Tailwind Classes Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Utilize Bitrix24 design tokens as Tailwind CSS utility classes in your HTML templates. This allows for seamless integration with the native Bitrix24 UI. ```html

Welcome to My App

Styled to match Bitrix24 natively.

``` -------------------------------- ### Build a CRM Contact Form with B24UI Components Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Use B24UI components to create a form for saving CRM contacts. Ensure all necessary components are imported from '@bitrix24/b24ui'. ```vue ``` -------------------------------- ### Integrate B24Icons in Vue Components Source: https://context7.com/bitrix24/bitrix24-dev-hub/llms.txt Use icons from the B24Icons library as Vue components within your templates. Ensure icons are imported from '@bitrix24/b24icons' and styled appropriately. ```vue ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.