Bitrix24 CRM & Make.com

via Make.com

Table of contents



Create a new Contact at Bitrix24 CRM when new WhatsApp Message is received

Synchronize new incoming WhatsApp messages into task comments at Bitrix24 CRM




Create a new Contact at Bitrix24 CRM when a new WhatsApp Message is received



This flow creates a contact at Bitrix24 CRM when the new WhatsApp message is received and contact with such a number does not exist at Bitrix24. The flow is based on TimelinesAI Webhooks , Bitrix24 CRM integration with Make.com and Bitrix24 CRM Rest API.


Create a new scenario at Make.com
Add a Custom Webhook module . Further steps require data from a webhook to be present. Make sure you've run the Webhook module and have data in the payload
Add a new Bitrix24 Search Contacts module: The purpose of this step is to check whether contact already exists at Bitrix24 CRM or not. The check is done using the Phone Number field. To add this module click the + icon next to the existing Webhooks module > search for and select Bitrix24 > then select Search Contacts
Configure the new Bitrix24 Search Contacts module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save: |
Filter: select Phone ; operators: equals . Click the next empty field. A new box will appear to the right with data available from the Webhook module. Find sender > phone . You can either click the found value OR drag and drop it into the empty field:
Click OK
Right-click the newly created Bitrix24 Search Contacts and select Run this module only > enter any phone number > click OK. This searches your Bitrix24 CRM contacts by entered phone number and returns results on whether contact with such phone number exists or not. Further steps require output data from this to be present. Make sure you've run the Bitrix24 Search Contacts and have data in the payload:
Add a new Flow Control Router module: The purpose of this step is to divide the flow into 2 branches: 1- if the search module found the contact, 2-if the search module did not find the contact. To add the Router module click the + icon next to the existing Bitrix24 Search Contacts module > search for and select Flow Control > then select Router . The result:
Add the first Filter: click the wrench icon between the Router and the next empty module > then click Setup a filter
Name your filter Contact does not exist
Condition: click the field. A new box will appear to the right with data available from the Bitrix24 Search Contacts module. Find Total number of bundles >. You can either click the found value OR drag and drop it into the empty field
Numeric operators: select less then and type 1 into the next field:
Add a new Bitrix24 Create Contact module: The purpose of this step is to create a contact if it was not found by the Search module. To add this new module click the + icon next to the existing "Contact does not exist" filter > search for and select Bitrix24 > then select Create Contact
Configure the new Bitrix24 Create Contact module:
First name: can be mapped with chat: fullname_ from a TimelinesAI webhook
Phone: can be mapped with the message: sender: phone from a TimelinesAI webhook
Other fields: can be mapped, left empty, or have custom data per your needs

End result: TimelinesAI Webhook monitors incoming WhatsApp messages > searches Bitrix24 CRM for contact by phone number > if contact is not found > creates a new contact:



Synchronize new incoming WhatsApp messages into task comments at Bitrix24 CRM



This flow creates a task at Bitrix24 CRM when the new WhatsApp message is received, links the task with the corresponding Bitrix24 CRM contact and adds new incoming WhatsApp messages as comments to the task .The flow is based on TimelinesAI Webhooks , Bitrix24 CRM integration with Make.com and Bitrix24 CRM Rest API.

Complete the steps from Create a new Contact at Bitrix24 CRM when new WhatsApp Message is received part of this article first. You should have the following modules in your scenario to proceed further:

Add a new Make an API Call module: The purpose of this module is to create a task at Bitrix24 CRM and link the task to the Bitrix24 CRM contact that was created earlier in this flow. To add a new module: mouse hover the existing Create a contact module and click the + to add a new module. Search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: tasks.task.add
Method: POST
Headers: add a new header with key = Content-Type and value= application/json
Body: add

{ "fields": {
           "TITLE": "TimelinesAI_WhatsApp_messages",
           "UF_CRM_TASK": ["C_YOUR_ID_HERE],
          "ADD_IN_REPORT": "N",
          "STATUS":"5",
           "RESPONSIBLE_ID": "1"
       }
}

Note: parameter details of this request are available at https://training.bitrix24.com/rest_help/tasks/task/tasks/tasks_task_getFields.php
YOUR_ID_HERE must be replaced with the output data of your own Create a contact module.
Save your changes. Right-click the newly created module and rename it to API call: create a task. Renaming modules properly is important to avoid any confusion down the road as you will be adding more Make an API Call modules.
Right-click the module and click Run this module only > enter the contact ID from your Bitrix24 CRM > click OK. To find the contact ID in Bitrix24 CRM, open the Contact List, select any contact (preferably a test contact), and look at the URL of the page you land on. For example, if the URL is https://XXXX.bitrix24.com/crm/contact/details/17/, the contact ID is 17. After running the module, check the contact's page in Bitrix24 CRM to confirm that the new task was created.
Add a new Make an API Call module: The purpose of this step is to add received WhatsApp messages as comments to the Bitrix24CRM task you've created earlier in the flow. To add the module: mousehover the last API call: create a task module and click the + to add a new module. Search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: task.commentitem.add
Method: POST
Headers: add a new header with key = Content-Type and value= application/json
Body: add
[YOUR_TASKID_HERE,  {
                 "POST_MESSAGE": "YOUR_TIME_HERE message received: YOUR_MESSAGE_TEXT"
     }
]

YOUR_TASKID_HERE must be replaced with the output data of your own API call: create a task.
YOUR_TIME_HERE and YOUR_MESSAGE_TEXT must be replaced with the output data of the original webhook module. You can include additional data into the POST_MESSAGE field from your Webhook if needed.
Save your changes. Right-click the newly created module and rename it to API call: add WA message as a comment to the task. Renaming modules properly is important to avoid any confusion down the road as you will be adding more Make an API Call modules
Right-click the module and click Run this module only > enter the random numbers into "Timestamp" field > enter the testing task ID from your Bitrix24 CRM > click OK. To find the task ID in Bitrix24 CRM, open any task ( preferably a testing one). You can find the task created at Bitrix24 CRM when you run earlier modules and use it for testing. Look at the URL of the page you land on. For example, if the URL is https://XXX.bitrix24.com/company/personal/user/1/tasks/task/view/35/XXXX , 35 will be the task ID. Enter the random text. In an production mode received WhatsApp message will become a text. After running the module, check the task's page in Bitrix24 CRM to confirm that the comment to the task was added:

Intermediate result : Webhook monitors incoming WhatsApp messages > searches Bitrix24 CRM for contact by phone number > if contact is not found > creates a new contact > creates a special task and links it to the contact > adds received WhatsApp messages as comments to the task .


So far we have worked in a branch where the contact did NOT exist at Bitrix24 CRM and we had to create them, then create a task and add WhatsApp messages as comments to that task. In this section we will work on a new branch of the flow where the contact already exists and we just need to add a task and comments.

Add a new filter. Click the wrench icon between the Router and the next empty module > then click Setup a filter (https://storage.crisp.chat/users/helpdesk/website/94268256ba492800/screen-shot-2024-01-16-at-1754_o6wobi.png)
Name your filter Contact exists
Condition: click the field. A new box will appear to the right with data available from the Bitrix24 Search Contacts module. Find Total number of bundles >. You can either click the found value OR drag and drop it into the empty field
Numeric operators: select greater then or equals and type 1 into the next field
Add a new Make an API Call module: The purpose of this step is to find whether the existing contact has a task where WhatsApp messages are stored or not. To add a module click the + sign after the latest created filter > search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: tasks.task.list.json?order[CREATED_DATE]=desc&filter[UF_CRM_TASK]=C_YOUR_CONTACT_ID_HERE&[TITLE]=TimelinesAI_WhatsApp_Messages
Method: GET
Headers: add a new header with key = Content-Type and value= application/json
Body: empty
YOUR_CONTACT_ID_HERE must be replaced with the output data from your own Search Contacts module.
Save your changes. Right-click the newly created module and rename it to API call: search tasks. Renaming modules properly is important to avoid any confusion down the road as you will be adding more Make an API Call modules.
Right-click the module and click Run this module only > enter the contact ID from your Bitrix24 CRM > click OK. To find the contact ID in Bitrix24 CRM, open the Contact List, select any contact (preferably a test contact), and look at the URL of the page you land on. For example, if the URL is https://XXXX.bitrix24.com/crm/contact/details/17/, the contact ID is 17.
Add a new Flow Control Router module: The purpose of this step is to divide the flow into 2 more branches: 1- if the search tasks module found the task, 2-if the search module did not find the task. To add the Router module click the + icon next to the existing API call: search tasks module > search for and select Flow Control > then select Router .
Add a Filter: click the wrench icon between the Router and the next empty module > then click Setup a filter ![]
Name your filter If Task exists
Condition: click the field. A new box will appear to the right with data available from the API call: search tasks module. Find Body > Total >. You can either click the found value OR drag and drop it into the empty field
Numeric operators: select equals to and type 1 into the next field:
Add a new Make an API Call module: The purpose of this step is to add received WhatsApp messages as comments to the found Bitrix24CRM task. To add this module click the + icon next to the existing "If Task exists" filter > search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: task.commentitem.add
Method: POST
Headers: add a new header with key = Content-Type and value= application/json
Body: add
[YOUR_TASKID_HERE,  {
                 "POST_MESSAGE": "YOUR_TIME_HERE message received: YOUR_MESSAGE_TEXT"
     }
]


YOUR_TASKID_HERE must be replaced with the output data of your own API call: search tasks module.
YOUR_TIME_HERE and YOUR_MESSAGE_TEXT must be replaced with the output data of the original webhook module. You can include additional data into the POST_MESSAGE field from your Webhook if needed.
Right-click the newly created module and rename it to "API call: add WA message as a comment to the task"
Save your changes and add a 2nd Filter:
Name your filter If task does not exist
Condition: click the field. A new box will appear to the right with data available from the API call: search tasks module. Find Body > Total >. You can either click the found value OR drag and drop it into the empty field
Numeric operators: select less then and type 1 into the next field:
Add a new Make an API Call module: The purpose of this module is to create a task at Bitrix24 CRM and link the task to the existing Bitrix24 CRM contact. To add this module click the + icon next to the existing "If Task does not exists" filter > search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: tasks.task.add
Method: POST
Headers: add a new header with key = Content-Type and value= application/json
Body: add
{ "fields": {
           "TITLE": "TimelinesAI_WhatsApp_messages",
           "UF_CRM_TASK": ["C_YOUR_ID_HERE],
            "ADD_IN_REPORT": "N",
          "STATUS":"5",
           "RESPONSIBLE_ID": "1"
       }
}

Note: parameter details of this request are available at https://training.bitrix24.com/rest_help/tasks/task/tasks/tasks_task_getFields.php

YOUR_ID_HERE must be replaced with the output data from your own Search Contacts module.
Right-click the newly created module and rename it to "API call: create a task"
Right-click the module and click Run this module only > enter the contact ID from your Bitrix24 CRM > click OK. To find the contact ID in Bitrix24 CRM, open the Contact List, select any contact (preferably a test contact), and look at the URL of the page you land on. For example, if the URL is https://XXXX.bitrix24.com/crm/contact/details/17/, the contact ID is 17. After running the module, check the contact's page in Bitrix24 CRM to confirm that the new task was created.
Add a new Make an API Call module: The purpose of this step is to add received WhatsApp messages as comments to the Bitrix24CRM task you've created earlier. To add this module click the + icon next to the existing API call: create a task module > search for and select Bitrix24 > then select Make an API Call
Configure the new Make an API Call module:
Connection: Click the Add button and enter your Bitrix24 URL > click Save
URL: task.commentitem.add
Method: POST
Headers: add a new header with key = Content-Type and value= application/json
Body: add
[YOUR_TASKID_HERE,  {
                 "POST_MESSAGE": "YOUR_TIME_HERE message received: YOUR_MESSAGE_TEXT"
     }
]

YOUR_TASKID_HERE must be replaced with the output data of your own API call: create a task module_.
YOUR_TIME_HERE and YOUR_MESSAGE_TEXT must be replaced with the output data of the original TimelinesAI webhook module. You can include additional data into the POST_MESSAGE field from your TimelinesAI Webhook if needed.

End result: TimelinesAI Webhook monitors incoming WhatsApp messages > searches Bitrix24 CRM for contact by phone number > if contact is not found > creates a new contact > creates a special task and links it to the contact > adds received WhatsApp messages as comments to the task . If the contact was found > searches whether a special task where WhatsApp messages are stored exists> if it exists adds new incoming message a comment to this task. If the task does not exist > first created a task> then adds messages as comments to that task

Updated on: 17/01/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!