Bitrix24: converting products to tasks

How to automate marketing agency by Bitrix24? All that marketing agency does is selling its services. All that ordinary CRM does is selling products. Lead is converted to Deal when both — service provider and service consumer — agree on what shall be done to solve customer’s needs.
Every service has its standard title, measure, and price. Service is a product. Bitrix24 has a nice product catalog. Deals, Offers, Quotes, Contracts, Invoices — all these entities have access to such a catalog.

But what Bitrix24 suggests to do when your customer has approved your offer or your quote? At that exciting moment, you start a project for your customer. And how do you actually start it? You ought to re-enter all your products into the Tasks and Project Management module! It is inconvenient and eventful by mistake by mistakes and misunderstandings.

Imagine if you succeeded to sell website development for your customer. Most probably it will contain the following bunch of works: Specification, Wireframing, Design, Programming, Content migration, and Testing.

Now, when you have such a beautiful quote, in out-of-the-box Bitrix24, you open two windows and copy your products and paste them into the tasks! I bet it’s uncomfortable, to say the least.

So, here comes small but powerful customization.

Bitrix24 has a quite advanced API, which allows you to create external programs and work with Bitrix24 data directly. When I say directly, I definitely mean it: you may read almost any table. You may update its records, add new once and even delete some of them!

Meanwhile, Bitrix24 REST API keeps all integrity in a very sophisticated fist. Believe me, it is hard to destroy Bitrix24 through its own API. Almost impossible!

Now then, we have to make this: once the Deal passed some status, all Deal’s products must be turned into Tasks. To do that, we need some knowledge of, say, PHP (it might be Python as well, or JavaScript, or… almost whatever programming language) and make this small script.

What exactly it does:

  1. Takes product to the array
  2. Sends that array as a parameter to the TaskAdd function.

That is it!

All you need to run such a beautiful script, mention its name in the automation rules here: Your Bitrix24 portal \ Deal \ Automation rules.

Maybe, you will want to make the opposite workflow: once some of the tasks are finished, you want to bill your customer accordingly and… automatically? Yes, you do. And I will show you how to do that right in the next video.

There are many useful things marketing agencies can do with B24 customizations. Ideally, all of those business processes should be done automatically. For example:

  1. the workflow of collaboration with vendors
  2. Invoicing automation
  3. Billing by project phases
  4. Moving the whole data (Emails, Documents, Media, Knowledge) from CRM to the Project Management area, etc.

If you want to know how to make such customizations, leave a comment. Or, you may ask your own question, describe your own task and I will try to answer in my future videos.

Useful adds

“Customizing Bitrix24 by the webhook” — article, video, and source code

Video “How to import companies, contacts, and deals into Bitrix24

The source code of a webhook “Bitrix24: conversion of Products to Tasks webhook” link to GitHub and the code itself here:


ini_set("log_errors", 1);
ini_set("error_log", "./php-error.log");

// Validate params
if (!(isset($_GET['id']) && isset($_GET['responsible']))) {
'error' => 'id and responsible params is required'

require __DIR__ . '/vendor/autoload.php';

use \App\Bitrix24\Bitrix24API;

$webhookURL = 'your URL';

$bx24 = new Bitrix24API($webhookURL);

$id = $_GET['id'];
$responsible = intval(str_replace('user_', '', $_GET['responsible']));

$deal = $bx24->getDeal($id, ['PRODUCTS']);

$deal_url = 'https://{your portal}/crm/deal/details/' . $deal['ID'] . '/';

$contactExist = $deal['CONTACT_ID'] != 0 ? true : false;
$companyExist = $deal['COMPANY_ID'] != 0 ? true : false;

try {
$projectId = $bx24->request('lists.element.get', [
'IBLOCK_TYPE_ID' => 'lists',
'IBLOCK_ID' => '17'
} catch (Exception $e) {
$projectId = '17'; // TODO: to point default id

foreach ($deal['PRODUCTS'] as $product) {
$title = '';

if ($companyExist) {
$company = $bx24->getCompany($deal['COMPANY_ID']);

$title = $company['TITLE'] . ' - ' . $product['PRODUCT_NAME'];
} elseif (!$companyExist && $contactExist) {
$contact = $bx24->getContact($deal['CONTACT_ID']);

$title = $contact['LAST_NAME'] . ' - ' . $product['PRODUCT_NAME'];
} else {
$title = $product['PRODUCT_NAME'];

// echo $title;
$result = $bx24->addTask([
'TITLE' => $title,
'DESCRIPTION' => 'deal: ' . $deal_url,
'RESPONSIBLE_ID' => $responsible,
'GROUP_ID' => $projectId,
'UF_TYPE_NEW' => false,

echo $product['PRODUCT_NAME'], ' task added';

Originally published at




Entrepreneur. Investor. CRM consultant. No-code developer. UX/UI designer. Bitrix24, Salesforce, Webflow, Tilda Publishing, implementer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hey, Maker! We’re gonna show you a little bit behind the scenes, okay? :)

Run Your Python Code as Quickly as C++

The closure of the Architecture testing with ArchUnit series, which we really like, is about the…

Logging Apache Geode GatewaySender Queue Events

Connecting loved ones: building the NHS Book a virtual visit service in 48 hours

PHP Basic Programming Vol 2: Executing Source Code

An honest look into migrating an Android app to a modular architecture (Part 1)

Hacker101 CTF [Trivial] A little something to get you started Write-up

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dmitriy Slinkov

Dmitriy Slinkov

Entrepreneur. Investor. CRM consultant. No-code developer. UX/UI designer. Bitrix24, Salesforce, Webflow, Tilda Publishing, implementer.

More from Medium

Building the right Quality Strategy at a startup with limited resources

Improving Powkiddy V90’s Portable Experience

4 Reasons Why the Dabadu CSR Team Chose Loom To Create Video Tutorials!

Example of a Loom video embedded in a Help Center article

5 Strategies to Deploy Microservices | Datafortune