# トークンを使用して会話を再開する

ユーザーはAlliと会話の際、さまざまな理由でダイアログを閉じる場合がありますが、ウェブサイトの場合は、ユーザの認証、アプリの場合は、アプリ終了などがその例です。 このときに、ダイアログトークンを利用すれば、いつでも、既存の対話を再開することができます。

## 会話トークンの取得 <a href="#retrieving-conversation-token" id="retrieving-conversation-token"></a>

現在進行中の会話の会話トークンを変数の値を設定ノードを利用して取得することができます 。 以下のように”generate\_token（）関数”を使用して、必要な変数に値を保存します。 変数の値を設定ノードで関数を使用する方法は、[こちらのユーザガイド](https://docs.allganize.ai/alli-userguide/skills/skill-editor/node/assign-value-node)を参照してください 。

<figure><img src="https://i0.wp.com/blog.allganize.ai/content/images/2020/11/Screen-Shot-2020-11-17-at-2.00.13-PM.png?w=800&#x26;ssl=1" alt=""><figcaption><p>例として、対話トークンを生成して値を表示するように設定しています</p></figcaption></figure>

<figure><img src="https://i0.wp.com/blog.allganize.ai/content/images/2020/11/Screen_Shot_2020-11-17_at_2_00_27_PM.png?w=800&#x26;ssl=1" alt=""><figcaption><p>上記のような会話トークンが生成されます</p></figcaption></figure>

## トークン情報を送信する <a href="#sending-the-token" id="sending-the-token"></a>

次に、データ連携ノードを使用してトークン値を目的のURLに送信します 。 トークン情報を持つ変数をノードで送信する変数として設定するだけです。 データ連携ノードの設定は、環境によって異なります。 詳しくは、 [**データ連携ノードのユーザーガイドを確認**](https://docs.allganize.ai/alli-userguide/skills/skill-editor/node/integrate-node-advanced) してください。

## トークンを使用して会話を再開する <a href="#resuming-conversation-using-the-token" id="resuming-conversation-using-the-token"></a>

Alli SDKで会話を再開するには、 既存のwindow\.Alli.event（）の代わりに、以下のように、生成されたトークン値を用います。

{% code lineNumbers="true" %}

```javascript
if (window.Alli) {
	window.Alli.__startConversation(
		'CONVERSATION_TOKEN',
		{launcher: false, popupMode: true})
	.then(function(){window.Alli.__sendChat('RESUME_MESSAGE')});
}
```

{% endcode %}

CONVERSATION\_TOKENは実際の会話トークンに置き換え、RESUME\_MESSAGEは会話が再開されたときに送信するメッセージに置き換える必要があります。 メッセージはユーザーによって送信されたものとみなされ、会話はチャットウィンドウ全体に読み込まれますので、注意してください。尚、Alliスキルの見直しや、Alliを正しく読み込むようにウィンドウサイズなどの適切な設定が必要になります。ユーザーガイドを確認してください。

ご不明点がありましたら、担当までご連絡ください。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allganize.ai/alliyzgaido/skills/skill-editor/node/resume-conversation-using-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
