Guide

How to name your users so memory stays one memory

When the same person shows up under two ids, Harny keeps two separate memories. This guide shows you how to pick one id per person and send it on every request.

Jump to the steps

The problem

The user id is yours. Harny files memory under the id you send in X-Harny-User.

Nadia writes to your app by email, chats with it, and sits in your CRM. If each channel sends its own id, Harny sees three people. Each one has a thin memory, and none of them has the full picture.

How it works in Harny

Each person has a private memory, and the id you send picks which one. Same id, same memory. Different id, different memory.

With an app key (it starts fsa_), you send Authorization: Bearer $HARNY_APP_KEY and X-Harny-User: <your id for the person>. A user key (fsk_) names its own user, so it needs no X-Harny-User. Call from a server, never a browser.

Traits are string attributes on a user. The key is a string up to 200 characters and the value up to 2,000. Audience rules read traits, so keep who the person is (traits) apart from which memory is theirs (the id).

Step by step

  1. List every place a person appears: email, chat, CRM. Pick one id they all map to, such as your own account id.
  2. Keep a lookup in your server that turns an email address, chat handle or CRM record into that one id.
  3. Send it with your app key on every write. Never use a session id or a request id: POST /v1/memory/ingest.
  4. Send the same id on every read: POST /v1/memory/recall.
  5. Use a user key where one person's own key fits. It names its user, so leave out the header.
  6. Store attributes for audience rules as traits, not inside the id.
  7. Check that both channels return the same memory by recalling for the one id: POST /v1/memory/recall.

What can go wrong

  • Two ids for one person. Facts split across two memories, and recall on one id misses what the other holds.
  • A new id per session. Every visit starts empty, and the person never builds a memory.
  • Putting traits in the id. When a trait changes, the id changes, and the memory splits.

Example: Nadia at Acme

The Acme pilot sends chat messages under one id and CRM notes under another. Nadia says in chat that her budget is 32k, then 40k. The CRM note about the Acme pilot sits under the other id.

Recall on the chat id returns the budget but not the pilot notes. After you map both to one id, a single recall returns both, and the newer budget of 40k is the current value.

Frequently asked questions

Do my users need a Harny account?

No. Your app calls the Memory API, and end users need no Harny account.

Can I use an email address as the id?

The id is yours: it is your id for the person. Use one that stays the same for that person across email, chat and CRM.

Do I send X-Harny-User with a user key?

No. A user key (fsk_) names its own user and needs no X-Harny-User. An app key (fsa_) needs it.

Go on. Get Harny.

The first 500 monthly-active end users are free for good. Create an app key and make your first call in minutes.