Skip to content

[Bug] [Chatwoot] Unable to set multiple conversation attributes #98

Description

@ItsaMeTuni

Thank you very much for ahize! Integrating my React SPA with Chatwoot was being a nightmare until I found this package.

The issue

I found what seems to be limitation of ahize's API:

setAttribute only allows setting one attribute per call and each call makes a set_custom_attributes POST request to Chatwoot, which seems to set the entire "attributes object" of the conversation on Chatwoot, instead of merging new attributes into the ones it already has (which makes sense since it's a POST not a PATCH).

await chatwoot.setAttribute({
  scope: 'conversation',
  key: 'tenant_id',
  value: tenant.id,
});
await chatwoot.setAttribute({
  scope: 'conversation',
  key: 'tenant_name',
  value: tenant.name,
});
// After this, only `tenant_name` will be set

Solution

I believe a good solution would be to deprecate setAttribute in favor of a setAttributes method that accepts an object instead of a single key-value pair.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions