Skip to main content
Answered

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


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.

Best answer by Eric Fitz

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.

View original
Did this topic help you find an answer to your question?

4 replies

Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • January 26, 2022

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!


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • Answer
  • January 26, 2022

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.


  • Author
  • New Participant
  • 1 reply
  • January 27, 2022

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

 

 

 

 


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • 1630 replies
  • January 28, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings