ペイロード付きのカスタムメッセージをボットからクライアントアプリケーションにダイレクトライン経由で送信するにはどうすればよいですか?

Sarthak srivastava

これは、ボットからクライアントアプリケーションにカスタムメッセージを送信しようとしている私のコードですdirectlineしかし、これを通して私はペイロードまたはテキストを受け取ることができます。

 var msg = new botbuilder.Message(session).sourceEvent({
         directline: {

              text:'Creating a note named '+note.title+ 'with description as '+ note.text,
              payload:{
                  action: "CREATENOTE"
              }   
         }                             

    });
    session.endDialog(msg);

クライアント側では、以下のActivity応答があります

   { type: 'endOfConversation',
  id: '6WYDh0QKiy31ij05UbsQgV|0000006',
  timestamp: '2018-04-09T05:18:23.2532985Z',
  localTimestamp: '2018-04-09T05:18:23.164+00:00',
  channelId: 'directline',
  from: { id: 'SarthakNotesBot', name: 'SarthakNotesBot' },
  conversation: { id: '6WYDh0JKiy31ij05UasQgV' },
  replyToId: '6WYDh0QKiy31ij05UasQgV|0000004',
  code: 'unknown' }

Activity応答発言者code:unknown

これを直接回線で機能させる方法がわかりません。

Sarthak srivastava

私はそれを以下のように解決しました:

 var msg = new builder.Message(session).entities([
     {  action: "CREATENOTE",
        payload: "other payload" 
        }   
    ])
    .text('Creating note named '+note.title+ ' with note description as  '+ note.text);       

    session.endDialog(msg);

BOTでカスタムメッセージを作成する方法を以下で確認してください。

  var customMessage = new builder.Message(session)
    .text("Hello!")
    .textFormat("plain")
    .textLocale("en-us");
     session.send(customMessage);

詳細については、Microsoftの公式ドキュメント「メッセージの作成」を参照してください。

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Related 関連記事

ホットタグ

アーカイブ