Microsoft Teams Incoming Webhook Button \w File-Link - python

I'm sending a message to a Microsoft Teams channel using incoming webhooks. This works perfectly fine except for the button "Open log" which should open a file via the browser but simply doesn't.
JSON
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Error Log",
"sections": [{
"activityTitle": "Error in integration " + integration_name,
"activitySubtitle": "live stage",
"markdown": True,
"text": message
}],
"potentialAction": [{
"#type": "ActionCard",
"name": "Open log",
"actions": [{
"#type": "OpenUri",
"name": "Open log",
"targets": [{
"os": "default",
"uri": "file://someserver/d$/somefolder/logs/" + logname
}]
}]
}]
}
The result of this webhook call looks like this:
Message via webhook
My problem is, that this button does absolutely nothing. If I use standard websites, even android/iOS URLs, it works like expected.
Any help to solve this is much appreciated! Am I doing something wrong? Is Microsoft Teams blocking file:// links?

Yes, currently we sanitize (block) file:// links as they are a pretty significant security hole (e.g. local executables/batch files). See here for more info.
That said, your use case seems both valid and safe. How would you like it to work while still being secure?

Is there really no way to create a webhook message containing a link pointing to an file like file://myshare/file.htm?
We posting messages with a webhook and we also want to be able to post links to stuff in our companies intranet.

Related

How do I send a gRPC request if there are no proto files?

I recently analyzed the Zenly application via mitmproxy, it turned out that it works on gRPC, I was able to extract the payload of the request. I want to emulate this request using Python with my own parameters. For example, there is such a URL:
https://secret.zenly.rpc.com/co.znly.users.services.sessions.SessionsService/SessionCreate, the request to which sends an SMS with a confirmation code. The payload for calling this function is as follows:
{
"PhoneNumber": "secret",
"device": {
"appVersion": "4.63.14",
"type": "ANDROID",
"osVersion": "12",
"model": "secret",
"acceptLanguages": "en-US;q=1.0",
"coreVersion": "1.96.7",
"appBundle": "app.zenly.locator"
},
"deviceOsUuid": "secret",
"carrierInformations": {
"networkOperatorCode": "25001",
"networkOperatorName": "MTS",
"networkCountryIso": "ru",
"simOperatorCode": "25001",
"simOperatorName": "MTS RUS",
"simCountryIso": "ru"
}
}
So, how to send all this to the server correctly, in serialized (?) a format without Proto-files?
p.s.
grpc_requests and grpcurl did NOT fit
You can reference my answer in this question: How to create GRPC client directly from protobuf without compiling it into java code, it should wrok in python also.

How to get the image/attachments from one message and send them in a new message in a Slackbot using python?

I'm making a slackbot using Python and the bolt and the Webclient api and I can't seem to find any documentation or answers on how to get the attachments (such as images) from one message and send them in a new message. Thanks!
You want to send attachment from one message to another, so I am assuming you are somehow(maybe by capturing 'message' event) loading the payload of original message in your code.
Whenever the message contains an attachment, there is "files" attribute added to it.
https://api.slack.com/types/file
You can fetch the details of files from this attribute and use it in your new message.
The main consideration is the accessibility of the file. If the message was a DM or similar scope, the file will not be accessible to rest of the users.
In case the file is not publicly accessible you can use following api to make it publicly accessible:
https://api.slack.com/methods/files.sharedPublicURL
Here is a sample json:
"file": {
"id": "F0TD00400",
"created": 1532293501,
"timestamp": 1532293501,
"name": "dramacat.gif",
"title": "dramacat",
"mimetype": "image/jpeg",
"filetype": "gif",
"pretty_type": "JPEG",
"user": "U0L4B9NSU",
"editable": false,
"size": 43518,
"mode": "hosted",
"is_external": false,
"external_type": "",
"is_public": false,
"public_url_shared": false,
"display_as_bot": false,
.
.
.
}

Can i build an application in python that will auto populate docusign fields from a google sheet?

I use docusign every day and have set up a google sheet that auto populates the email subject and body.
I'm still having to copy and paste this data into the 'email subject' & 'email message'. See screenshot example.
Is there a way i can reduce this process to the click of a button?
Absolutely. Here's are two rough flows that would be helpful to pursue.
You could make use of the Google Apps Script to push data directly to DocuSign. Downside here is that you'd be writing the code in JavaScript.
You can write a short python app yourself, which uses the Google Sheets API (via python sdk) to retrieve your data, then pass along the appropriate info to the DocuSign eSignature API (via python sdk).
In either case, once you have access to the data you wish to forward to DocuSign, you will want to first authenticate your account to make API requests on your behalf.
Then you can make a request like this:
POST /envelopes
{
"emailSubject": "Please sign these documents",
"emailBlurb": "Thank you for subscribing. Click the link to sign",
"documents": [
{
"documentBase64": "JVBER...iUlRU9GCg==",
"name": "Test Doc",
"fileExtension": "pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"email": "test#test.com",
"name": "Test User",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"numberTabs": [
{
"tabLabel": "PO #",
"locked": "false",
"xPosition": "200",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1"
}
]
}
}
]
},
"status": "sent"
}

Facebook Chatbot postback don't respond

I am working on fb chatbot and use postback in the generic templates buttons. However, there is no response after I click the postback button.
"buttons": [
{
"type": "web_url",
"url": "https://maps.google.com/?q={lat},{lon}".format(lat=store['coordinates']['lat'], lon=store['coordinates']['lon']),
"title": u"店家位置"
},
{
"type": "postback",
"payload": Function.sendGourmetComments + "_{id}".format(id=store["id"]),
"title": u"觀看評論"
},
{
"type": "postback",
"payload": Function.sendStoreHearts + "_{upload}".format(upload=None) + "_{id}".format(id=store["id"]) + "_{push}".format(push=None) + "_{edit}".format(edit=None) + "_{search}".format(search=True),
"title": u"撰寫評論"
}
]
I guess I didn't check the message_postback event, however, I did. I didn't even receive any response from my webhook. So it's kind of mysterious to me what's going on.
It was working fine before, but it doesn't work without change after restart my computer. I am using ngork to expose my server API as callback url.
I've this problem two days ago.
You need the page_messaging facebook's approve to receive it Facebook's approved page_messaging permission

Alexa will not play audio from a stream using lambda and python

I can not for the life of me understand why this isnt working.
Here's my lambda function
def lambda_handler(event, context):
url = "https://prod-65-19-131-166.wostreaming.net/kindred-wcmifmmp3-128"
return build_audio_response(url)
def build_audio_response(url):
return {
"version": "1.01",
"response": {
"directives": [
{
"type": "AudioPlayer.Play",
"playBehavior": "ENQUEUE",
"audioItem": {
"stream": {
"token": "sdfsdfsdfsdfsdf3ew234235wtetgdsfgew3534tg",
"url": url,
"offsetInMilliseconds": 0
}
}
}
],
"shouldEndSession": True
}
}
When I run the test in dev portal. I get a response as I should but its missing the directives.
{
"version": "1.01",
"response": {
"shouldEndSession": true
},
"sessionAttributes": {}
}
Alexa just says "There was a problem with the requested skills response."
Well I think its because the directives arent making it over. But I've tested the stream, it works. It's https. Theres a token. What am I missing?
That response from Alexa means that the skill has returned an invalid response that Alexa doesn't know how to parse.
If you haven't already, you should check your CloudWatch logs for the Lambda function to see if any errors are arising there: https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#
To the best of my knowledge, the developer portal still doesn't display directives, so you don't want to test there. From the developer portal Alexa skill test page:
Note: Service Simulator does not currently support testing audio
player directives and customer account linking.
What you can do to debug further if no errors found in CloudWatch is copy/paste the Service Request from that page and use it as a custom test for your Lambda function. On the Lambda page, click the Actions drop down and select Configure Text Event and paste your request from the developer portal into that. That'll give you a better picture of the response you're returning to Alexa. If you can't figure this out, add that response here and we'll try to puzzle things out a bit more.

Categories

Resources