Threads and users

Identify, link, and load thread- and user-scoped data across integrations.

The thread and user scopes hold conversation and identity data. This guide covers the components that create, find, and link those scopes — the layer underneath thread_set / user_set.

A thread is a single conversational thread. A user is a person, who may have more than one thread. Both can be linked to the equivalent object in an integration (a Slack channel, a Zendesk requester, etc.), which is how Meya recognizes a returning visitor or a continued conversation.

Threads and users have identical component APIs — every operation below exists for both, with a thread_ or user_ prefix. Learn one, you've learned both.

Identify — the one you'll use most

identify finds the Meya thread/user linked to an integration thread/user. If no link exists yet, it creates a new one. It's the standard first step when a conversation arrives from an integration.

- type: meya.thread.component.identify
  thread_identify: (@ flow.integration_thread_id )
  integration: integration.slack
  default_data:
    status: new
  • data — merged into the scope unconditionally.
  • default_data — merged only for keys not already set (good for first-seen defaults).

The user form is identical:

- type: meya.user.component.identify
  user_identify: (@ flow.integration_user_id )
  integration: integration.slack

Link and unlink

link attaches the current thread/user to an integration thread/user — only one link per integration is allowed. unlink removes it.

- type: meya.thread.component.link
  thread_link: (@ flow.integration_thread_id )
  integration: integration.slack

- type: thread_unlink
  thread_id: (@ flow.thread_id )
  integration: (@ flow.integration_id )

Load

load pulls the data for a specific thread/user into scope:

- thread_load: (@ flow.thread_id )
- user_load: (@ flow.user_id )

Look up

try_lookup resolves an integration thread/user ID to the linked Meya ID, without creating anything. Use it when you need to check for an existing link but don't want the create-if-missing behavior of identify.

- type: meya.user.component.try_lookup
  user_try_lookup: (@ flow.integration_user_id )
  integration: integration.slack

Set data

set writes scope data. The shorthand form takes a dict directly:

- thread_set:
    voice: true
    last_topic: billing

- user_set:
    plan: pro
    onboarded: true

See How to Store Scope Data for reading these values back.

Reference