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

# Dify tutorial

> Orchestrate real-time events, your Dify support AI agent, and visual guidance tours to deliver personalised customer support.

This tutorial shows you how to connect your existing tools — a session replay provider, a Dify support AI agent, and visual guidance tours — into a single personalised customer support experience. Autoplay SDK is the connective tissue that captures what each user is doing in real time and routes that context to the right tool at exactly the right moment.

***

## What you'll orchestrate

<Frame>
  <img src="https://mintcdn.com/autoplayai/Flv-0k0h6KNys8YE/images/recipes/dify/autoplay_sdk_connective_tissue.svg?fit=max&auto=format&n=Flv-0k0h6KNys8YE&q=85&s=0a34d8fc20bbdabde36cb733e2e24350" alt="Autoplay SDK as the connective tissue between session replay, Dify support AI agent, and visual guidance tours" width="680" height="320" data-path="images/recipes/dify/autoplay_sdk_connective_tissue.svg" />
</Frame>

You already have the pieces:

* **Session replay provider** — captures what the user is doing in real time (PostHog or equivalent)
* **Visual guidance tours** — step-by-step flows triggered at the right moment (UserTour or equivalent)
* **Dify support AI agent** — the conversational interface that answers questions

**Autoplay SDK** brings them together. It routes live session context into your support AI agent so every answer is specific to where that user is — and fires visual tours automatically when they need a guided walkthrough, personalised to their journey.

***

## ✨ Final result

<CardGroup cols={2}>
  <Card>
    <Frame>
      <img src="https://mintcdn.com/autoplayai/Flv-0k0h6KNys8YE/images/recipes/dify/step1-final-result.png?fit=max&auto=format&n=Flv-0k0h6KNys8YE&q=85&s=34a5f069368a8f0e5b95ea1bb1282ebb" alt="The Dify support AI agent replies with context from the user's live session, surfacing a Show me how button" width="1024" height="599" data-path="images/recipes/dify/step1-final-result.png" />
    </Frame>

    The support AI agent replies with context pulled from the user's live session — surfacing the right guidance without being asked.
  </Card>

  <Card>
    <Frame>
      <img src="https://mintcdn.com/autoplayai/Flv-0k0h6KNys8YE/images/recipes/dify/tour-final-result-1.png?fit=max&auto=format&n=Flv-0k0h6KNys8YE&q=85&s=cbf5734d72c4f0947046c447bdee76b1" alt="A visual guidance tour fires automatically, walking the user through the steps they need" width="1024" height="599" data-path="images/recipes/dify/tour-final-result-1.png" />
    </Frame>

    The visual guidance tour fires automatically, walking the user through the exact steps they need.
  </Card>
</CardGroup>

***

## 📋 Prerequisites

Complete the [Quickstart](/quickstart). You should have:

* **Your activity source set up** — PostHog (or Amplitude) capturing events, with `identify` setting a stable `user_id`
* **A registered product** — your `product_id`, `mcp_url`, and `mcp_key` from the Quickstart
* **A Dify account** — cloud at [cloud.dify.ai](https://cloud.dify.ai) or self-hosted, with an existing chatbot application

***

## The building blocks

Follow the steps in order — each page stands alone so you can ship incrementally.

1. **[Connect real-time events](./step-1-connect-real-time-events)** — Add the Autoplay MCP server to your Dify Agent so it pulls live user activity on demand.
2. **[Define proactive triggers](./step-2-define-proactive-triggers)** — Proactively message users in Dify based on what they're doing in your product. *(Coming soon)*
