[How To] Webex Chatbot Part 2: Working with Adaptive Cards

Поделиться
HTML-код
  • Опубликовано: 11 янв 2025

Комментарии • 27

  • @zs8850
    @zs8850 2 года назад +1

    I guess you're the type to ignore config files. I kid. Great video. Thanks!

  • @DevNetDan
    @DevNetDan 2 года назад +1

    Very cool video! I learned a lot about adaptive cards.

  • @pepperjackshack2439
    @pepperjackshack2439 Год назад

    What is the bot again? Does the card send a post data request? I was curious how my Webex webhook could trigger a lambda function to mark up a CSV with the contents of the card payload

  • @abhishekshukla6418
    @abhishekshukla6418 2 года назад +1

    Thank you, this really clears out many doubts

    • @0x2142
      @0x2142  2 года назад +1

      Awesome! Glad to hear it helped!

  • @romany5829
    @romany5829 Год назад

    Hi, can i add on o response card some buttons, which will call another cards and so on?
    Can it be done inside one Command?
    So it will looks like a dynamic menu on card.
    Thanks in advance!

  • @rod.hpadilla
    @rod.hpadilla 2 года назад +1

    hey Matt! awesome video

  • @artbynaveen9609
    @artbynaveen9609 Год назад

    hi 0x2142,
    how to return more than 1 local files when replying bot messages.
    Previously You given solution for single file response.
    Please help

  • @pakbungcreativecollections9348
    @pakbungcreativecollections9348 2 года назад +1

    Thanks for this video. Great!!!

  • @alicelucia2483
    @alicelucia2483 2 года назад

    It's a nice video and helped a lot but I have a doubt, is there a way to put more than a callback_keyworld into a class? Eg "weather" or "temperature" to show weather for today

    • @0x2142
      @0x2142  2 года назад

      Sure thing. The callback_keyword is just what gets registered with the bot, so it knows which class to call when the bot receives a message. However, you could break things down within a class.
      For example, if you had a "weather" command, but wanted "weather temperature" and "weather tomorrow" as subcommands - you could register just the "weather" command, then in your class check the incoming message to see if there is a subcommand or not & route it appropriately.

  • @isadoralorenti2581
    @isadoralorenti2581 2 года назад

    Another question lol I took this as a challenge. Is it possible to add more than 1 callback keyword for the same button in the card? For instance, at work we have an app that we use to book computers for the day and I set a card to give instructions on how to acess the app. The only callback keyword is the name of the app, how can I add more keywords? Sorry for the amount of questions!

    • @0x2142
      @0x2142  2 года назад +1

      Hmm - I suppose I would want to clarify what you would need multiple callback keywords for? I checked through the webex_bot code to confirm, but the bot would only accept one callback_keyword.
      The callback_keyword would be to tell the bot to call your Python class - so are you looking for the button to call multiple classes? If so, I would just set the callback_keyword to a class/command - then use that class to call multiple things if needed.
      One way you could work around this: The card JSON for a button can hold multiple values if needed - for example, in my sample code for this bot - the submit button looks like this:
      {"type": "ActionSet",
      "actions": [
      {
      "type": "Action.Submit",
      "title": "Get Weather",
      "data": {
      "callback_keyword": "weather"
      }}]}
      However, when we generate that JSON - we can add as many key/value pairs to the "data" dictionary as we want. So if you needed additional info for your script - you could insert them here. For example, let's say you wanted to modify my script to have buttons to request specific items (like temp or humidity) and within a certain timeframe:
      "data": {
      "callback_keyword": "weather",
      "requested_info": "temperature",
      "timeframe": "tomorrow"
      }
      The callback_keyword is still "weather" - so it gets passed back to my original WeatherByZIP() class. But now within that class, I can pull out the other info from the "data" dictionary with:
      attachment_actions.inputs['requested_info']
      This is similar to how we pulled out the ZIP code, but with any number of additional values we want to include - which can be pre-loaded when the card JSON is generated. I have used these key/value pairs occasionally to keep track of user interaction - like storing the last message/action in the card JSON.
      I don't know if that's what you're trying to do exactly - but it could help you simplify/re-use the same class but do multiple things, if that's the goal.

  • @farrukhzamankhan2992
    @farrukhzamankhan2992 2 года назад +1

    This was a great video man! I want some help in this regard, webex supports only adaptive cards version 1.2.. The issue is that I want some of the input text to be *Required nature.. And if that field is empty then card shouldn't be submitted.. How can I achieve this? Thanks in advance :)

    • @0x2142
      @0x2142  2 года назад

      Hi there, Thanks for the comment!
      Unfortunately, from what I can see - Webex still only supports up to AdaptiveCard 1.2, but the "isRequired" card parameter requires minimum version of 1.3.
      Since the card schema is rendered by the Webex client, I don't think there is anything we can do to work around this - until they add support for 1.3 card schemas.

  • @artbynaveen9609
    @artbynaveen9609 Год назад

    hi 0x2142,
    how to return local files when replying bot messages.
    When commenting on your webpage, Comment is not sending.

    • @0x2142
      @0x2142  Год назад +1

      Hi there -
      It looks like you should be able to return files using the example here: github.com/fbradyirl/webex_bot/issues/29
      Also - Thanks for the heads up on the comments. I fixed this now 👍

  • @yurivieira9723
    @yurivieira9723 2 года назад

    Hi, great video! I was wondering... is there a way to use cards to deal with exceptions? For example, when someone types something that the bot doesn't recognize, he shows a message like "I didn't understand, here are my available commands: (and then shows the default help card). Is it possible? If so, where should I implement this? I was poking aroung in the help and webex_bot classes but it didn't work so far...

    • @0x2142
      @0x2142  2 года назад

      Hey there - Yes, by default if the bot doesn't recognize the command being sent it will send the help card. You can overrride this behavior by removing the default help command & writing your own.
      I found this discussion on the webex_bot package recently where they show how to remove the built-in help command:
      github.com/fbradyirl/webex_bot/issues/25#issuecomment-1096754764

    • @yurivieira9723
      @yurivieira9723 2 года назад +1

      @@0x2142 That's great, worked here!

  • @isadoralorenti2581
    @isadoralorenti2581 2 года назад

    Hi! Great video! I was wondering, is it possible to return a goodbye message in case the user doesn't interact for a certain amount of time?

    • @0x2142
      @0x2142  2 года назад

      You could, yes - but it would be a bit of additional work. You would need code within your bot to store the user ID & last time they communicated. Then use the webexteamssdk to send a message back to the user after a certain time interval had passed. The webex_bot package leverages the webexteamssdk for quite a lot of things, and I don't think the bot package itself can send unsolicited messages to users at this time.

    • @isadoralorenti2581
      @isadoralorenti2581 2 года назад +1

      @@0x2142 I see... what about another submit button inside a response card to go back to the initial card?

    • @0x2142
      @0x2142  2 года назад

      Sure thing. You could do this a few ways. When you create a button on the card, you provide the "callback_keyword". So depending on how you structure your bot, the reset button could just have a callback_keyword of your default prompt - which would then display the first card.
      Or you could set the callback_keyword to a new bot command - where you would define a class to handle restarting the process.
      Also, if you wanted to restart the process with some added context - the "data" section of the button submit (which is where we place the callback_keyword) can hold other key-value pairs. So your button could reset the process back to the first card, but pass other data to keep some illusion that the process hasn't completely started from zero.

    • @isadoralorenti2581
      @isadoralorenti2581 2 года назад

      @@0x2142 Thanks a million!

    • @myown5861
      @myown5861 11 месяцев назад

      Is there any way to add a cancel button ? Like if a user gave a different command instead of intended one and want to cancel it?

  • @HariHaran-ob3sf
    @HariHaran-ob3sf 2 года назад +1

    thanks man