1
1
1ndrei2020-08-02 14:07:38
Bitrix24
1ndrei, 2020-08-02 14:07:38

How to pass parameters for an incoming webhook to Bitrix24 using Javascript?

I want to send leads/deals from Google spreadsheets to Bitrix24.

A quick start is described here .

In general, this can be broken down into 3 steps, as described here :

  1. generate a URL in the $queryUrl variable https://[your_domain].bitrix24.ru/rest/[identifier... ;
  2. form parameters for creating a lead in the $queryData variable;
  3. contact Bitrix24 using the curl_exec function.


But since the work will be from Googlesheets, PHP examples are not applicable.

Step 1 is absolutely clear.
2nd - also should not be difficult.

How to do the 3rd step with Google Apps Script?

I understand that this is done through UrlFetchApp. But how are these parameters passed? I haven't worked with PHP, so I can't figure out what this code does specifically.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1ndrei, 2020-08-02
@1ndrei

function myFunction() {
let url = " https://*************/rest/7/*******/crm.lead.add.json/ "
// let data = { 'TITLE': 'Testing lead'}
let data = {
'fields':{'TITLE': 'Testing lead'}
}
let options = {
'method': 'post',
'contentType': 'application/json',
'payload': JSON.stringify(data)
};
UrlFetchApp.fetch(url, options)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question