Are there any good workarounds to achieve a timepicker via Slack blocks inside a larger form? It looks like I have a few options:
1) Let the user enter in time just via a textbox ("10:00am") - but this is prone to errors and not very user friendly
2) Create select elements for each of hours, minutes, AM/PM and let them just select each - less error prone but still not very user friendly
The biggest problem with #2 is you can't do it in a larger form, you can only do it inside an actions block (if you don't want the select boxes to all be 100% width). But that doesn't work if your form submits via an option other than the action block button. So for example, if you submit your form via a view submission action, you can't (I don't think) capture any of the data inside your nested action block. So you're stuck with 100% select boxes, or at least it seems impossible to put two select boxes on the same row inside a view.
This is a beta feature but you can use a time picker block.
example: link
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Section block with a timepicker"
},
"accessory": {
"type": "timepicker",
"initial_time": "13:37",
"placeholder": {
"type": "plain_text",
"text": "Select time",
"emoji": true
},
"action_id": "timepicker-action"
}
}
]
}
Related
I'm using slack users-select in the block-kit and would like to restrict my users-list in the dropdown options (currently shows all users in workspace) with given id's OR to specific users in current-group:
"restricted_users": ["Id1", "Id2"..."IdN]
OR
"restricted_users_in_group": true
(restrict to only users in existing group)
then show the selected-menu only with those users, currently my code looks like this:
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Test block with users select"
},
"accessory": {
"type": "users_select",
"placeholder": {
"type": "plain_text",
"text": "Select a user",
"emoji": true
},
"action_id": "users_select-action"
}
}
I can use static-user-select and add names myself, but this won't let me have "user-status" ("online"/"offline") and sometimes users might increase/decrease dynamically, couldn't find any k/v or more info on doc's, what should be my approach here? thanks!
I have an adaptive card which displays a list of pipelines in a choice set, I want to use the value of the selected pipelines as a messageback to teams on selecting the submit button. How can I access the value of the id of Input.Choiceset?
This is the snippet for Submit Action -
"actions": [
{
"type": "Action.Submit",
"title": "Execute",
"data": {
"msteams": {
"type": "messageBack",
"text": "" (Choiceset value here)
}
}
}
]
This is the Choiceset snippet -
{
"type": "Input.ChoiceSet",
"id": "pipelineSelect",
"choices": "${list}",
"placeholder": "pipelines"
}
There was a recent answer to a similar question that might help. Check out How to echo user select optionset from ChoiceSet using messageBack or imBack? . In addition, it might help to see more info on the CardAction class, as well as this blog post - see the "Card Action in Teams" section which even describes some more advanced messageBack options.
slack button getting cut
bot.reply(message, {
attachments:[
{
title: 'Do you want to interact with my buttons?',
callback_id: '123',
attachment_type: 'default',
actions: [
{
"name":"yes",
"text": "Yes",
"value": "yes",
"type": "button",
},
{
"name":"no",
"text": "No",
"value": "no",
"type": "button",
}
]
}
]
});
If text length is more, Button gets wrapped up with fewer text and rest ends up as ... I got stuck here. Please help to show full text in button.
This is a feature of Slack, not of BotFramework nor of Botkit. The Slack interface simply doesn't allow long button titles. I don't know what the character length limit is, but you appear to be hitting it and it is truncating the text and replacing it with an ellipses.
I would recommend you reach out to Slack via their developer support page, located here, to identify any possible workarounds or solutions.
I trying to find how to put actionable icons on Adaptive cards to use with Microsoft Teams. The aim to replace button with image icon(with all button behavior).
in Adaptive Cards 1.2 any image can have an action, see this example:
{
"type": "Image",
"style": "Person",
"url": "${creator.profileImage}",
"size": "Small",
"selectAction": {
"type": "Action.OpenUrl",
"url": "https://www.google.de"
}
The action can be submit, openUrl etc like other actions. You can find the option in the designer aswell to try it.
I am creating a Post.message to Slack through Python and want to add in a button feature. I want the button to provide a list of serial numbers that are represented by low2 = low["serials"]. This is the code I currently have and it adds the button to the slack message but when I click the button I get an error saying "Oh no, something went wrong. Please try that again." from slackbot. I saw posts saying that most people have to create a bot to fix their problems with buttons but if the button just has to read this variable I assume there is a way around that. Thanks for the help!
"fields": [
{
"title": "Amount Used:",
"value": low1,
"short": 'true'
},{
"title": "Distinct Device ID's:",
"value": out1,
"short": 'true'
},
{
"title": "Total Connection Time (hr):",
"value": data2,
"short": 'true'
}
],
"actions": [
{
"name": "game",
"text": "Serials",
"type": "button",
"value": "serials",
}
],
No, there is no way around it. You must create a Slack App (or "Internal Integration") in order to use buttons in your app. One reason is that you need to tell Slack what URL to call if someone clicks a button (your "Action URL") and that can only by configured as part of a Slack app. Check out this documentation on interactive messages for details.
Regarding your approach. A button will only display one value to the user. If your aim is to let the use choose from a list of serial numbers, you have two options in my opinion:
a) Create a group of buttons, one for each serial number
b) Use an interactive menu to create a drop-down menu for your list
I solved my problem by converting the confirm action button to display the values I wanted.
with open('Count_BB_Serial_weekly.json', 'r') as lowfile:
low = json.load(lowfile)
low1 = low["total_serials"]
low2 = low["serials"]
low3 = '\r\n'.join(low2)
Above is my script that imports the array and reads the values. Below I put the results into the "confirm" pop up button.
],
"actions": [
{
"name": "game",
"text": "Serials",
"type": "button",
"value": "serials",
"confirm": {
"title": "Serial Numbers",
"text": low3,
"ok_text": "Yes",
"dismiss_text": "No"
}
}],