LINE Setup 30 min
Outcome
A working LINE-to-Agentforce pipeline where customers in Japan and other LINE-dominant markets can message your business and receive automated responses from your Service Agent.
When complete, you'll have:
- A LINE Messaging Channel connected to your Salesforce org via the LINE Messaging API
- Omni-Channel routing configured to send inbound messages to your Agentforce agent
- A webhook verified between LINE and Salesforce for real-time message delivery
- Verified end-to-end message flow from LINE to agent and back
LINE channels require the Digital Engagement add-on license and a LINE Official Account with the Messaging API enabled. Unlike Enhanced Chat, no Experience Cloud site or EmbeddedServiceConfig is needed. LINE is the dominant messaging platform in Japan, Taiwan, and Thailand.
Architecture
When a customer sends a LINE message to your Official Account, the message flows through the following chain:
Click a node to jump to its configuration step.
The key routing field is sessionHandlerType = AgentforceServiceAgent on the MessagingChannel, with sessionHandlerAsa pointing to the BotDefinition DeveloperName. The sessionHandlerQueue field specifies the fallback queue when the agent is unavailable.
Key metadata relationships:
MessagingChannel.MessageType=LineServiceChannel.DeveloperName=sfdc_livemessageQueue.SobjectType=MessagingSession- No 24-hour messaging window restriction (unlike WhatsApp and Messenger)
Unlike WhatsApp and Messenger, LINE does not require a Meta Business Manager account. The integration uses credentials from the LINE Developers Console (Channel ID, Channel Secret, Channel Access Token) and a webhook URL that Salesforce generates after channel creation.
Configure Your Variables
Update these variables with your values and they will be substituted in the code blocks below.
Implementation Steps
1. Verify Your Starting Point
Confirm your agent exists, your org has the required licenses, and you have admin access.
Confirm your Service Agent exists and is active
Before building the routing chain, verify your Agentforce Service Agent is deployed and active in the target org.
sf data query \
--target-org <your-org-alias> \
--query "SELECT Id, DeveloperName, MasterLabel, AgentType FROM BotDefinition WHERE DeveloperName='Reservation_Agent' AND IsActive=true"
Verify the agent is active:
Expected result: One record returned with a valid Id.
If no record is returned, activate your agent in Agent Builder before proceeding.
Authenticate and verify org access
Ensure you have admin access to the target org and the CLI is connected.
sf org login web --alias <your-org-alias> --instance-url https://login.salesforce.com
sf org display --target-org <your-org-alias> --verbose
Verify org access:
Expected result: Org display shows your username and instance URL without errors.
Verify Digital Engagement license
LINE channels require the Digital Engagement add-on. Confirm it is provisioned in your org.
sf data query \
--target-org <your-org-alias> \
--query "SELECT Id, Name, Status, IsProvisioned FROM PackageLicense WHERE NamespacePrefix='sfdc_livemessage'"
Verify Digital Engagement license:
Expected result: One record returned with IsProvisioned = true.
If not found, contact your Salesforce account executive to provision Digital Engagement.
2. Enable Messaging and Omni-Channel
Enable the org-level settings required for LINE messaging.
Enable Messaging in Setup
Messaging must be enabled at the org level before any messaging channels can be created.
# Deploy Messaging settings via metadata
mkdir -p force-app/main/default/settings
cat > force-app/main/default/settings/OmniChannel.settings-meta.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<OmniChannelSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<enableOmniChannel>true</enableOmniChannel>
</OmniChannelSettings>
EOF
sf project deploy start \
--target-org <your-org-alias> \
--source-dir force-app/main/default/settings/OmniChannel.settings-meta.xml
Verify messaging is enabled:
Expected result: Messaging Settings page loads without errors and shows channel management options. Omni-Channel Settings shows "Omni-Channel is enabled."
3. Set Up LINE Official Account and Messaging API
Create a LINE Official Account and enable the Messaging API to obtain the credentials needed for the Salesforce integration.
LINE Official Accounts are free to create. The free tier includes a limited number of messages per month. For higher volume, upgrade to the Light or Standard plan in the LINE Official Account Manager.
Create a LINE Official Account
If you do not already have a LINE Official Account, create one before proceeding.
# LINE Official Account setup is done in the LINE platform.
# No CLI equivalent. See Browser method for complete steps.
Verify LINE account access:
Expected result: You can log into the LINE Official Account Manager and see your account listed.
Enable the Messaging API and create a provider
The Messaging API must be enabled on your LINE Official Account to integrate with Salesforce. This creates a channel in the LINE Developers Console.
# Messaging API enablement is done in the LINE platform.
# No CLI equivalent. See Browser method for complete steps.
Keep your Channel Secret and Channel Access Token secure. These credentials grant full access to send messages as your LINE Official Account. Do not commit them to version control or share them in public channels.
Verify LINE credentials:
Expected result: You have all four LINE credentials: Channel Name, Channel ID, Channel Secret, and Channel Access Token.
Disable auto-reply and greeting messages
LINE Official Accounts have auto-reply and greeting messages enabled by default. These conflict with Agentforce agent responses and should be disabled.
# Auto-reply settings are configured in the LINE platform.
# No CLI equivalent. See Browser method.
If you leave auto-reply enabled, customers will receive both the LINE auto-response and the Agentforce agent response, creating a confusing experience.
Verify auto-response disabled:
Expected result: Auto-response and greeting message are both disabled in LINE Official Account Manager > Settings > Response Settings.
4. Create the LINE Messaging Channel
Use the Salesforce Setup wizard to create the LINE channel by entering the credentials from Step 3.
Create the channel in Salesforce
Unlike WhatsApp and Messenger, the LINE channel does not require an OAuth flow. You enter the LINE credentials directly in the Setup wizard.
# The LINE channel must be created via the Setup wizard.
# After creation, verify with:
sf data query \
--target-org <your-org-alias> \
--query "SELECT Id, DeveloperName, MasterLabel, MessageType, IsActive FROM MessagingChannel WHERE MessageType='Line'"
Verify channel was created:
Expected result: Query returns one record with MessageType = 'Line'.
Note the Webhook URL from the channel details page -- you will need it in the next step.
Register the webhook URL in LINE Developers Console
Salesforce generates a webhook URL after channel creation. This URL must be registered in LINE so that inbound messages are forwarded to your Salesforce org.
# Webhook registration is done in the LINE Developers Console.
# No CLI equivalent. See Browser method.
If the webhook verification fails, check that your Salesforce org is accessible from the public internet (not behind a VPN or firewall that blocks LINE's servers). Sandbox orgs with My Domain restrictions may need additional configuration.
Verify webhook configuration:
Expected result: LINE Developers Console shows "Use webhook" toggle enabled and the Verify button returns "Success."
Complete channel activation in Salesforce
After the webhook is verified in LINE, return to Salesforce to complete the channel activation.
# Verify channel is active
sf data query \
--target-org <your-org-alias> \
--query "SELECT Id, DeveloperName, MasterLabel, MessageType, IsActive, SessionHandlerId, FallbackQueueId FROM MessagingChannel WHERE DeveloperName='AgentforceChannel'"
Verify channel is active:
Expected result: Channel record returned with MessageType = 'Line' and IsActive = true.
5. Configure Routing to Your Agent
Set up the routing so inbound LINE messages are handled by your Agentforce Service Agent.
Create a messaging queue for fallback routing
The queue handles messages when the agent is unavailable. Even with direct agent routing, a fallback queue is required.
# Check if queue exists
sf data query --target-org <your-org-alias> \
--query "SELECT Id FROM Group WHERE Type='Queue' AND DeveloperName='AgentforceChannel_Queue'"
# If not found, create via Metadata API
mkdir -p force-app/main/default/queues
cat > force-app/main/default/queues/AgentforceChannel_Queue.queue-meta.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<Queue xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>AgentforceChannel_Queue</fullName>
<name>AgentforceChannel Queue</name>
<queueSobject>
<sobjectType>MessagingSession</sobjectType>
</queueSobject>
</Queue>
EOF
sf project deploy start --target-org <your-org-alias> --metadata Queue:AgentforceChannel_Queue
Verify queue creation:
Expected result: One queue record returned with DeveloperName = '{{CHANNEL_NAME}}_Queue'.
Route the channel to your Agentforce agent
Set the SessionHandlerId on the MessagingChannel to point to your agent's BotDefinition. This enables direct agent routing for all inbound LINE messages.
# Get the Bot ID and Queue ID
BOT_ID=$(sf data query --target-org <your-org-alias> --json \
--query "SELECT Id FROM BotDefinition WHERE DeveloperName='Reservation_Agent'" \
| jq -r '.result.records[0].Id')
QUEUE_ID=$(sf data query --target-org <your-org-alias> --json \
--query "SELECT Id FROM Group WHERE Type='Queue' AND DeveloperName='AgentforceChannel_Queue'" \
| jq -r '.result.records[0].Id')
CHANNEL_ID=$(sf data query --target-org <your-org-alias> --json \
--query "SELECT Id FROM MessagingChannel WHERE DeveloperName='AgentforceChannel'" \
| jq -r '.result.records[0].Id')
# Update the channel with agent routing
sf apex run --target-org <your-org-alias> << EOF
MessagingChannel channel = [SELECT Id FROM MessagingChannel WHERE DeveloperName = 'AgentforceChannel' LIMIT 1];
channel.SessionHandlerId = '$BOT_ID';
channel.FallbackQueueId = '$QUEUE_ID';
update channel;
System.debug('Updated MessagingChannel: ' + channel.Id + ' with SessionHandlerId: $BOT_ID');
EOF
Verify agent routing:
Expected result: Query the channel and confirm SessionHandlerId matches your BotDefinition.Id.
If SessionHandlerId is not available in your org's API version, configure routing through an Omni-Channel inbound flow instead. Create a flow with the Route Work action: Service Channel = sfdc_livemessage, Route To = your Agentforce Service Agent.
6. Test and Verify
Send a test message and confirm the full pipeline works end-to-end.
Send a test LINE message
Use your personal phone to send a message to the LINE Official Account and verify the agent responds.
# After sending a test message from your phone, query for the session:
sf data query --target-org <your-org-alias> \
--query "SELECT Id, Status, AgentType, OwnerId, CreatedDate, MessagingChannelId FROM MessagingSession WHERE MessagingChannel.DeveloperName='AgentforceChannel' ORDER BY CreatedDate DESC LIMIT 5"
Verify the agent responds:
Expected result: Agent responds to LINE message. MessagingSession record created with Status = 'Active' or 'Ended'.
Verify agent routing and session records
Confirm messages are being routed to your agent by checking MessagingSession and AgentWork records.
# Check recent MessagingSessions for LINE
sf data query --target-org <your-org-alias> \
--query "SELECT Id, Status, AgentType, OwnerId, CreatedDate FROM MessagingSession WHERE MessagingChannel.MessageType='Line' ORDER BY CreatedDate DESC LIMIT 5"
# Check AgentWork records
sf data query --target-org <your-org-alias> \
--query "SELECT Id, WorkItemId, BotId, RoutingType, CreatedDate FROM AgentWork ORDER BY CreatedDate DESC LIMIT 5"
# Check individual messages in the session
sf data query --target-org <your-org-alias> \
--query "SELECT Id, MessageText, SenderType, CreatedDate FROM MessagingEvent WHERE MessagingSession.MessagingChannel.DeveloperName='AgentforceChannel' ORDER BY CreatedDate DESC LIMIT 10"
Verify messaging session records:
Expected result: Recent MessagingSession exists with AgentType populated and messages visible in MessagingEvent records.
LINE-Specific Constraints
| Constraint | Value |
|---|---|
| Messaging window | No restriction (unlike WhatsApp/Messenger 24-hour window) |
| Supported inbound content | Text, images, emoji, stickers, links, videos |
| Supported outbound content | Text, images, questions with clickable options |
| Consent model | Explicit (user must add your account as a friend) |
| Primary markets | Japan, Taiwan, Thailand, Indonesia |
| Channel migration | Channels can be moved between SF orgs (sandbox to production) |
| Routing types | Omni-Flow (supports bots) or Omni-Queue |
Troubleshooting
Messages not reaching Salesforce
- Verify the "Use webhook" toggle is enabled in LINE Developers Console > Messaging API tab
- Confirm the Webhook URL in LINE matches the URL from your Salesforce channel record
- Click Verify in LINE Developers Console to test webhook connectivity
- Check that the MessagingChannel is Active in Setup > Messaging Settings
- Verify the
sfdc_livemessageService Channel exists (auto-created with Digital Engagement)
Webhook verification fails in LINE Developers Console
- Ensure your Salesforce org is accessible from the public internet
- Check that the Webhook URL was copied correctly (no trailing spaces or line breaks)
- Sandbox orgs behind My Domain restrictions may block LINE's webhook verification requests
- Wait 1-2 minutes after channel creation before attempting verification (webhook endpoint may take time to provision)
LINE channel creation fails in Salesforce
- Verify the Digital Engagement license is provisioned and active
- Confirm the Channel ID, Channel Secret, and Channel Access Token are correct
- Re-issue the Channel Access Token in LINE Developers Console if the current one has expired or been revoked
- Ensure the Messaging API is enabled on your LINE Official Account (not just the standard chat mode)
Agent not responding but session is created
- Check
SessionHandlerIdon the MessagingChannel matches the BotDefinition Id - Verify the agent's default_agent_user has proper permissions (Einstein Agent User profile, AgentforceServiceAgentUser permission set)
- Confirm the BotDefinition is published and has an active BotVersion
- Review agent debug logs in Setup > Agentforce > Agents > [Your Agent] > Logs
Customers receiving duplicate responses
- Disable auto-reply messages in LINE Official Account Manager > Settings > Response Settings
- Disable greeting messages in the same settings page
- If using a third-party LINE integration alongside Salesforce, only one system should respond to webhooks
Supported message types
LINE supports: text messages, images, stickers, emoji, location sharing, and videos as inbound content. The Agentforce agent can receive all types but responds with text by default. Rich message responses (carousels, quick reply buttons, flex messages) require additional configuration via LINE's message template format.
Definition of Done
Definition of Done:
- LINE channel active in Messaging Settings with MessageType = Line
- Webhook URL registered and verified in LINE Developers Console
- "Use webhook" toggle enabled in LINE Developers Console
- Auto-reply and greeting messages disabled in LINE Official Account Manager
- Customer can send a LINE message and reach the Agentforce agent
- Agent responds to the message automatically
- MessagingSession record created with correct routing to agent
- Escalation to human agent queue works when agent transfers