From My application sending message in slack using chat.postmessage with a button inside json request. but when user clicks on button from slack it's not returning response on request URL.
https://api.slack.com/messaging/interactivity/enabling#responding_to_interactions
As mentioned here in above link, i have set the structure. set Request URL and also actions with callback id. in my app also set request URL method. i have checked that my application's request URL is working fine.
In attachment parameter passed json as below
[
{
"text": "Are you want to turn of this messages?",
"fallback": "You are unable to turn off",
"callback_id": "turn_off_message",
"attachment_type": "default",
"actions": [
{
"name": "turnoff",
"text": "Turn Off",
"type": "button",
"value": "turnoff"
}
]
}
]
Once user click on Turn Off button, need a response on Request URL which i have set in Interactive Component.
Related
Is there any way to pass response object values from first request to second request as input parameters in graph batch request (2nd request is dependant on 1st request - graph/json-batching)
In the following request, the client is specifying that requests 1 should be run first, then request 2.
2nd Request need the id from the 1st Request's response as URL variable. What is the way to achieve it?
JSON
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/users/<upn>?$select=id"
},
{
"id": "2",
"dependsOn": [ "1" ],
"method": "GET",
"URL": "users/<id from the 1st request>/presence"
}
]
}
Yes, As #Tiny-wa said this is not possible as of now. There is already a feature request raised in the Microsoft Graph Feedback Forum, please upvote it so that the product team may implement it in future.
So, for now you need to make two separate requests, make first request and get response details and use it and make a second request.
I am attempting to build out a process that will do the following:
New contact lands in my CRM (Podio)
The CRM is triggered to send a POST containing a custom parameter to Twilio which will then initiate a flow
The Twilio flow will call my cell and prompt me to connect to the new contact
Once I press 1, it will take the custom parameter (new contact's phone number) and connect
me to them.
So far, I have been able to get 1-3 with no problem.
However, according to the the API documentation from Twilio I should be able to pass a 3rd parameter in the JSON body of my HTTP request containing custom "Parameters". When I attempt this the parameters aren't showing in the Twilio studio logs and thus I am unable to connect the call to the new lead.
This is the JSON body I am sending over to my Twilio Flow's API
{
"To": "+1xxxxxxxxx1",
"From": "+1xxxxxxxxx2",
"Parameters": {
"name": "example name",
"prospectphone": "+1xxxxxxxxx3"
}
}
When I view the logs in Twilio this is what I received.
{
"contact": {
"channel": {
"address": "+1xxxxxxxxx2"
}
},
"trigger": {
"request": {
"from": "+1xxxxxxxxx2",
"to": "+1xxxxxxxxx1",
"parameters": {}
}
},
"widgets": {},
"flow": {
"flow_sid": "FW936f72c0eb8d3945d0d55c62465e37a8",
"data": {},
"channel": {
"address": "+1xxxxxxxxx2"
},
"sid": "FN955cdb12827f84c8af8fc9b5264e5a28"
}
}
I really can't figure out what I'm missing here? Has anyone run into this before? Is this something you can only do if you're using the SDK or does the additional parameter need to be passed in some other way?
It should be sent x-www-form-urlencoded.
From the documentation:
"Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string."
Trigger a Twilio Studio Flow Execution via the REST API
I'm trying to implement following:
python script sends message to slack with button and payload,
user clicks on button in the slack message,
button sends POST with payload to Request URL (aws api)
Currently button doesn't send POST.
I forge message with following python script
slack_token = 'xoxp-1111-111-111-qqqqqq'
sc = slack.WebClient(slack_token)
sc.chat_postMessage(
channel="QQQQQ",
blocks=[
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "send post"
}
}
]
}
]
)
I added https://here.aws.api.amazonaws.com/default/lambda as "Request url" in the "Interactive Components" and "Event Subscriptions" of my slack app.
When I send message to bot POST request is sent to aws api.
When I click button POST request is not sent.
Tried with both tokens xoxp- and xoxb-
The problem is:
slack generates http request in strange way. Instead of json, it puts "blocks" into following structure:
{ ...... 'body': (byte[])\"payload=%7B%22type%22%3A%22block_actions%2 ...}
after decoding it is equal to:
{...payload={"type": "block_actions",...}
That isn't readable like json.
AWS API rejected these slack requests.
AWS cloudwatch helps to investigate problem.
To avoid this is necessary to enable "Use Lambda Proxy integration" option during method adding.
I am sending the users a slack message with a button through a Slack App. On every click of the button, I generate a new URL.
At the moment, I am able to return the URL back as a message. The user clicks on the message to open the URL in the browser.
Instead of the sending a message back, I want to open the URL directly in the browser using slack API.
How can I accomplish it? I can't seem to find anything in the documentation that does that.
Thanks
PS: Google Drive integration does that already.
It appears Slack introduced this feature recently.
As documented in https://api.slack.com/docs/message-attachments#link_buttons
"actions": [
{
"type": "button",
"text": "Book flights 🛫",
"url": "https://flights.example.com/book/r123456"
}
It's possible to preview in Slack's interactive message builder
Unfortunately slack does not support opening urls from message buttons.
You can monitor what slack is planning on releasing here though: https://trello.com/b/ZnTQyumQ/slack-platform-roadmap-for-developers :)
According to Slack, message attachments is the "old way" of composing messages, which will be deprecated in favour of the new Block Kit API.
I found this example on how to do button links on their docs, using the actions object in the message payload.
I haven't implemented it yet, but you can send the message to a channel in your workspace straight from the docs and try it, and it does open the link in the browser as expected.
Update 04/2022
{
"blocks": [
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View",
"emoji": true
},
"style": "primary",
"url": "https://flights.example.com/book/r123456"
}
]
}
]
}
Test on Slack Blockit Builder: Link
I'm using a webhook to post messages to Slack via PowerShell script and I'd like to include a link to a network folder. I was able to do it with
<file://server/folder|files>
however when the generated 'files' link is clicked nothing happens. Is there a way to specify target so that a clicked link opens in a new window? If I copy the generated link and paste it into the browser, the index is rendered just fine and that would be sufficient for my purposes. Are there any alternative solutions?
You may have some success with Slack's Link Buttons, which specifically open links in new browser tabs when clicked.
{
"text": "Test Link Buttons",
"channel": "C061EG9SL",
"attachments": [
{
"fallback": "Test link button to file://server/folder",
"actions": [
{
"type": "button",
"name": "file_request_123456",
"text": "Test",
"url": "file://server/folder",
"style": "primary",
"confirm": "Really?"
}
]
}
]
}
Slack Message Builder example