简体   繁体   中英

Query URL in Watson Assistant

I'm working with Watson Assistant (V2). I'm configuring WA itself through the IBM front-end interface they offer, and use NodeJS to deploy it to their cloud.

I want to do the following:

  1. User visits www.mysite.com/?productID=123 which contains the chatbot

  2. The bot, upon launch, queries the URL and recognizes the productID.

  3. The recognized productID is placed in my entity @productID so I can then use it as context variable $productID (or @productID.literal).

So far I haven't been able to find a way to put the productID in the @entity. I grab the productID by calling an onload function using a regex, and can display the productID in the chatbox. However what I cannot figure out is a way to somehow store this in the @entity.

I'm familiar with html/css/json/js, but not yet with the API that Watson offers.

Any pointers are greatly appreciated. Thanks!

When you use the V2 API for IBM Watson Assistant, then you use message to send user input to the chatbot engine. The request body has a context element with system and skill-related section. You can augment it and set app-related context variables. Use it to pass in your productID . There is no need to try to set it as entity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM