Bitrix24 CRM & WhatsApp integration via Make.com

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 Contact at Bitrix24 CRM when a new WhatsApp Message is receive

1. Create a new scenario at Make.com
2. 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
3. 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

image 2
4 Configure the new <em>Bitrix24 Search Contacts<em> module<br><strong>Connection<strong> Click the <em>Add <em>button and enter your Bitrix24 URL > click Save
image 3
  • 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:
image 4
  • 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:
image 5
5 Add a new <em>Flow Control Router<em> 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 <em>Router<em> module click the + icon next to the existing <em>Bitrix24 Search Contacts<em> module > search for and select Flow Control > then select <em>Router<em> The result
image 6

6. 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:
image 7

7. 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

image 8
8 Configure the new <em>Bitrix24 Create Contact<em> module<br><strong>First name<strong> can be mapped with <em>chat full<em>name from a TimelinesAI webhook
image 9
  • Phone: can be mapped with the message: sender: phone from a TimelinesAI webhook
image 10
  • 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:

image 11

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.

1. 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:

image 12

2. 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

image 13

2. 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.
image 14

3. 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.

image 15

4. 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.

image 16

5. 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

6. 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.
image 17

7. 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

8. 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:

image 18

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.

image 19

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.

1. 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
image 20

2. 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

3. 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.
image 21

4. 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.

5. 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.

6. 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.

7. Add a Filter: click the wrench icon between the Router and the next empty module > then click Setup a filter!

  • Name your filter If the 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:
image 22

8. 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

9. 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 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.
image 23

10. Right-click the newly created module and rename it to “API call: add WA message as a comment to the task”

11. Save your changes and add a 2nd Filter:

  • Name your filter If the 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:
image 24

11. 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

12. 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.
image 25

13. Right-click the newly created module and rename it to “API call: create a task”

14. 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.

15. 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

16. 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.
image 26

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.

image 27

Table of Contents

Omnichannel Automation Platform

TimelinesAI helps businesses with multiple individual numbers gain 360° visibility & boost performance on WhatsApp.

ajkasjdlaspng

Latest from Blog