> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notealy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use case: tag a contact, trigger a multi-channel automation

> Push a contact via the API, attach a tag, and let an automation reach them on email, WhatsApp, Instagram, Facebook or WhatsApp Cloud API.

The Notealy automation engine listens to several events and can act across every channel the workspace is connected to. By combining a single API call with a `Tag added` automation you can drive end-to-end onboarding, nurture and re-engagement flows from your own backend.

## Pieces that compose

| Piece                                                                         | Where it lives                                  |
| ----------------------------------------------------------------------------- | ----------------------------------------------- |
| `POST /v1/people` (with `tagIds`)                                             | Public API — adds the contact and attaches tags |
| Automation: `Tag added` → `Send message`                                      | Notealy dashboard                               |
| Channels: Email, Instagram DM, Facebook DM, WhatsApp (QR), WhatsApp Cloud API | Connected per-organization in the dashboard     |

When a tag is **newly attached** to a contact, Notealy emits a `contact.tag_added` event. Any active automation with a matching trigger fires, and its `Send message` action dispatches through the channel you picked.

## End-to-end recipe

1. **Pick channels and create templates**
   * For email: create an Email Template (controls from address, domain, subject and body).
   * For WhatsApp Cloud API: register a Meta Cloud Template and select it on the action.
   * For QR-based WhatsApp: create a Message Template; the action will use it as the body.
   * For Instagram/Facebook DM: provide the body inline on the action.
2. **Build the automation** — `Tag added` filtered to a specific tag id, with `Send message` configured for the channel you want.
3. **Push contacts via the API** with the same tag id in `tagIds`.

## Example

```bash theme={null}
# Create the contact and tag them in one shot
curl -X POST https://thanos.notealy.com/v1/people \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Grace Hopper",
    "phone": "+15555550199",
    "channel": "WHATSAPP",
    "tagIds": ["<onboarding-tag-id>"]
  }'
```

If the contact is new, Notealy emits both `contact.created` and `contact.tag_added`. Any automation whose trigger matches will run; the email/WA/Meta Cloud/IG/FB message goes out asynchronously.

## Idempotency guarantees

* Re-posting the same payload finds the existing contact (matched by phone or email) and **does not** re-emit `contact.tag_added` for tags already attached. The automation does not re-trigger.
* New tags added in subsequent calls do emit fresh events — so you can layer tags over time and each one drives its own automation.

## Where to verify

* The contact appears in the dashboard with the new tag and `Source: API`.
* The automation execution shows up under **Automations → Runs**.
* Outbound messages appear in the contact's timeline.
