Bitrix24 Community

Support » Forum » CRM » How to use webhook to add lead in my bitrix
Pages: 1
RSS
How to use webhook to add lead in my bitrix, can't input data using the webhook
I've created an Inbound webhook that has access to crm and if I use it in a GET request and use the crm.lead.list method I get results
however I tried and tried to use the crm.lead.add method but couldn't get it to work it always says "{"error":"","error_description":"The required field \u0027Lead name\u0027 is missing.\u003Cbr \/\u003E"}"
can someone please show me how to do this
my main goal is to insert data from my mysql database using php, I jsut need to figure out how to use the bitrix24 webhook
https://fennecfox.bitrix24.com/rest/1/6randomeky/crm.lead.add?name=myname
Edited: Yaman Tarakji - 01/18/2017 19:02:30
I'm having the same issue. According to https://training.bitrix24.com/rest_help/crm/leads/crm_lead_add.php
the field values are
fields:                {
                   "TITLE": "FatJoint LLC",
                   "NAME": "Paul",
                   "SECOND_NAME": "A.",
                   "LAST_NAME": "Nibot",
                   "STATUS_ID": "NEW",
                   "OPENED": "Y",
                   "ASSIGNED_BY_ID": 1,
                   "CURRENCY_ID": "USD",
                   "OPPORTUNITY": 12500,
                   "PHONE": [ { "VALUE": "555888", "VALUE_TYPE": "WORK" } ]
               }
Where TITLE is the required field presumably the Lead name. But using TITLE still gives the same error even when using the key and values from the example above

i.e {"error":"","error_description":"The required field \u0027Lead name\u0027 is missing.\u003Cbr \/\u003E"}

If you put this in any REST Tester, it should work

https://your.bitrix24.com/rest/1/xxxxxxxxxxxxxxxxxx/crm.lead.add

{"fields":{"TITLE":"my test","NAME":"tester","EMAIL":[{"VALUE":"name@email.com","VALUE_TYPE":"WORK"}],"ADDRESS_COUNTRY":"SA","ADDRESS_CITY":"","PHONE":[{"VALUE":"18582445555","VALUE_TYPE":"WORK"}],"ASSIGNED_BY_ID":"10","CURRENCY_ID":"SAR","UTM_SOURCE":"adward","UTM_CAMPAIGN":"test","UTM_CONTENT":"default","SOURCE_ID":"WEB","STATUS_ID":"ASSIGNED","COMMENTS":"uu"},"params":{"REGISTER_SONET_EVENT":"y"}}

Edited: Yaman Tarakji - 03/07/2017 10:11:03
@Yaman,

I'm getting the above error with that input, as well. I tried swapping out TITLE with "LEAD_NAME" with the same results.

For my test, a post request was going to this URL

https://tbn.bitrix24.com/rest/18/xxxxxxxxx/crm.lead.add

With the following body:

{"fields":{"TITLE":"my test","NAME":"tester","EMAIL":[{"VALUE":"name@email.com","VALUE_TYPE":"WORK"}],"ADDRESS_COUNTRY":"SA","ADDRESS_CITY":"","PHONE":[{"VALUE":"18582445555","VALUE_TYPE":"WORK"}],"ASSIGNED_BY_ID":"18","CURRENCY_ID":"SAR","SOURCE_ID":"WEB","STATUS_ID":"UNASSIGNED","COMMENTS":"uu"},"params":{"REGISTER_SONET_EVENT":"y"}}
Hi!

Please contact our Helpdesk. Thank you.

Best,

Yana.
Quote
Yana Prokopets wrote:
Hi!

Please contact our  Helpdesk . Thank you.

Best,

Yana.
I did yesterday
no answer
ticket id = 1412647
Quote
DJ Gillespie wrote:
@Yaman,

I'm getting the above error with that input, as well. I tried swapping out TITLE with "LEAD_NAME" with the same results.

For my test, a post request was going to this URL

https://tbn.bitrix24.com/rest/18/xxxxxxxxx/ crm.lead.add

With the following body:

{"fields":{"TITLE":"my test","NAME":"tester","EMAIL":[{"VALUE":" name@email.com ","VALUE_TYPE":"WORK"}],"ADDRESS_COUNTRY":"SA","ADDRESS_CITY":"","PHONE":[{"VALUE":"18582445555","VALUE_TYPE":"WORK"}],"ASSIGNED_BY_ID":"18","CURRENCY_ID":"SAR","SOURCE_ID":"WEB","STATUS_ID":"UNASSIGNED","COMMENTS":"uu"},"params":{"REGISTER_SONET_EVENT":"y"}}
yes you're right I tried this and it's not working anymore, I swear it worked for me the other day,,, weird
Quote
DJ Gillespie wrote:
@Yaman,

I'm getting the above error with that input, as well. I tried swapping out TITLE with "LEAD_NAME" with the same results.

For my test, a post request was going to this URL

https://tbn.bitrix24.com/rest/18/xxxxxxxxx/ crm.lead.add

With the following body:

{"fields":{"TITLE":"my test","NAME":"tester","EMAIL":[{"VALUE":" name@email.com ","VALUE_TYPE":"WORK"}],"ADDRESS_COUNTRY":"SA","ADDRESS_CITY":"","PHONE":[{"VALUE":"18582445555","VALUE_TYPE":"WORK"}],"ASSIGNED_BY_ID":"18","CURRENCY_ID":"SAR","SOURCE_ID":"WEB","STATUS_ID":"UNASSIGNED","COMMENTS":"uu"},"params":{"REGISTER_SONET_EVENT":"y"}}
Hi there after talking with technical support at helpdesk.bitrix24.com
they helped me and this is a working example:
Code
fields[TITLE]=Valve Co.&fields[NAME]=Gabe Newell&fields[EMAIL][0][VALUE]=gabe@valve.com&fields[EMAIL][0][VALUE_TYPE]=WORK&fields[ADDRESS_COUNTRY]="USA"&fields[ADDRESS_CITY]="Seattle"&fields[PHONE][0][VALUE]=0530447351&fields[PHONE][0[VALUE_TYPE]=WORK&fields[ASSIGNED_BY_ID]=1&fields[CURRENCY_ID]=SAR&fields[UTM_SOURCE]=adward&fields[UTM_CAMPAIGN]=test&fields[UTM_CONTENT]=default&fields[SOURCE_ID]=WEB&fields[STATUS_ID]=ASSIGNED&fields[COMMENTS]=CEO
must be single line..
Edited: Yaman Tarakji - 04/05/2017 09:49:34
Support also gave me a similar response. The lead gets created, but now the status doesn't assign. (Which is weird, because when it's not a single line the status is just fine.) Does the status assign for you?
It looks like when I use numerical values for [STATUS_ID], Some statuses work, (It appears like the numerical assignment is arbitrary. I've tried 1-20 and about 2/3 of those numbers result in a status, but they're all over the place. (i.e. 1 is one of the lead lost statuses, and 13 is the fifth status)) but not all statuses appear to be assigned to a number.

EDIT:
Nvm It looks like the status ID's don't change with the status names, so the first few statuses are the Bitrix default (NEW, ASSIGNED, etc) and all custom statuses have a numerical assignment. I updated a lead's status and just used crm.lead.get to get the status id's and stored them in a map. :)  
Edited: DJ Gillespie - 04/05/2017 19:36:04
Pages: 1
2,000,000+
organizations
are already using Bitrix24