Bitrix24 webhook/REST API - webhooks
I'd like to create TASK in bitrix24 with webhook URL. Almost everything is fine (task name, description, responsible, deadline etc...) the only problem is with field with several users (Observers and Participants). I don't know how to add these parameters to the URL :( The documentation is incomplete.
The solution is easy, I didn't see your code but per the API doc, you need to encode the JSON array of fields as parameters into the GET request: this will help you: How should I put json in GET request?
A better approach would be using POST to submit data instead of GET, this way you don't need to do the above, you can send the array as it.
This is the API doc you need to follow:
https://training.bitrix24.com/rest_help/tasks/task/tasks/tasks_task_add.php
Here is the array of fields you can set as the "fields" parameter when creating a task:
https://training.bitrix24.com/rest_help/tasks/fields.php
Example of an array of fields:
Array
(
[TITLE] => Process lead: +19196299012 - Outgoing call (set from business process)
[STAGE_ID] => 0
[DESCRIPTION] => Process lead: +19196299012 - Outgoing call
[DEADLINE] =>
[START_DATE_PLAN] =>
[END_DATE_PLAN] =>
[PRIORITY] => 0
[ACCOMPLICES] => Array
(
)
[AUDITORS] => Array
(
)
[TAGS] => Array
(
)
[ALLOW_CHANGE_DEADLINE] => Y
[ALLOW_CHANGE_DEADLINE_COUNT] =>
[ALLOW_CHANGE_DEADLINE_COUNT_VALUE] =>
[ALLOW_CHANGE_DEADLINE_MAXTIME] =>
[ALLOW_CHANGE_DEADLINE_MAXTIME_VALUE] =>
[TASK_CONTROL] => Y
[PARENT_ID] =>
[DEPENDS_ON] => Array
(
)
[GROUP_ID] => 0
[RESPONSIBLE_ID] => 1
[TIME_ESTIMATE] => 0
[ID] => 130
[CREATED_BY] => 1
[DESCRIPTION_IN_BBCODE] => Y
[DECLINE_REASON] =>
[REAL_STATUS] => 2
[STATUS] => 2
[RESPONSIBLE_NAME] => Mohamed Ali
[RESPONSIBLE_LAST_NAME] => Ouled Ameur
[RESPONSIBLE_SECOND_NAME] =>
[DATE_START] =>
[DURATION_FACT] =>
[DURATION_PLAN] =>
[DURATION_TYPE] => days
[CREATED_BY_NAME] => Mohamed Ali
[CREATED_BY_LAST_NAME] => Ouled Ameur
[CREATED_BY_SECOND_NAME] =>
[CREATED_DATE] => 2021-06-26T08:12:39+03:00
[CHANGED_BY] => 1
[CHANGED_DATE] => 2021-06-26T08:12:39+03:00
[STATUS_CHANGED_BY] => 1
[STATUS_CHANGED_DATE] => 2021-06-26T08:12:39+03:00
[CLOSED_BY] =>
[CLOSED_DATE] =>
[ACTIVITY_DATE] => 2021-06-26T08:12:39+03:00
[GUID] => {bcd84631-6c08-4124-8db2-7cfe90628dc1}
[MARK] =>
[VIEWED_DATE] => 2021-06-28T09:09:17+03:00
[TIME_SPENT_IN_LOGS] =>
[FAVORITE] => N
[ALLOW_TIME_TRACKING] => N
[MATCH_WORK_TIME] => N
[ADD_IN_REPORT] => Y
[FORUM_ID] =>
[FORUM_TOPIC_ID] =>
[COMMENTS_COUNT] =>
[SITE_ID] => s1
[SUBORDINATE] => Y
[FORKED_BY_TEMPLATE_ID] =>
[MULTITASK] => N
[UF_CRM_TASK] => Array
(
[0] => L_38
[1] => L_38
)
[UF_MAIL_MESSAGE] =>
[UF_TASK_WEBDAV_FILES] =>
)
to set more then one, you can use this. In the array every usernumber
$accomplice = ['1','2'];
$createTask = CRest::call('tasks.task.add',
...
'ACCOMPLICES' => $accomplice,
...
Related
Different results between NodeJS and PL SQL executions (Oracle)
PL statement: sca.pac_age_web_infm_supl.pro_gera_ssos_infm_supl( i_cod_un_cons => :i_cod_un_cons (float), i_num_cli => :i_num_cli (float), i_nom_sist_orig => :i_nom_sist_orig (string), i_cod_tipo_aces => :i_cod_tipo_aces (string), i_cod_tipo_sol => :i_cod_tipo_sol (string), i_cod_tipo_ger => :i_cod_tipo_ger (string), i_ano_emis => :i_ano_emis (float), i_qtd_mes_emis => :i_qtd_mes_emis (float), i_cod_tipo_emis => :i_cod_tipo_emis (string), i_cod_email => :i_cod_email (string), i_cod_tipo_vin => :i_cod_tipo_vin (string), i_cod_tipo_rel => :i_cod_tipo_rel (string), i_sta_cobr_emis => :i_sta_cobr_emis (string), i_vlr_cobr_emis => :i_vlr_cobr_emis (float), o_cod_cpu_os => :o_cod_cpu_os, o_num_seq_oper_os => :o_num_seq_oper_os, o_num_seq_ger_os => :o_num_seq_ger_os, o_cntd_arq => :o_cntd_arq, o_cursor => :o_cursor, o_msg_erro => :o_msg_erro); end; NodeJS function: var sql = 'BEGIN PAC_AGE_WEB_INFM_SUPL.PRO_GERA_SSOS_INFM_SUPL(:i_cod_un_cons, :i_num_cli, :i_nom_sist_orig, :i_cod_tipo_aces, :i_cod_tipo_sol, :i_cod_tipo_ger, :i_ano_emis, :i_qtd_mes_emis, :i_cod_tipo_emis, :i_cod_email, :i_cod_tipo_vin, :i_cod_tipo_rel, :i_sta_cobr_emis, :i_vlr_cobr_emis, :o_cod_cpu_os, :o_num_seq_oper_os, :o_num_seq_ger_os, :o_cntd_arq, :o_cursor, :o_msg_erro); END;'; Any tips on why my func returning ORA-01036? All my bindvards correctly typed.
Missing colon, here: :i_sta_cobr_emis, i_vlr_cobr_emis, :o_cod_cpu_os ^ |
Solved by droping the object and recompiling it. Thanks, guys!
Fill cells with formula, adjusting one field and keeping the other
I have following formula in cell K40: =CONCATENATE("['",B39,"' => '",B40,"', '",C39,"' => ",C40,", '",D39,"' => '",D40,"', '",E39,"' => '",E40,"', '",F39,"' => '",F40,"', '",G39,"' => '",G40,"', '",H39,"' => '",H40,"', '",I39,"' => '",I40,"', '",J39,"' => '",J40,"'],") and this formula in cell K41: =CONCATENATE("['",B39,"' => '",B41,"', '",C39,"' => ",C41,", '",D39,"' => '",D41,"', '",E39,"' => '",E41,"', '",F39,"' => '",F41,"', '",G39,"' => '",G41,"', '",H39,"' => '",H41,"', '",I39,"' => '",I41,"', '",J39,"' => '",J41,"'],") As you can see, for every row every odd field needs to stay the way it is, and every even field needs to increase. I've tried to fill in this formula for the rest of rows in my table, given these two cells, but for cell K42 Excel populated it as: =CONCATENATE("['",B41,"' => '",B42,"', '",C41,"' => ",C42,", '",D41,"' => '",D42,"', '",E41,"' => '",E42,"', '",F41,"' => '",F42,"', '",G41,"' => '",G42,"', '",H41,"' => '",H42,"', '",I41,"' => '",I42,"', '",J41,"' => '",J42,"'],") but it should be populated as: =CONCATENATE("['",B39,"' => '",B42,"', '",C39,"' => ",C42,", '",D39,"' => '",D42,"', '",E39,"' => '",E42,"', '",F39,"' => '",F42,"', '",G39,"' => '",G42,"', '",H39,"' => '",H42,"', '",I39,"' => '",I42,"', '",J39,"' => '",J42,"'],") How can I achieve this?
Try entering formula using $, it will fix the row, so it won't be adjusted when coopying formula: =CONCATENATE("['",B$39,"' => '",B40,"', '",C$39,"' => ",C40,", '",D$39,"' => '",D40,"', '",E$39,"' => '",E40,"', '",F$39,"' => '",F40,"', '",G$39,"' => '",G40,"', '",H$39,"' => '",H40,"', '",I$39,"' => '",I40,"', '",J$39,"' => '",J40,"'],")
How to call Recursive function for array data Using Promises in Node Js
I am trying to call the recursive function in my code. The loop executing first time, but recursive function which is called inside the function is not working. Here is my code : function buildDynamicMenu(elements,parentId) { branch =new Array(); elements.forEach(function(element){ if (element['parent_id'] == parentId) { children = buildDynamicMenu(elements, element['menu_id']); //Recursive function not working if (children) { element['children'] =children; } branch = element; } }); return branch; } var parentId=0; buildDynamicMenu(data); // Array data I have added sample array which I am using for this logic, array has menu and Submenu Id, we have to call recursive function to loop through all sub array Array ( [0] => Array ( [menu_id] => 1 [menu_name] => Home [parent_id] => 0 [link] => #home ) [1] => Array ( [menu_id] => 2 [menu_name] => Web development [parent_id] => 0 [link] => #web-dev ) [2] => Array ( [menu_id] => 3 [menu_name] => WordPress Development [parent_id] => 2 [link] => #wp-dev ) [3] => Array ( [menu_id] => 4 [menu_name] => About w3school.info [parent_id] => 2 [link] => #w3school-info ) [4] => Array ( [menu_id] => 7 [menu_name] => Javascript [parent_id] => 2 [link] => # ) [5] => Array ( [menu_id] => 8 [menu_name] => Plugins [parent_id] => 7 [link] => #plugin-dev ) )
seems like this doesn't have a pointed buildDynamicMenu export. check if there is one in 'this'. try to assign the buildDynamicMenu function to some const and perform call to it. Ok here is my demo func working very well in nodejs typescript: function recursieve (p) { console.log('in recursieve ', p); if (p > 0) { recursieve (--p); } } recursieve (10);// rec call So in my opinion there are two problems in your code: 1. 'this' was not pointed to the function. 2. recursieve condition, like the elements is empty, or id is no match.
add customerGroup to article with PUT call
Im trying to update my articles and add a excluded CustomerGroup. Since the documentation is pretty bad for that part I try to find some more help here. I put this [] Object to shopware for example [data] => Array ( [id] => 1460 [mainDetailId] => 1460 [supplierId] => 1 [taxId] => 1 [filterGroupId] => 1 [name] => XXX [added] => 2018-01-26T00:00:00+0100 [active] => 1 [pseudoSales] => 0 [changed] => 2018-02-09T15:22:35+0100 [lastStock] => 1 [mode] => 0 [mainDetail] => Array ( [id] => 1460 [articleId] => 1460 [...] => ... ) [customerGroups] => Array ( [0] => Array ( [customerGroupKey] => EK ) ) ) The important part is the [customerGroups] array which i add and which doesnt work for me.
You should create a customer group before you use the "groupKey", use "CustomerGroup" api resource for this (see /engine/Shopware/Components/Api/Resource/CustomerGroup.php).
Temperature and Humidity from Nest Protect
The Nest Protect (smoke and CO alarm) can measure temperature and humidity but neither the official or unofficial API's appear to allow access to this data. Is anyone working on a work around? Any line of sight to accessing this data? Suggestions? Thanks!
$infos = (object) array( 'current_state' => (object) array( 'mode' => $mode, 'temperature' => $this->temperatureInUserScale((float) $this->last_status->shared->{$serial_number}->current_temperature), 'humidity' => $this->last_status->device->{$serial_number}->current_humidity, 'ac' => $this->last_status->shared->{$serial_number}->hvac_ac_state, 'heat' => $this->last_status->shared->{$serial_number}->hvac_heater_state, 'alt_heat' => $this->last_status->shared->{$serial_number}->hvac_alt_heat_state, 'fan' => $this->last_status->shared->{$serial_number}->hvac_fan_state, 'auto_away' => $this->last_status->shared->{$serial_number}->auto_away, // -1 when disabled, 0 when enabled (thermostat can set auto-away), >0 when enabled and active (thermostat is currently in auto-away mode) 'manual_away' => $manual_away, 'leaf' => $this->last_status->device->{$serial_number}->leaf, 'battery_level' => $this->last_status->device->{$serial_number}->battery_level ), 'target' => (object) array( 'mode' => $target_mode, 'temperature' => $target_temperatures, 'time_to_target' => $this->last_status->device->{$serial_number}->time_to_target, Add this: 'humidity' => $this->last_status->device->{$serial_number}->target_humidity, //added by Rick Ammazzini 'humidity_enabled' => $this->last_status->device->{$serial_number}->target_humidity_enabled //added by Rick Ammazzini ), 'serial_number' => $this->last_status->device->{$serial_number}->serial_number, 'scale' => $this->last_status->device->{$serial_number}->temperature_scale, 'location' => $structure, 'line_power_present' => $this->last_status->device->{$serial_number}->line_power_present, 'network' => $this->getDeviceNetworkInfo($serial_number), 'name' => !empty($this->last_status->shared->{$serial_number}->name) ? $this->last_status->shared->{$serial_number}->name : DEVICE_WITH_NO_NAME, 'where' => isset($this->last_status->device->{$serial_number}->where_id) ? isset($this->where_map[$this->last_status->device->{$serial_number}->where_id]) ? $this->where_map[$this->last_status->device->{$serial_number}->where_id] : $this->last_status->device->{$serial_number}->where_id : "" ); if($this->last_status->device->{$serial_number}->has_humidifier) { $infos->current_state->humidifier= $this->last_status->device->{$serial_number}->humidifier_state; $infos->target->humidity = $this->last_status->device->{$serial_number}->target_humidity; $infos->target->humidity_enabled = $this->last_status->device->{$serial_number}->target_humidity_enabled; } return $infos; }