Using the kobo-to-bitrix24 endpoint, it is possible to save a Kobo submission as one or more entities in Bitrix24.
- Define which questions in the Kobo form need to be saved in which entity and field in Bitrix24.
- In Bitrix24, create a new Webhook:
- From the left menu, select
Developer resources>Other>Inbound webhook. - Under
Request builder>Method, selectcrm.contact.add(replacecontactwith any other entity you want to save the Kobo submission to). - Copy the URL generated below.
- Click
SAVE
- From the left menu, select
- Register a new Kobo REST Service for the Kobo form of interest and give it a descriptive name.
- In the Kobo REST service, insert as
Endpoint URL
https://kobo-connect.azurewebsites.net/kobo-to-bitrix24
-
Add the following headers under
Custom HTTP Headers:- Under header
Name(left), inserttargeturland underValue(right) the Bitrix24 URL (for example, https://b24-xixckd.bitrix24.com/). - Under header
Name(left) inserttargetkeyand underValue(right) the API key in the webhook URL (the one you copied in step 2). The API key is the part afterhttps://b24-xixckd.bitrix24.com/rest/1/and before/crm.contact.add.json. Example:1a2b3c4d5e6f7g8h9i0j.
- Under header
-
For each question, add a header that specifies which Kobo questions corresponds to which entity and field Bitrix24:
- The header
Name(left) must correspond to the Kobo question name. You can check the Kobo question name by going into edit mode of the form, openSettingsof the specific question and inspect theData Column Name. Also, the Kobo question names can be found in theDatatable with previous submissions. This Kobo question name is different from the Kobo question label and can not contain spaces or symbols (except the underscore). - The header
Value(right) must correspond to the Bitrix24 method (e.g.crm.contact.add) followed by.json, followed by the specific field name. Example:crm.contact.add.json:FIELDS[NAME]. If you don't know the field names if your entity, use a new webhook with methodcrm.contact.fields.
- The header
-
To send attachments add two headers to kobo rest services - kobotoken (to facilitate downloading of files from kobo) and for your file field "attachment-FieldName"
- Update functionality: To update an existing Bitrix24 record instead of creating a new one, add an id field to the Kobo form containing the Bitrix24 record ID, in Bitrix this field is always called 'id'. Add a field in Kobo to specify 'update' or 'add'. This should ideally be a calculate field, but either can work, as long as the values are exactly 'add' or 'update'. Map both these in the rest service, with the calculate field being mapped to operation.