chore: Contact builder ignores custom attributes (#3571)
This is incorrect as per the documentation here: https://www.chatwoot.com/developers/api/#operation/create-a-contact This allows setting the proper attributes when creating a contact
This commit is contained in:
parent
8d65608666
commit
6069cd9eba
2 changed files with 5 additions and 2 deletions
|
@ -33,7 +33,8 @@ class ContactBuilder
|
||||||
phone_number: contact_attributes[:phone_number],
|
phone_number: contact_attributes[:phone_number],
|
||||||
email: contact_attributes[:email],
|
email: contact_attributes[:email],
|
||||||
identifier: contact_attributes[:identifier],
|
identifier: contact_attributes[:identifier],
|
||||||
additional_attributes: contact_attributes[:additional_attributes]
|
additional_attributes: contact_attributes[:additional_attributes],
|
||||||
|
custom_attributes: contact_attributes[:custom_attributes]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,14 @@ describe ::ContactBuilder do
|
||||||
contact_attributes: {
|
contact_attributes: {
|
||||||
name: 'Contact',
|
name: 'Contact',
|
||||||
phone_number: '+1234567890',
|
phone_number: '+1234567890',
|
||||||
email: 'testemail@example.com'
|
email: 'testemail@example.com',
|
||||||
|
custom_attributes: { test: 'test' }
|
||||||
}
|
}
|
||||||
).perform
|
).perform
|
||||||
|
|
||||||
expect(contact_inbox.contact.id).not_to eq(contact.id)
|
expect(contact_inbox.contact.id).not_to eq(contact.id)
|
||||||
expect(contact_inbox.contact.name).to eq('Contact')
|
expect(contact_inbox.contact.name).to eq('Contact')
|
||||||
|
expect(contact_inbox.contact.custom_attributes).to eq({ 'test' => 'test' })
|
||||||
expect(contact_inbox.inbox_id).to eq(inbox.id)
|
expect(contact_inbox.inbox_id).to eq(inbox.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue