Custom fields
You are able to send attributes (custom_fields) to pre-fill the ticket or contact with information you already know about the user. For example, the email address and name from a user who is logged in into your dashboard.
Note: this feature only works for web chat channels on the widget.
Sending contact data
See the example below to send custom contact attributes. Note: the field_id
must be an existing custom_field
with the type contact
.
window.Trengo = window.Trengo || {};
window.Trengo.contact_data = {
email: '[email protected]',
name: 'John Doe',
custom_fields: [{
field_id: 82736,
value: 'Contact value A'
}, {
field_id: 18273,
value: 'Contact value B'
}]
};
Sending ticket data
See the snippet below for to send custom ticket attributes. Note: the field_id
must be an existing custom_field
with the type ticket
.
window.Trengo = window.Trengo || {};
window.Trengo.ticket_data = {
custom_fields: [{
field_id: 182736,
value: 'Ticket value A'
}, {
field_id: 718273,
value: 'Ticket value B'
}]
};
Note: these attributes are only saved when the ticket is created.
Automatically enter browser language in custom ticket field
window.Trengo.ticket_data = {
custom_fields: [{
field_id: 98765, // Replace by custom ticket field id
value: window.navigator.userLanguage || window.navigator.language
}]
};
Tip! You could also create a rule with a condition on this custom ticket field to perform more actions like assigning to the correct team or sent a specific message
Updated almost 3 years ago