PHASE 2 instagram_manage_messages GOAL - DM Management

Instagram DM Management

MOA C&C Korean Medical Tourism Platform - Two-way Instagram Direct Message Integration

đŸ’Ŧ How We Use instagram_manage_messages Permission

đŸ“Ĩ Receive DMs via Webhook

When international patients send DMs to our hospital's Instagram account, we receive them in real-time through Meta's Webhook system. This enables immediate response to medical inquiries.

📤 Send Reply Messages

Using POST /{ig-user-id}/messages API, we send personalized responses to patient inquiries about procedures, pricing, and appointments.

🤖 AI-Powered Responses

Messages are analyzed by Gemini AI to understand intent (consultation request, pricing inquiry, appointment booking) and generate appropriate responses in the patient's language.

💾 Conversation History

All conversations are stored in AlloyDB PostgreSQL for quality assurance, follow-up management, and providing context when patients return with additional questions.

Technical Integration Flow

STEP 1
Patient sends DM
→
STEP 2
Webhook receives
→
STEP 3
AI analyzes intent
→
STEP 4
Send response
1 Webhook Endpoint

Instagram sends message events to /webhook/instagram endpoint hosted on Cloud Run

2 Message Processing

Extract sender IGSID, message text, and timestamp. Store in AlloyDB with UUID tracking

3 AI Analysis

Gemini AI classifies intent and generates multilingual response based on hospital services

4 Reply via Graph API

Call POST /{ig-user-id}/messages with recipient IGSID and response text

đŸĨ Benefits for Medical Tourism Platform

🌏

24/7 Global Availability

Respond to inquiries from any timezone instantly, crucial for international patients

đŸ—Ŗī¸

Multilingual Support

AI detects language and responds in English, Japanese, Chinese, or Korean

📊

Lead Management

Track conversation history and identify high-intent prospects for follow-up

⚡

Instant Response

Average response time under 30 seconds vs hours for manual handling

đŸŽŦ Live Demo - Two-way DM Messaging

1

Facebook Login

Authenticate with Facebook and connect Instagram Business Account

2

View Received DMs

See messages received via Webhook in real-time

3

Send Reply

Reply to messages using Graph API

🔐

Step 1: Facebook Authentication

đŸ“Ĩ

Step 2: Received Messages (Webhook)

0
📭

No messages received yet.
Send a DM to @alllitingpsjpn to test.

📤

Step 3: Send Reply Message

Uses POST /{ig-user-id}/messages Graph API endpoint

đŸ’Ŧ

Conversation History

Two-way messaging demonstration
đŸ’Ŧ

Conversations will appear here after receiving and sending messages.

đŸŽŦ

Step 4: Send New Test Message (For Screencast)

META REVIEW

📋 For Meta App Review Screencast:

  1. Enter Recipient IGSID - Use the IGSID of the Instagram user you want to message
  2. Type a test message - e.g., "Hello! This is a test message from MOA Medical Tourism Platform."
  3. Click "Send New Message" - Message will be sent via Graph API
  4. Check recipient's Instagram inbox - Verify the message was received and displayed

💡 Tip: You can get IGSID from the "Received Messages" section above, or use the test IGSID: 7234567890123456

✅ Expected Result for Screencast:

  • API returns success with message_id
  • Recipient's Instagram app shows the message in DM inbox
  • This demonstrates instagram_manage_messages permission usage

📋 Instructions for Meta Reviewers

1

Login with Test Account

Click "Login with Facebook" and use the test account credentials provided in the App Review submission.

2

Send Test DM from Another Account

From a different Instagram account, send a DM to @alllitingpsjpn (our test business account).

3

Verify Webhook Reception

Click "Refresh" button to see the received message appear in "Step 2: Received Messages" section with sender IGSID.

4

Send Reply Message

Click "Reply" button on the received message, type a response, and click "Send Direct Message".

5

Verify Two-way Communication

Check that the reply was received on the sender's Instagram account, demonstrating complete two-way messaging.

📡

API Response Log

Waiting for API calls...

This panel shows real-time API responses:
- Webhook messages from /api/dm/messages
- Send message via POST /api/dm/send
- Graph API: POST /{ig-user-id}/messages

Technical Information