Skip to content

rich formatting support for interactive messages #99

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

spencerlepine
Copy link

@spencerlepine spencerlepine commented Feb 14, 2023

Reference

Description of changes:

Created component <RichLinkRenderer /> to support markdown hyperlinks for interactive message title/subtitles.

Should create anchor tag for the following:

Note: also changed the dependabot PR creation, because it was cluttering pull requests

image

Interactive Message Lex Bot

Set up a lex bot following the blog post. In the lex lambda, modify the intent title passed to user to be rich text, e.g. title: "How can we help? [Learn More](https://oursite.com)"

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@spencerlepine
Copy link
Author

ListPicker Lambda

// Lambda code for Lex bot

/* CREATE A LIST PICKER */
function createSimpleListPickerFromOptions(title, options) {
  let elements = options.map((option) => {
    return { title: option };
  });

  return {
    templateType: TEMPLATE_TYPES.LISTPICKER,
    version: "1.0",
    data: {
      content: {
        title: "How can I help you? [richLink](https://example.com)<!--rehype:target=_self-->", // default {:target=\"_blank"}
        subtitle: "**Bold Subtitle** *italics* [richLink](https://somelink.com) https://plainlink.com.",
        elements: elements,
      },
    },
  };
}

ListPicker UI Demo

Screenshot 2023-02-03 at 11 35 30 AM

Screenshot 2023-02-03 at 11 36 48 AM

TimePicker Lambda

SIMPLE_TIMEPICKER: {
    templateType: TEMPLATE_TYPES.TIMEPICKER,
    version: "1.0",
    data: {
      content: {
        title: "Schedule appointment [richLink](https://example.com)<!--rehype:target=_self-->",
        subtitle: "**Bold pick option:** *italics* [richLink](https://somelink.com) https://plainlink.com.",
        timeslots: [
          {
            date: "2020-10-31T18:00+00:00",
            duration: 60,
          },
          {
            date: "2020-10-15T13:00+00:00",
            duration: 60,
          },
          {
            date: "2020-10-15T16:00+00:00",
            duration: 60,
          },
        ],
      },
    },
  },

TimePicker UI demo

Screenshot 2023-02-03 at 11 59 03 AM

ListPicker Images Lambda

DEPARTMENT_WITH_MULTIPLE_IMAGES: {
    templateType: TEMPLATE_TYPES.LISTPICKER,
    version: "1.0",
    data: {
      content: {
        title: "Which department do you want to select? [richLink](https://somelink.com) https://plainlink.com",
        subtitle: "**Bold pick option:** *italics* [richLink](https://somelink.com) https://plainlink.com.",
        imageType: "URL",
        imageData: IMAGE_URLS.COMPANY,
        elements: [
          {
            title: DEPARTMENT_SLOT.BILLING,
            subtitle: "Request billing information",
            imageType: "URL",
            imageData: IMAGE_URLS.BILLING,
          },
          {
            title: DEPARTMENT_SLOT.NEW_SERVICE,
            subtitle: "Set up a new service",
            imageType: "URL",
            imageData: IMAGE_URLS.NEW_SERVICE,
          },
          {
            title: DEPARTMENT_SLOT.CANCELLATION,
            subtitle: "Request a cancellation",
            imageType: "URL",
            imageData: IMAGE_URLS.CANCELLATION,
          },
        ],
      },
    },
  },

ListPicker Images UI Demo

Screenshot 2023-02-03 at 12 03 01 PM

Dev Tool Screenshot

html screenshot

html screenshot 2

@spencerlepine spencerlepine force-pushed the spenlep-rich-messaging-support branch from 4381184 to f1dea9b Compare February 14, 2023 20:40
@spencerlepine spencerlepine force-pushed the spenlep-rich-messaging-support branch from f1dea9b to 623fa0e Compare February 14, 2023 20:48
@@ -1,11 +1,13 @@
# Keep compatible webpack@4.x - Reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clean up dependabot auto-PR creation, we should raise them monthly, and ignore breaking major upgrades, since we will ignore anyways.

@spencerlepine
Copy link
Author

Testing in local-testing folder and real lex bot:

test

@spencerlepine spencerlepine self-assigned this Feb 14, 2023
@spencerlepine spencerlepine marked this pull request as ready for review February 14, 2023 20:53
@spencerlepine spencerlepine requested review from mhiaror and haomingli2020 and removed request for haomingli2020 and mhiaror February 15, 2023 17:18
@spencerlepine spencerlepine deleted the spenlep-rich-messaging-support branch March 31, 2023 01:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants