LINE and HubSpot Integration

Shinobu Kawano
Mar 4, 2018 · 4 min read

LINE is a messaging app which especially popular in Japan. Similar to Facebook messenger or WhatsApp, LINE users can exchange text, images, video, and audio. Also, users can conduct free VoIP conversations and video conferences.

Though originally LINE was developed for personal communication, nowadays, some companies are starting to use it for providing their services. In December 2017 Line reached 217 million the average number of users a month. Therefore, we can say that LINE became an attractive communication platform for the BtoC service companies.

HubSpot does not offer a native integration with LINE. However, with minimum coding and settings, HubSpot users can integrate it. In this article, I will illustrate how HubSpot platform is able to work with LINE and how to realize it.

Distribute LINE messages from HubSpot

In scenarios of HubSpot marketing automation, users can define “webhook” action. When a webhook action is triggered, HubSpot send the contact’s entire record formatted in JSON to the specified URL (Content-Type is application/json). This mechanism enables you to send a message to the LINE accounts which your customers have. For example, creates the scenario uses contact’s birthday, then you can deliver birthday promotion code to contacts via LINE using HubSpot.

In the setting of webhook action, you need to enter the URL which points to the server program you prepared. I wrote some Python code and deployed it to Heroku.

In this code, the program retrieves the value of the specific property and uses it for calling LINE Message API.

@app.route("/push-message", methods = ['POST'])
def push_message():
properties = request.json.get('properties')
user_id = properties.get('line_user_id')
message = properties.get('line_text_message')
if (user_id and message):
# Text
line_bot_api.push_message(user_id.get('value'), TextSendMessage(
text = message.get('value')
# Sticker
line_bot_api.push_message(user_id.get('value'), StickerMessage(
return 'OK'

LINE provides SDK for each popular programming languages such as PHP, Java, Ruby, etc. So, you can use your favorite language. (In my case, it was Python.)

The details of LINE Messaging API would be out of scope in this article. Please refer to the following document for further information.

LINE Developers — Messaging API:

Send data to HubSpot from LINE

The data flow is not limited to one-way. You can send information from LINE to HubSpot. HubSpot offers various APIs for integration purpose and you can take advantage of it.

When users send a message to you in the conversation, webhook action occurs and LINE platform sends a request to the specific URL which points the program your prepared. In the following code, the program receives a request from LINE and sends user’s reply message to HubSpot.

@handler.add(MessageEvent, message=TextMessage)
def message_text(event):
url = '' + hubspot_api_key
obj = [
"email": "",
"properties": [
"property": "line_reply_message",
"value": event.message.text
], json=obj)line_bot_api.reply_message(
return 'OK'

This time, I created “line_reply_message” custom property and set a content of reply message into it. HubSpot allows you to add custom properties of contacts, companies and deals up to 1,000 items. This is where your creativity shines. Based on your specific requirements, you can design custom properties to meet it.

Relate LINE account to HubSpot contact

You may wonder how to relate LINE account to HubSpot contact. Actually, this is the difficult part of this integration. One solution for that is to use “LINE Login” feature. The accounts who logged into your system via this feature, you can obtain LINE account’s “email address”, and “user id” which required to send a message.

When users follow your account in LINE, you can send an auto-reply message to them. It would be the best timing to encourage your “LINE Login” to the account and get a permission to receive information. After getting an email address of LINE user, you can sync “email address” and “user id” to HubSpot’s contact record using HubSpot Contacts API.

Please refer to the following document for further information of LINE Login.

LINE Developers — LINE Login:


Though some technical skill is required, you can integrate LINE platform with HubSpot platform. This combination is very powerful! I hope this article helps you.

Shinobu Kawano

about Web Technology and Business.