# Actions

You can set different types of actions to be taken when a user taps a control in a message. The following actions can be used.

The actions available depend on the message type. For more information, see Message objects in the Messaging API reference.

# Postback action

Use the postback action to return a specified string in a postback event to your server. You can include text which is sent as a message from the user.

You can also specify how to display such as rich menu based on user action. The following display methods can be specified:

  • Close rich menu
  • Open rich menu
  • Open keyboard
  • Open voice message input mode

Specifying how to display based on user action is available on LINE version 12.6.0 or later for iOS or Android.

For more information, see Postback action in the Messaging API reference.

# Message action

Use the message action to send a specified string as a text message from the user.

For more information, see Message action in the Messaging API reference.

# URI action

Using a URI action, open a specified URL in LINE's in-app browser. You can also use LINE URL scheme in combination to open a specified phone number in a call app, or open the screen for sharing any LINE Official Account.

URI action

To send the above URI action, specify the following JSON data in the request body when sending the message.

{
    "messages": [
        {
            "type": "text",
            "text": "Have you decided on your order?",
            "quickReply": {
                "items": [
                    {
                        "type": "action",
                        "action": {
                            "type": "uri",
                            "label": "Menu",
                            "uri": "https://example.com/menu"
                        }
                    },
                    {
                        "type": "action",
                        "action": {
                            "type": "uri",
                            "label": "Phone order",
                            "uri": "tel:09001234567"
                        }
                    },
                    {
                        "type": "action",
                        "action": {
                            "type": "uri",
                            "label": "Recommend to friend",
                            "uri": "https://line.me/R/nv/recommendOA/%40linedevelopers"
                        }
                    }
                ]
            }
        }
    ]
}

For more information, see URI action in the Messaging API reference.

# Datetime picker action

Use the datetime picker action to let the user choose a specific date, time, or date and time from a menu. The date and time selected by the user is returned in a postback event via a webhook.

Datetime picker action

For more information, see Datetime picker action in the Messaging API reference.

# Camera action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera screen in LINE is opened.

For more information, see Camera action in the Messaging API reference.

# Camera roll action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera roll screen in LINE is opened.

For more information, see Camera roll action in the Messaging API reference.

# Location action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the location screen in LINE is opened.

For more information, see Location action in the Messaging API reference.

# Rich menu switch action

This action can only be configured for rich menus. When you tap a rich menu associated with this action, you can switch between rich menus.

For more information, see Rich menu switch action in the Messaging API Reference.