I recently got into making dialogues for my Slack application and was wondering how to take text input from a user with a required formatting style. I have seen apps like EventBot do this when you try to make a new event it opens up a dialogue and a text input line asks you for Date & Time in the specific format MM/DD/YY HH:mm am/pm. If you don't follow this formatting a little red warning appears below the text box when you try to submit the dialogue.
I can't seem to find any documentation as to how to throw this warning when a user doesn't follow your formatting and haven't seen any attribute for getting a date from the user.
Does anyone know what method to call or what attribute I need to include to make this kind of restriction?
-Thank you
This works a bit differently. There is no API to call.
Instead, your apps needs to evaluate the user input (after the dialog is submitted) and can then respond with an error message to Slack if necessary. That error message is then displayed in the Dialog.
Here is the relevant part of the official documentation:
If your app finds any errors with the submission, respond with an
application/json payload describing the elements and error messages.
The API returns these errors to the user in-app, allowing the user to
make corrections and submit again.
And here is the example for a response from the official documentation:
{
"errors": [
{
"name": "email_address",
"error": "Sorry, this email domain is not authorized!"
},
{
"name": "username",
"error": "Uh-oh. This username has been taken!"
}
]
}
Related
I'm working on a registration flow that I'm having difficulty with. I've got a self asserted profile to collect some data, and it's got validation profile that calls a REST endpoint. The REST endpoint passes back, among other things, a claim indicating if there's an error (boolean) and if there is, an error type (string). I've been back and forth with possible solutions, but I haven't been able to figure out how to do what amounts to a case statement - that is, if the error is "Not Found", load content from {notfoundurl} (via a technical profile's ContentDefinitionReferenceId) and display to the user; if the error is "Partial Match", load content from {partialmatchurl} and display to the user, and if everything seems to be in order, allow the user to enter a username and password to register. Is there an elegant solution to this?
I'm currently working on Microsoft Botframework Node.js SDK.
I was wondering if there was a way to hard code a user response for a prompt through the code?
The scenario is to add/ remove people to the meeting. The dialog contains 2 waterfall functions. The first is used to handle card actions, and display the default prompt to enter a username to search for. The second function searches for the username and displays the results in a carousel. Selecting a user from the card adds the person to the meeting (handled in first waterfall function).
Once a user is added to the meeting, the first waterfall function displays the currently added people in the meeting with the option to remove, followed by the default prompt to search users. Since it expects a prompt response, the "remove" actions causes a break and the bot's response is: "I didn't understand. Please try again.".
So is it possible to hard code a null user response through the code when the "remove" action is triggered? Or is there any other way to bypass a prompt without any input from the user's end?
Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:
What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?
Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.
--
If I view a draft message in the new Gmail UI, the URI is something like this:
https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF
I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.
Previously, one could do this:
https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d
where the value of "compose" is the Id.
How can the same thing be accomplished in the new UI?
I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.
Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74
This code includes an encode and decode function which should work for Gmail-format query parameters.
Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this:
thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.
Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.
Thanks to #frank-szilinski - he pointed out that the old format is now translated. I.e. this now works again:
https://mail.google.com/mail/ca/u/1/#drafts/1661237c4db71ace
It doesn't seem to work when the Gmail tab isn't already open, however.
Building on #kremonte gist, and #chris-wood comments, I made a rails gem that correctly creates the open-the-draft-inside-gmail URL.
It's here - https://github.com/GoodMeasuresLLC/gmail_compose_encoder
It's for the use case of "my code created a draft (prepopulated with some text, of course) and now I want to open the draft in compose mode so that my user can review it before hitting "send".
How to get the URL for a draft
If, for example you use a list request from which you get your draft objects:
{
"id": string,
"message": {
object (Message)
}
}
You can take this id and put it into a URL in this format:
mail.google.com/mail/#inbox?compose=[id]
Eg.
mail.google.com/mail/#inbox?compose=3doinm3d08932d
This will open up GMail with the relevant draft open.
I was struggling because I wanted it to work with multiple accounts. However the authuser parameter did not help.
Inserting the email address instead of the integer after the u/ component solved the problem.
https://mail.google.com/mail/u/{email_address}/#drafts?compose={message_id}
The message id is the one provided by the API.
I'm trying to populate the textTabs in one of the documents so that it has information prefilled into it using the call for EnvelopeTabs: update, however it keeps throwing me an error that it cannot find the tab that I am trying to test in the explorer. I have used the list call in the EnvelopeTabs to make sure that the information that I'm providing matches what is in the envelope and it is, here's an example of what I was seeing
enter image description here
enter image description here
When I make the call to update the tab in textTabs, I am doing it with the documentId, pageNumber, and tabLabel provided above and with the value set to what I want to be prefilled, however I keep getting an error that it cannot find the specified tab.
I have even tried filling it in with just the tabId and am still getting the same error.
In an effort to see if I was missing something, I also tried checking the linked reference documentation on the EnvelopeTabs: update page but it is 404ing (as were one or two other end points in the api explorer).
Any help would be appreciated as it seems like there is a piece of information that I'm missing to prefill tabs.
Are you creating the envelope via the API? If so, then the easy way to set a tab's value is to set the value parameter.
If you want to set a tab's value after the envelope is created, use the EnvelopeRecipientTabs: update method. (Note the resource name in your question was incorrect.)
When using this method, or any other DocuSign update method, remember that it is not a patch method: You must supply all of the parameters for the Envelope Recipient Tab that you're updating. If you don't already have all of the settings, then first do a get on the object, then update it.
I tried using below JSON call to update the Recipient tab and its updating the tab value:
PUT /restapi/v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
{
"textTabs": [
{
"value":"newVal",
"tabId": "cef562dd-e098-4dcd-935d-34ff8f5b5211"
}
]
}
I'm creating a bot in DirectLine. I'm trying to use SuggestedActions to display a suggested action and I don't want to include the text attribute for that. When I try to run my code without the text attribute, I see a blank message being displayed. How can I avoid that?
My code
var msg = new builder.Message(session)
.suggestedActions(
builder.SuggestedActions.create(
session, [
builder.CardAction.imBack(session, "disconnect", "Disconnect"),
]
));
session.send(msg);
The Output i'm getting:
Per my understanding, you want a button which is shown absoluted at bottom and always display to remind your agent that he can disconnect conversation any time.
However, per me testing and understanding, in my opinion, there 2 points that it's maybe not a good idea to achieve this feature:
SuggestedAction is based on Messasge in Bot framework. And basically Bot application is for conversation. So every message between user and bot renderred in different channels should always be contained in a textbox, shown like in your capture. We cannot bypass this feature.
Per your requirements, I think you want this button should be always display unless the agent click it. But I didn't find any feature like this in Bot framework, and you may need to send this meesage additionally beside every message from bot, which is not graceful and will raise unpredictable risk.
My suggestion is that you can create a triggerAction to handle global disconnect requests. Refer https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-actions for more info.