跳至主要内容

REFERENCE

開發者參考

認證、API、SDK、Flow Agent 處理節點與參數取值的完整參考。

Action Object - URI

URI Action 在聊天介面中開啟外部連結或執行系統動作。

  1. 基本用法​

    URI Action 讓使用者點擊按鈕時跳轉到外部網站、撥打電話、發送郵件或執行其他 URI 協議動作。支援多種 URI 格式和系統整合。

  2. Action 結構​

    JSON 格式​

    {
    "type": "URI",
    "uri": "https://www.example.com"
    }

    屬性說明​

    type(必填)​

    動作類型,固定為 "URI"。

    uri(必填)​

    要跳轉的 URI 位址。支援 https://、tel:、mailto: 等多種協議格式。

  3. 使用範例​

    要在 Push Message 中發送帶有 URI Action 的按鈕,請按照以下步驟操作:

    1. 在 Template 欄位的下拉選單中選擇 Expression。
    2. 在 Editor 編輯器中輸入以下 JavaScript 程式碼。

    聯絡方式選單​

    (() => {
    return {
    type: 'BUTTON',
    title: '聯絡方式',
    text: '請選擇聯絡方式:',
    buttons: [
    {
    label: '撥打電話',
    action: {
    type: 'URI',
    uri: 'tel:+886-2-1234-5678',
    },
    },
    {
    label: '官方網站',
    action: {
    type: 'URI',
    uri: 'https://www.company.com',
    },
    },
    {
    label: '發送郵件',
    action: {
    type: 'URI',
    uri: 'mailto:support@company.com',
    },
    },
    ],
    };
    })()

    外部資源連結​

    (() => {
    return {
    type: 'BUTTON',
    title: '更多資源',
    text: '查看相關資源和工具:',
    buttons: [
    {
    label: '產品說明書',
    action: {
    type: 'URI',
    uri: 'https://docs.company.com/manual.pdf',
    },
    },
    {
    label: '線上教學',
    action: {
    type: 'URI',
    uri: 'https://www.youtube.com/watch?v=example',
    },
    },
    ],
    };
    })()

準備好開始了嗎?

想知道 Asgard 怎麼用在你的團隊?跟我們聊聊。

聯絡我們