chore: Create client API conversations with custom attributes (#8040)
- Update client API create conversations endpoint to accept custom attributes as well.
This commit is contained in:
@@ -44,6 +44,17 @@ RSpec.describe 'Public Inbox Contact Conversations API', type: :request do
|
||||
data = response.parsed_body
|
||||
expect(data['id']).not_to be_nil
|
||||
end
|
||||
|
||||
it 'creates a conversation with custom attributes but prevents other attributes' do
|
||||
post "/public/api/v1/inboxes/#{api_channel.identifier}/contacts/#{contact_inbox.source_id}/conversations",
|
||||
params: { custom_attributes: { 'test' => 'test' }, additional_attributes: { 'test' => 'test' } }
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
data = response.parsed_body
|
||||
conversation = api_channel.inbox.conversations.find_by(display_id: data['id'])
|
||||
expect(conversation.custom_attributes).to eq('test' => 'test')
|
||||
expect(conversation.additional_attributes).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /public/api/v1/inboxes/{identifier}/contact/{source_id}/conversations/{conversation_id}/toggle_typing' do
|
||||
|
||||
Reference in New Issue
Block a user