I'm sending messages with block elements (buttons) to channel using Slack API. How can I get the username displayed when someone approves or rejects the request? I send the message using chat.postMessage.
You should have interactivity enabled for your app. Since you are using buttons you need to reference how to handle interactive components. Essentially, you need to give your buttons an action_id which is it's unique identifier and will help you determine the source of the action (including the user) when the button is clicked. You will parse the action payload that sent to your app to get the user information you need and use that information in a subsequent call to chat.postMessage.
I was having trouble getting the user with the payload, using body instead worked for me:
In Bolt Python:
#app.action("approve_button")
def approve_request(ack, say, body, payload):
# Acknowledge action request
ack()
user_details = body['user']
username = user_details['name']
.....
Related
Azure logic apps 'o365 connector' action 'send approval email' returning null for property 'useremailaddress'. Why?
The Azure logic apps documentation for the 'office 365 outlook connector' shows that the 'ApprovalEmailResponse' object returns 'SelectedOption' and 'UserEmailAddress'. I get the correct value back for 'SelectedOption' but 'UserEmailAddress' always returns 'null'.
https://learn.microsoft.com/en-us/connectors/office365/#approvalemailresponse
How do I get the --> email address <-- of the user that selects 'Approve' or 'Reject' buttons in the email? If an email is forwarded to another person I would like to know who (email address) clicked approve or reject.
***This is what I get if I use the recommended settings mentioned in the replies below. For production we want to set "Use only HTML message" and "Show confirmation dialog" both set to "yes".
After reproducing from our end, we understood that the messages which are recorded as HTML messages aren't capturing all the responses. For this, Make sure you have the below parameters set Hide HTML message to 'yes'.
RESPONSE REQUEST IN OUTLOOK
AFTER RESPONSE HAS BEEN RECORDED
UPDATED ANSWER
Logic App outlook connector:
result:
So... It looks like (in this particular action) the only way to get the email address of the person that clicks approve or reject is to not use HTML and to instead rely on using the action card, that is provided by the logic app action, in the email. With 'Hide HTML message' set to 'yes'. However... I was not able to find a way to render my custom card from the one provided in the email. As a workaround, I use markdown in the body of the action. Not great but looks the same as the HTML version I was going-for. If anyone can figure out how to edit/customize the card that is provided in the email by this specific logic app action. Please... let me and Microsoft (sarcasm) know.
I have an intent with webhook and slotfilling enabled for validation and it have 4 parameters marked as required, so my server can validade the parameter value.
The strategy that I'm trying to use is: reset the context for invalid parameter value, so the dialogflow can ask it again.
Here is an example entering an invalid value:
On responding "Brasília" the webhook makes a request to my server. My server knows that is an invalid value and respond with the context presented on the previous image.
This is the result:
Notice that the first 4 context match with the previous image, its everything ok here. But dialogflow adds another context. That context is a request for the next parameter, called "motivo" and if I respond back, the response will be stored on this param. After this, dialogflow prompts back for the "local" param.
The conversation runs like this:
User: I want to register a call
Dialogflow: From where you want to register? Aracaju, CAB, Itabuna or Salvador?
User: Brasília
Dialogflow: Please, describe the reason
User: My network wireless is not working
Dialogflow: From where you want to register? Aracaju, CAB, Itabuna or Salvador?
...
What was supose to be:
User: I want to register a call
Dialogflow: From where you want to register? Aracaju, CAB, Itabuna or Salvador?
User: Brasília
Dialogflow: From where you want to register? Aracaju, CAB, Itabuna or Salvador?
...
What I need to know: Am'I responding with the correct contexts? Is there a way to prevent dialogflow creating this new "registrar_dialog_params_motivo" after responding with a new contexts?
Obs.: I'm using a Nodejs server, responding the webhook as the docs suggests.
Edit 1: I know that I can use an entity for this situation. However there is some cases that I need to make multiple validations on backend to procede, something like an user id, etc.
If the intent “Intent_Name” has some input_context defined already, then you need to set that context again as output_context and reply something like you have entered an invalid location, and please enter again.
If the intent does not have any input_context, then you can simply reply you have entered an invalid location. Please enter again, and your intent should be able to catch that too. However, this can cause problems as well.
What I would recommend is having another intent “Intent_Name_followup” with an input_context as location_validation_failed in the logic. If the location is incorrect, you can set this in the output_context to reply to the user.
Creating a chatbot using IBM's Watson Assistant, and I need to make a determination I'm trying to send the zip code to a third party API that will return the city and state so I know where the client is located so I can (a) know which services are available and (b) have a better idea on how to direct the conversation from there. But I am at a loss as to how to do this.
I can do this from within Python, but trying to code it in a JSON editor doesn't work.
Webhooks are used to do this from inside the Dialog skill in an Assistant.
IBM Watson Assistant webhooks documentation
The docs do not mention it, but the Assistant will POST to the URL with a JSON body containing the parameters you specify as key value pairs. For example if in the Dialog Node the context variable $zipcode equals '99501' and you specify the parameters "key" = zipcode and "value" = "$zipcode".
Then the HTTP post body is
{ "zipcode" : "99501" }
The response from the service is put into another context variable, and this can then be used for other things. For example in the Dialog Node which calls the webhook, in the "Return variable" section put webhook_result_zipcode to put the response into that context variable.
You can also in the dialog node Assistant responds section, return a message which contains some part of the webhook response. For example in the Dialog Node editor
"If assistant recognizes" $webhook_result_zipcode "Respond with" The code is "$webhook_result_zipcode.response.result.sent" This will tell the user the code which is returned deep within the webhook response in response.result.sent in the response body.
You can also click the Cog next to the response, and in the dialog, click ... next to "Assistant responds" and open the context editor. This opens a context editor (at the top of the dialog) which allows setting of another context variable from part of the webhook response. For example under "Then set context" for "Variable" set zipcode and for "Value" set "$webhook_result_zipcode.response.result.sent.zipcode". This will extract a zipcode value from deep within the webhook response and place it in the context variable zipcode.
Of course then you must find a zipcode location service which accepts a HTTP post and looks for the code in the body.
Hello i'm newbie and im hardly to understand this notification in service-worker, and because my knowledge isn't good yet then probably i will unable to explain my problem clearly.
so here's the code :
// triggered everytime, when a push notification is received.
self.addEventListener('push', function(event) {
console.info('Event: Push');
var title = 'New commit on Github Repo: RIL';
var body = {
'body': 'Click to see the latest commit',
'tag': 'pwa',
'icon': './images/48x48.png'
};
event.waitUntil(
self.registration.showNotification(title, body)
);
});
this is the code that trigger to POP the notification, what I do not understand is where the argument to accept/ receive the data ?
I've been searched a lot: https://auth0.com/blog/introduction-to-progressive-web-apps-push-notifications-part-3/ ,
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web
there's some new data JSON or from git-server or push api, but I still hardly to understand where's to accept the data.
sorry if you still do not understand what's my problem.
Here to make it simple what I want :
Let's say i make a button, and everytime i click the button it will value as 'True' and I want that 'True' value to pass into argument and trigger the push of notication in service-worker.
2nd questions: am I able to trigger notification with header or text in html ? since we can manipulate the text with DOM ?
am I able to trigger notification without GCM, or API cause I just want a simple notification in serivce-worker like above without passing much data.
If you give more advice or maybe notification without service-worker but real time , I am surely happy to read it but I hope Im able to understand.
There are basically two concepts involved that work well together but can be used independently. The first is the visible UI shown to a user that tells them information or prompts them for an action. The second is sending an event from a server to the browser without requiring the user to currently be active on the site. For full details I recommend reading Google's Web Push docs.
Before either of those scenarios you have to request permission from the user. Once permission is granted you can just create a notification. No server or service worker required.
If you want to send events from a server you will need a service worker and you will need to get a subscription for the user. Once you have a subscription you would send it to a server for when you want to send an event to that specific browser instance.
Once you receive a push event from a server you display the UI the same as in the first scenario except you have to do it from the service worker.
We are receiving the following error when I try to create a recipient view. Basically the document is sent to 2 users, one of them has already signed but the other user can not sign because there’s no URL created and sent to us from Docusign. We are using node.js docusign sdk.
var recipientView = new docusign.RecipientViewRequest();
recipientView.setReturnUrl();
recipientView.setUserName();
recipientView.setEmail(;
recipientView.setAuthenticationMethod("email");
recipientView.setClientUserId();
var envelopesApi = new docusign.EnvelopesApi();
envelopesApi.createRecipientView(accountId, envelope.id, recipientView,
function(error, viewUrl, response) {
// no url is returned here.the error (in the image) is shown
});
I printed the values of accountId, envelopeId and those seemed to be fine.I checked if the user had changed his first name, last name and there were no errors there. If I create a new user from scratch everything works fine.
FrontEnd Error
Response Error
Through your screenshots it looks like you are getting an UKNOWN_ENVELOPE_RECIPIENT error returned from the API. This means the recipient data you are sending to identify the recipient is not correct. It needs to exactly match the data you assigned to the recipient when you added them to the envelope, such as name, email, recipientId, and clientUserId.
Try calling the EnvelopeRecipients: List API before you make the request to generate the URL and ensure that the recipient data matches what you are sending in your createRecipientView() request. That should help identify which piece of data is off, once you correct that the call will then start returning the proper URL.
Also see the Embedded Signing features page in the DocuSign Developer Center which shows exactly which params you need to set etc: