Import profile to RabbitMQ
Description
Imports or updates customer profiles via RabbitMQ message broker queue. Useful for extensive data transfers.
You will need a queue named "database_import
". Therefore it must be available in the same message broker instance as the rest of the system.
Import results are processed in another queue – "database_import_result
". The default queue time-to-live is 24 hours. Although you can reconfigure TTL in main.json
configuration file:
RABBITMQ_X_MESSAGE_TTL : "%seconds%"
Use one of these parameters to identify and match profiles:
- field_name, field_value
- phone
- profile_id
To identify your requests you can use an extra field – "feedback_id
". It will appear in server response and in case mistakes occur – they will be logged in "job_server.log
".
Message parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
account_id | int | 1 | Yes | Account ID |
data | JSON object |
| Yes | Profile fields data |
db_id | int | 1 | Yes | Database ID |
feedback_id | string | "abcdefghijklmnqrstuvwxyz" | No | Request ID |
skip_triggers | bool | true | No | Skip trigger events. By default – false |
update_only | bool | true | No | Only update. By default – false |
Profile matching mode | ||||
matching | string | "email" "phone" "profile_id" "custom" | No, if matched by email | Profile matching mode By default - email |
string | "john@example.com" | "matching":"email" | Email address | |
phone | string | "+79000000000" | "matching":"phone" | Phone number |
profile_id | string | "abcdefghijklmnqrstuvwxyz" | "matching":"profile_id" | Profile ID |
field_name | string | "CRM_ID" | "matching":"custom" | Custom profile data field name |
field_value | int/string | "123420" | "matching":"custom" | Custom profile data field value. tip Searching by combination of tags is available for tag type profile fields. Values are recorded as a string: "tag-1, tag-2". |
resource_id | int | 24 | No | Resource ID for email and phone matching |
Message example
{
"account_id": 1,
"data": {
"_fname": "John",
"_lname": "Doe"
},
"db_id": 1,
"email": "example@example.com",
"feedback_id": "abcdefghijklmnqrstuvwxyz",
"update_only": true
}
Response example
{
"error": 0,
"error_text": "",
"feedback_id": "abcdefghijklmnqrstuvwxyz",
"matching_field": "email",
"profile_id": "abcdefghijklmnqrstuvwxyz"
}
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
feedback_id | string | Request ID |
matching_field | string | Profile matching |
profile_id | string | Profile ID |