Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing Buttons/Actions within WebChat Adaptive Card #2123

Closed
mamhh opened this issue Jun 26, 2019 · 6 comments
Closed

Customizing Buttons/Actions within WebChat Adaptive Card #2123

mamhh opened this issue Jun 26, 2019 · 6 comments
Assignees
Labels
question Further information is requested. Stack Overflow candidate

Comments

@mamhh
Copy link

mamhh commented Jun 26, 2019

To have consistent branding/styling we need to customize the actions/buttons that are rendered within Adaptive Cards just like what we have for (// Suggested actions) within defaultStyleOptions.js ... for the meantime .. any quick solution ????

@tdurnford
Copy link
Contributor

tdurnford commented Jun 26, 2019

Web Chat uses the AdaptiveCards npm package to render AdaptiveCard JSON into HTML elements, and the renderer uses a host config to determine how to style the HTML. Web Chat allows developers to pass their own adaptiveCardsHostConfig as a prop for the renderer to use. Additionally, the default host config that Web Chat uses does currently pull in some attributes from defaultStyleOptions so some of the changes like accent color should carry over.

For more details take a look at this GitHub issue on using your own host config. Note, providing a custom host config won’t be fully supported until the next release in July, but if you need an immediate solution please take a look at the read me section about using that latest bits.

Hope this helps!

@tdurnford tdurnford self-assigned this Jun 26, 2019
@corinagum corinagum added the question Further information is requested. Stack Overflow candidate label Jun 26, 2019
@mamhh
Copy link
Author

mamhh commented Jul 1, 2019

@tdurnford The statement (Web Chat uses the AdaptiveCards npm package) is a bit confusing for me. What I know , is that we reference a webchat.js script file in our HTML and it will do everything for us.
Could you please explain your statement to me .. it will be really helpful

@tdurnford
Copy link
Contributor

One of Web Chat's dependencies is the Adaptive Cards package which is responsible for rendering all of the cards sent in the conversation. Essentially, your bot sends a card as a JSON object to the conversation, and Web Chat passes the JSON object to the Adaptive Cards renderer to convert it to HTML. If you want to change how the renderer styles the card, you need to update the Adaptive Card Host Config. Again, for an example on how to modify Web Chat's Host Config, take a look at this issue.

@mamhh
Copy link
Author

mamhh commented Jul 1, 2019

One of Web Chat's dependencies is the Adaptive Cards package which is responsible for rendering all of the cards sent in the conversation. Essentially, your bot sends a card as a JSON object to the conversation, and Web Chat passes the JSON object to the Adaptive Cards renderer to convert it to HTML. If you want to change how the renderer styles the card, you need to update the Adaptive Card Host Config. Again, for an example on how to modify Web Chat's Host Config, take a look at this issue.

@tdurnford this is really great explanation from you :) .. but it opens new fundamental question ? I can understand that the adaptive card render is NodeJS package hosted @ some server and will accept JSON and return HTML .. is this a correct understanding?? and Why it's not simply Javascript code and being part of the Webchat.js file ?? Sorry if this question comes due to lack of experience.. I'm really thankful for your support and usual cooperation:)

@tdurnford
Copy link
Contributor

Adaptive Cards is an open source project that is developed and maintained by a team outside the scope of Web Chat and can be used in any project. Web Chat has the project as a dependency meaning the source code is downloaded and added to the node_modules directory when we run npm install. Then when we build Web Chat that code gets incorporated into the build. So the Adaptive Cards are not being rendered on an external server but inside the Web Chat code. Take a look at this blog post on Node Modules.

@mamhh
Copy link
Author

mamhh commented Jul 2, 2019

Adaptive Cards is an open source project that is developed and maintained by a team outside the scope of Web Chat and can be used in any project. Web Chat has the project as a dependency meaning the source code is downloaded and added to the node_modules directory when we run npm install. Then when we build Web Chat that code gets incorporated into the build. So the Adaptive Cards are not being rendered on an external server but inside the Web Chat code. Take a look at this blog post on Node Modules.

@tdurnford , Once again .. THANK YOU :) since this is my first time to deal with NODE JS. I just know and write normal JS :) ... so to conclude, WebChat is nodeJS project made of other modules and finally converted to normal JS within this file (https://cdn.botframework.com/botframework-webchat/latest/webchat.js) to be referenced/used within browsers ... please confirm this understanding :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested. Stack Overflow candidate
Projects
None yet
Development

No branches or pull requests

4 participants