How do I initiate a dynamic user prompt depending on an API response in Bot Composer? - botframework

I have an API response in which a field gives me an array of objects. I want to prompt the user to select which one of these objects in the array they want to see the details of. For example, if the API response has a field like:
"field":[
{"number":"101","name":"abc","value":"final output 1"},
{"number":"102","name":"xyz","value":"final output 2"}
]
I want the prompt/card to ask which number and name the user wants to choose, accordingly I want to show the corresponding value to the user. The number of objects in the array can vary. I would prefer if this prompt is in the form of an adaptive card like the one in the attached image, but any solution would do using bot composer's capabilities.

One viable solution would be to build a card in code. You can parse the response from the API and use it to create a card which can then be sent by the bot. Since this is Composer, you can look into creating a custom action to hold this logic.

As the user AP01 has said, one good solution to this problem is to do it inside the code. You can create a custom component that will execute C#(or nodejs if you use that) code in which you can then easily deserialize/parse/process that json array and create a custom card that will then be display to the user. That is how I did it.

Related

Identify unique visitor redirected from Qualtrics

I'm trying to redirect respondents within a survey in Qualtrics to a webpage. On this webpage, they need to choose between a couple of options, and after it return to Qualtrics.
I know it is possible to generate an unique URL within qualtrics (e.g. example.com/test?UniqueID=999). However, how can I 'catch' this parameter together with the participant's response?
Thank you!
To "catch" a parameter in Qualtrics, you need to create an embedded data block in your survey flow and then create an embedded data field within that block with the same name (case-sensitive!) as the parameter. Instructions are available in the Qualtrics documentation here.
Please note that if you want to ensure that the parameter will be recorded for all responses, you should place the embedded data block first in your survey flow. (If it's placed after the question block(s), it will only be recorded for respondents who complete all the questions.)

Confirmation of the creation of a record via email in apex Oracle

I have this situation: I have a filling form, there I enter the details of sealing the object, I want to add an interesting function to the form, I want to send an e-mail in order to support the sealing permissions.
For example, I want to seal the doors, in the form I enter the email and press the send button, I receive a normer, which I must enter in the next field in the form, if the number is correct, I see the "create" button, if not, then the "Create" button does not visible
Has anyone already encountered this?
To show (or not) certain items or buttons you can use
conditions
dynamic actions (Show)
In your case, dynamic action might be a better choice.
The part which is related to "if the number is correct" is handled by validation.
If you want to send an email, simplest way is to use APEX_MAIL. https://docs.oracle.com/en/database/oracle/application-express/19.1/aeapi/APEX_MAIL.html#GUID-14F51C6D-CB82-4B38-AB6E-61C46E75596F
For some other options, have a look here: https://jeffkemponoracle.com/2016/04/email-made-easier/
If you want to send an SMS, there is no built-in support for this. You would need to send requests via an SMS gateway. By way of example, an API for integrating with one gateway (ClickSend) which might help you is: https://jeffkemponoracle.com/2016/08/send-sms-mms-and-voice-messages-from-oracle-plsql/

SuggestedAction with submit action functionality

Suppose there is an AdaptiveCard that contains some input fields like this.
Normally the inputs made by the user are submitted as json by the AdaptiveSubmitAction which is part of the formular too.
Is there a way to submit the json data using a SuggestedAction?
I suspect not, but I'm not sure...
Unfortunately, no, there is no way to mix the two. Additionally, the adaptive card requires the submit action when inputs are presented, otherwise, the text entered can't be ingested/accessed.
Now, you could use the card for displaying what information you are seeking and use suggested actions to present possible answers. Unlike the choice prompt, suggested actions allows users to enter in alternate responses. Your bot logic would need to know how to handle alternate responses. Meanwhile, in the background, your logic could construct the user responses into a JSON object.
I don't know if this was helpful. Hard to know without knowing your use case and specific needs.
Hope of help!

Attach meta data / custom data to slack messages sent through the API

I am developing a series of Slack apps for my workspace, and some of them are meant to interact with the content (messages) delivered by the other apps : extracting content IDs that may be referred to by other messages
A concrete example :
Suppose I have an app A "FindUser" that is capable of giving me the user profile when a slack user types find me#example.com, and it replies in the thread with a formatted view of the user profile
I am developing an app B "EditTags", which basically gives me a right click option with "edit tags" (see Slack's Interactive Components/Actions), the idea being that a user could first ask app A to find a user, and then right click on the reply from App A and click the "edit tags" action given by the other app. What this app B does it actually retrieve the tags for the user mentionned by the previous message from app A, and in another reply to the thread it gives some controls to either delete an existing tag OR it shows a select with autocomplete to add new tags.
The B app needs to retrieve the user ID that the A app mentionned previously. So I need some way to pass that data directly in the slack message. When looking at the examples, slack does not seem to provide a way to add arbitrary "metadata" to a message, am I wrong ? Do you have workaround for this ? I mean I could totally send the user ID say, in the footer, so I can just read the footer, but I was planning to use the footer for something else... Is there a way to pass metadata hrough properties that would be hidden to the end user ?
Although this does not feel relevant, I am building a slack nodeJS app using the node slack sdk (and especially the #slack/interactive-messages package)
For the most part the Slack API does not provide any official means to attach custom data / meta data to messages. But with some simple "hacks" it is still possible. Here is how:
Approach
The basic approach is to use an existing field of the message as container for your data. Obviously you want to pick a field that is not directly linked to Slack functionality.
Some field are not always needed, so you can just use that field as data container. Or if its needed, you can include the functional value of that field along with your custom data in the data container.
For example for message buttons you could use the value field of a button and structure your code in a way that you do not need it in its original function. Usually its sufficient to know which button the user client (via the name field), so the value field is free to be used for your custom data. Or you can include the functional value of your button along with the custom data in a data container (e.g. a JSON string) in that field.
Serialization
All messages are transported through HTTP and mostly encoded as UTF-8 in JSON. So you want to serialize / de-serialize your data accordingly, especially if its binary data. If possible I would recommend to use JSON.
Length
The maximum allowed length of most fields is documented in the official Slack API documentation. e.g. for the value field for message buttons can contain up to 2.000 characters. Keep in mind that you need to consider the length of your data after serialization. e.g. if you convert binary data into Base64 so it can be transported with HTTP you will end up with about 1.33 characters for every byte.
Contents
In general I would recommend to keep your data container as small as possible and not include the actual data, but only IDs. Here are two common approaches:
Include IDs of your data objects and load the actual objects
from a data store when the request is later processed.
Include the ID of server session and when processing the request you
can restore the corresponding server session which contains all data
objects.
In addition you might need to include functional values so that the functionality of the field you are using still works (e.g. value of a menu option, see below)
Implementation
Dialogs
Dialogs provide an official field for custom data called state. Up to 3.000 characters.
Message buttons
For Message buttons you can use the message action fields / value. Up to 2.000 characters. Its also possible to use the name field, but I would advise against it, because the maximum allowed length of that field is not documented.
Message menus
For Message menus you can use the value field of an option or the name field of the menu action.
Usually the value field is the better approach, since you have a documented max length of 2.000 and it gives you more flexibility. However, you will need to combine you custom data with the actual functional value for each option. Also, this will not work for dynamic select elements (like users), where you can not control the value field.
When using the name field note, keep in mind that the maximum allowed length of name is not documented, so you want to keep you data as short as possible. Also, if you want to use more than one menu per attachment you need to include the actual name of the menu into your data container.
Normal message attachments
Normal message attachments do not contain any suitable field to be used as container for custom data, since all fields are linked to Slack functionality.
Technically you could use the fallback field, but only if you are 100% sure that your app is never used on a client that can not display attachments. Otherwise your data will be displayed to the user.

How can I use Parse to send data to specific user

I'm creating an online game which have to send data between users. I chose Parse as the backend service. How can I use Parse to do this task?
Query for the user that you want to send data to and send data
Take a look a the Parse Docs. What you want to do is documented very well there.
https://parse.com/docs/android_guide
Take a look at saving and retrieving objects.
Also make sure your console (where you can see the "User" class and all your other classes) is set up with the objects you need.

Resources