• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Collect a phone number on the first slide and connect to an API to send a text with Captivate?

New Here ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

I am not a user of Captivate, but rather a software developer who has been tasked with integrating custom software with it, so I would appreciate additional context or ideas that solve my problem but deviate from what I have speced out here. 

 

I have the following need: 

 

- On the first slide, collect a phone number from the user and somehow save it. Ideally it would be validated, but if not, I can live with that. I know that I can collect this with an text entry box, but I cannot find anything on saving that text entry to a variable and referring to that variable in JavaScript on a later slide to use in the API call (it is quite possible that I am approaching this too much like a coder or getting all the terminology wrong).  Or another way that would work is if each user of a Captivate instance were assigned a unique ID and that could be accessed via JavaScript instead (as then I can just save it to our API with the phone number and ID and use the ID to send the text messages on the other slides). 

 

- On several slides, either when the slide changes or perhaps on the press of a button, I would like to call a webhook that uses that phone number/user ID and the slide number or perhaps some other unique identifier. I believe that I can do this with Execute JavaScript. What I do not know is what version of JavaScript is supported by this. Would 'fetch()' be supported? I would investigate this myself, but I also lack access to Captivate. 

 

Thank you. 

TOPICS
Advanced , Advanced actions , Getting started

Views

100

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 10, 2021 Sep 10, 2021

Yes you can certainly collect a use's phone number on the initial slide by using a Text Entry Box or TEB.  In Captivate each TEB always has an associated variable that stores any text string or numeric value typed into the field in the TEB.   

 

At the time the TEB is inserted to a slide a User Variable is also created and given the same Object Name as the TEB.  However, you can create your own User Variable in Captivate and link that to the TEB instead of the default one.  The main reason you w

...

Votes

Translate

Translate
Community Expert ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

LATEST

Yes you can certainly collect a use's phone number on the initial slide by using a Text Entry Box or TEB.  In Captivate each TEB always has an associated variable that stores any text string or numeric value typed into the field in the TEB.   

 

At the time the TEB is inserted to a slide a User Variable is also created and given the same Object Name as the TEB.  However, you can create your own User Variable in Captivate and link that to the TEB instead of the default one.  The main reason you would want to do this is that once a Captivate User Variable is created its name cannot be changed.  So if you wanted to have a variable with a more descriptive name than Text_Entry_Box_1, then you would create your own and link it to the TEB instead.

 

Captivate by default doesn't provide any way to validate that a phone number is in a correct format.  But since you mentioned that isn't necessary, we'll skip that bit.  The important thing here is that anything typed into the TEB is immediately written to a User Variable in the captivate module at runtime.  And that means that as long as the user session remains active that same variable can be used somewhere later in the module for use in JavaScript code where you might want to use it.

 

Another thing you need to be aware of is that by default Captivate doesn't try to save your User Variables to local browser storage for later retrieval.  So, if there's some chance your user might be abandoning their session with a Captivate module and then resuming at a later date, you might need to look into persisting your user variable so that it is still available when they later resume.

 

Which version of JavaScript you use with fetcf() probably has more to do with which browsers and browser versions you need to support.  I would suggest you check this link: https://stackoverflow.com/questions/44058726/is-the-fetch-api-an-ecmascript-feature

Is there any chance that your client might be expecting the content to work with IE11?  If so, that will likely be the big limiting factor on which areas of JavaScript you can use.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources