BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Using WebChat in SharePoint Script Editor

Open virendrak opened this issue 9 years ago • 5 comments

I have followed the approach mentioned in path - https://github.com/billba/botchattest As of now this link contains two .html(s), \botchattest-master\Index.html \botchattest-master\botchat\Index.html

I have merged the code from both the .html(s) and created one html. So, that I can use the complete code snippet in my SharePoint page in Script Editor Web Part.

I created a Web Part Page in my SharePoint site and added a Script Editor web part, and saved required .JS and .CSS in Style Library Folder.

Here, the "Click" event of Hero card is get post-back and my whole page is getting refreshed. However when I have used in normal html page (), it's working as expected.

Please Find ZIP, Where it is working fine in HTML Page: SPBot.zip

Web Part - SP Page I pasted below code in my web part page in Script Editor Web Part: WPCode.txt

Thanks in Advance!

Regards, Viren

virendrak avatar Dec 12 '16 10:12 virendrak

I haven't looked at your code, but it doesn't make sense to merge the two index.html files. One is for the botchat control, one is for the page it's embedded in. Unfortunately I don't have any SharePoint experience so I don't have any specific advice, but I'll see if I can find someone who does.

billba avatar Dec 12 '16 13:12 billba

Thanks @billba. Now, I have again used the 2 pages logic in share-point page. Since, I cannot serve .html page from SharePoint, it's downloading that page instead of opening, so I have renamed the page .html to .aspx

I have pasted below iFrame tag in my web part page in Script Editor web part. It's working as expected.

Thanks for your help and information. Now, I am closing this issue.

<div style="float:right">
<iframe id="botchat" src="../Style Library/botchat/index.aspx?s=<SecureId>" width="450" height="500"></iframe>
</div>

Thanks, Viren

virendrak avatar Dec 15 '16 09:12 virendrak

Hey viren...billba asked that I look at your issue as I have more experience with SharePoint. I got it working pretty easily using the same steps you used. Only difference is I put my index.aspx/css/js in the SiteAssets library instead of Style Library. I would be really careful in how SharePoint does relative paths with site collections. Here is my embed code as sample (note: "Chatbot" is a subsite off the root site collection of my SharePoint Online tenant):

<iframe id="botchat" src="/chatbot/SiteAssets/index.aspx?t=<directline secret>" width="320" height="500"></iframe>

richdizz avatar Jan 03 '17 19:01 richdizz

@richdizz Thank you so much for your input.

virendrak avatar Jan 05 '17 14:01 virendrak

Hi Viren, Richdizz

I need your help to set up a Chatbot on a SharePoint site

I am trying to do exactly what you did, I have the WPcode.txt file where all the code is present including the references to js and css. Now what i am not able to figure out is how to use the Iframe tag and integrate it with the WPcode.txt file. Right now i am able to get an empty chatbot pop up, But still need to figure out how to integrate the iframe tag in it. chatbot

Warm Regards, Kashif

kashifdhunk avatar Jun 18 '18 09:06 kashifdhunk