Answered

Is there a way to define URL for the options of component type `single-select` in canvas-kit?

  • 24 January 2022
  • 4 replies
  • 45 views

Let's say I have rendered a `single-select` component in the messenger which contains 10 options.

 

Now, when the user selects one of the options in the `single-select` component I want to open a survey URL using the Intercom action component type `sheet` inside the messenger, which contains an NPS question and its options.

 

Once the URL is opened in Iframe, I want to highlight the choice which the user has selected.

 

Basically, when the user selects one of the options in the `single-select` component, I want to get the id of the selected choice and pass it dynamically in the URL to highlight that choice.

icon

Best answer by Eric Fitz 26 January 2022, 18:19

View original

4 replies

Userlevel 1

Hey @rohit s​, let me check this with our engineers for you. I'll come back to you as soon as I have an update!

Userlevel 1

Me again @rohit s​!

 

When your end-user selects something on the single-select list, Intercom returns a response with the key/value pair relating to that element,

from which you can create a sheet (iFrame) with a reference to the value that was selected in the URL that you are displaying to the end-user e.g. 

http://example.com?selected=optionA/p>

 

In the example URL above, you could have a script that runs and checks for the variable "selected". If it's in the URL, then grab the value "optionA". Match "optionA" with the text that you want to highlight on their page and hey presto, you've highlighted whatever it is that was selected on the first screen of the app!

 

This should work in theory, but your team will need to look a bit more into the practical application of this.

Hi @eric f11​ ,

 

When our end-user selects one of the choices from the single-select list with action type 'sheet', then an API call is made to

 

https://api-iam.intercom.io/messenger/web/sheets/open

 

which opens the specified URL in iFrame. I have checked the above API, it is giving the required data in key/value pair relating to my element. But, my problem is how to get this data from above API and pass it to sheet URL

 

 

 

 

Userlevel 1

Hey @rohit s​, at this point, I'd recommend your contact our Support team directly via the Messenger in your Intercom workspace. They'll be best placed to help you here!

Reply