Skip to main content

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:

  • email
  • 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

ParameterTypeExampleRequiredDescription
account_idint1YesAccount ID
dataJSON object

{    "_fname": "John",    "_lname": "Doe" }

YesProfile fields data
db_idint1YesDatabase ID
feedback_idstring"abcdefghijklmnqrstuvwxyz"NoRequest ID
skip_triggersbooltrueNoSkip trigger events.
By default – false
update_onlybooltrueNoOnly update.
By default – false
Profile matching mode
matchingstring"email"
"phone"
"profile_id"
"custom"
No, if matched by emailProfile matching mode
By default - email
emailstring"john@example.com""matching":"email"Email address
phonestring"+79000000000""matching":"phone"Phone number
profile_idstring"abcdefghijklmnqrstuvwxyz""matching":"profile_id"Profile ID
field_namestring"CRM_ID""matching":"custom"Custom profile data field name
field_valueint/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_idint24NoResource ID for email and phone matching

Message example

{
"account_id": 1,
"data": {
"_fname": "John",
"_lname": "Doe"
},
"db_id": 1,
"email": "john@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

ParameterTypeDescription
errorintError code
error_textstringError text
feedback_idstringRequest ID
matching_fieldstringProfile matching
profile_idstringProfile ID