Bot

How multi bot messages to users

RedishMoto

2022.03.24既読 1782

Hey,

I am trying to send multi bot messages to users but I can only single bot message.

Actually what I want, first time bot message will sent to user, and ask a question with Yes and No buttons. If user click to yes button then second bot message will sent to user. Same user will receive multiple bot message according input by user and user will receive bot message thread.

How can I achieve this flow. Please guide me.

Thanks

コメント3

  • 업데이트 된 답글입니다.

    LINE WORKS 公式アカウント

    You can judge by the contents of Callback Message Event.
    In particular, the postback value is a value that is not disclosed to users, so please make use of it.
    https://developers.worksmobile.com/jp/reference/bot-callback-message?lang=ja
    ​​
    Callback Message Eventの内容で判断することができます。
    特に、postback値はユーザーに公開されない値ですのでご活用ください。
    https://developers.worksmobile.com/jp/reference/bot-callback-message?lang=ja

    2022.03.25

    0
  • 업데이트 된 답글입니다.

    RedishMoto 投稿者

    Hey,

    Thanks for sharing the reply.

    Yes I followed this document and developed my functionality but not getting second bot message.

    I wrote below code in php

    $userData = [
                   'accountId' => 'bai@redish-0',
                   'content' => [
                       'type' => 'carousel',
                       'columns' => [[
                           'thumbnailImageUrl'=>'https://~~~',
                           'title'=>'Works Mobile',
                           'text'=>'Press the button to visit',
                           'actions'=>[[
                               'type'=>'uri',
                               'label'=>'Visit',
                               'uri'=>'https://www.naver.com'
                           ]]
                       ],
                       [
                           'thumbnailImageUrl'=>'https://~~~',
                           'title'=>'Daily Report',
                           'text'=>'Daily Report Test',
                           'actions'=>[[
                               'displayText'=>'Daily Repor',
                               'type'=>'postback',
                               'data'=>'https://cpdrdev-api.motocle8.com/list-template',
                               'label'=>'View more',
                               'postback'=>'ListTempalte_ViewMore'
                           ]]
                       ],
                   ]
                   ]
               ];


    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL,"https://apis.worksmobile.com/r/jp1zyBAVrZYcB/message/v1/bot/3436106/message/push";);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json; charset=UTF-8","Authorization: Bearer AAABC2bxGd4xRPD7lYSe3bgiRsfn+LFdljghR4X/2QHoMvhhB6w/+1HGHylIazTO2RT8YeHp8/ZcrD78dg+I1Lm94RoUVbSOS8KVNaojdqscZk1gh4PJErUw4lvNz3+FdbeCz4ztDDpkG6XPHhPSks9Pqe4pZ2EAmP7qFE2VOoq6m7FG6FdPuxs/WNd2iwVdgYlgtnqzr+sNBEoejElHjwK5WY3CfpqJafYHToUYGkd+Uj4XzySGKSwTTPSeXJdbiGp3PI7m+IULIBZZm27gLEebec/z6IvCJu2WW0ycaaba5sE18mG7TMLhnNS6oDEQzUChtMGMUrtQ0otgbSVaowUQFfbQZ/Ew+3y9vjme4mysdbML","consumerKey: nAGnSQnpTVcGOu79C9w5"));

    $result = curl_exec($ch);
    print($result."-".$host);die;

    In this code, I want to call other bot message by call other API https://cpdrdev-api.motocle8.com/list-template will call List Template so when user will click on "View More" link of "Daily Report" section (Please check this screenshot https://prnt.sc/QPOveagqs4p5 ), List Template will open.

    Currently I am able to open list template by manually run this link https://cpdrdev-api.motocle8.com/list-template on browser. Please chek this screenshot https://prnt.sc/edsgHgB8Nq1P .

    So what I want when user will click on "View More" link from carousel bot message, second bot message list template will send to user automatically  

    2022.03.25

    0
  • 업데이트 된 답글입니다.

    LINE WORKS 公式アカウント

    The postback parameter is not available in Postback Action. Please check the following Document.
    https://developers.worksmobile.com/jp/document/1005050?lang=ja
    ​​
    Postback Actionではpostbackパラメータは利用できません。以下のDocumentをご確認ください。
    https://developers.worksmobile.com/jp/document/1005050?lang=ja

    2022.04.07

    0
前の投稿 動画ファイルの投稿がユーザーの投稿と同じにならない
次の投稿How to show chat box in website
リスト

まだ、解決できませんか?
今すぐ実際に使用しているLINE WORKSユーザーに質問してみましょう。