Tableau Image Response Into ADF - azure

I'm using the Tableau REST API to get an image of a workbook view.
Testing the endpoint in Postman, I get the image perfectly fine back and the Content-Type is "image/png". Now I want to send that same image to an email with an ADF pipeline, the response I get seems to be binary from the Web activity:
"{ Response": "�PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0003�\u0000\u0000\u0003 ...})
I've been seeing online that the above response is of : "application/octet-stream". Even though the content-type response is of "image/png" in the response in ADF AND Postman.
So I create another web activity which is a Send Email Web activity. In the body, I send the data in a JSON format to a Logic App Send email task.
I want to embed the image into the email using the "img" HTML tag. I set the response of the Tableau image and send it with basee64 encoding:
#json(concat('{"emailAddress": "myemail#email.com", "subject": "Tableau Data","messageBody":"<img src=\"data:image/png;base64,',base64(activity('Get View').output.Response),'\" >"}'))
Once it sends it, I get no image at all.
What do I need to do in order to get the image on the email? I feel like I'm missing some encoding to the response or do I need to save it first to a storage blob and then send from there?

Related

Add sample image in template header in whatsapp cloud API

I am doing a project using WhatsApp cloud API. I need to create a template with a media header. I have created a template with a media header without a sample image and it gets rejected. So I want to create a template with a sample image in Node JS.
Template with a media header
Add sample image for a template
curl -X POST "https://graph.facebook.com/v14.0/{whatsapp-business-account-ID}/message_templates
?name={template-name}
&language=en_US
&category=TRANSACTIONAL,
&components=[{
type:BODY,
text:{message-text}
},
{
type:HEADER,
format:IMAGE,
example:{header_handle:[{uploaded-image-file-url}]}
}],
&access_token={system-user-access-token}"
I want to add a sample image using Node JS (Not manually like the second picture).
header_handle requires a encrypted file upload provided by facebook.
This can be done by calling 2 apis.
First,
We have to create a session for the file to be uploaded.
For creating session refer this
After creating session, we will get session id to upload the original file to it.Response will look something like this:
{"id":"upload:MTphdHRhY2htZW50Ojlk2mJiZxUwLWV6MDUtNDIwMy05yTA3LWQ4ZDPmZGFkNTM0NT8=?sig=ARZqkGCA_uQMxC8nHKI"}
Second,We have to upload the file to
https://graph.facebook.com/v14.0/{above_id}
This will give a response something similar to
{"h":"2:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI"}
Finally,
{header_handle:["2:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI"]}
Should be added during the request to create template.
It worked for me.
See this for better understanding on how to do it.
The answer Provided by Aravindh is correct, you can follow This document from Meta to upload the Image you want.
Just make sure you use a supported type by WhatsApp API ( For WhatsApp Business Platform Cloud API , For WhatsApp Business Platform On-Premises API ) and the upload end point (file-type — The file's MIME type. Valid values are: image/jpeg, image/jpg, image/png, and video/mp4
)
Double Check if you are following exacly the types supported, for example in case of png, you need to set "file_type" to "image/png" no just "png" when creating the upload session.
I have tested it and it works for me.
Hope this helps

How to submit "form-data" in ADF "Web" activity POST call

I am trying to move data from a RESTFul API running on my on-prem application to ADB with ADF. I have installed self-paced IR in my private network to run the activity/pipeline. Now in one of my
API requires form-data to submit in POST call. Equivalent Postman looks like below
How to perform the same in ADF (As I will be running in self-paced IR dataflow is not applicable)? I am trying with "Web" Activity but dont know how to pass form data in it.
You are unable to pass form data in your ADF's Web Activity as you have selected incorrect method in Web activity:
You can select POST method from the dropdown as such:
After this you will get a place to add request body.
Also to get same effect of selecting form-data in postman, you can set 2 cookies as:
Content-Length: length of your request body in bytes
Content-Type: multipart/form-data; boundary= some value as boundary
Content-Type header reference

Downloading attachment from card at Trello Python3

I've got a problem that unables me to download attachment.
Via API I can Upload file as attachment, but instead of authorising via Oauth, I can get attachment, by it's ID, i got accept, but I cannot in response got any answer.
The way I do:
response = requests.get(f'https://api.trello.com/1/{card_id}/attachments/{id_of_attachment}', header, allow_redirects=True, auth=self.o_oauth)
header is dictionary which is:
empty,
or authorisation,
or authorisation and "fields": url_of_attachment
On every of this questions to Trelo I got access, and 200 Response. But in response there was no place where I could find my file (I'm uploading this in the same test, and I got accept).
Where, and how should I look for content?

How to attach a base64 png image in the slack bot's response? [duplicate]

I have integrated Slack API using cURL in my project.
I want to send an image as my attachment. It works while sending full image path in image_url. But when I convert that image to base64 string and then pass it with image_url it doesn't go as attachment.
So basically I want to post base64 string as my image attachment. Because I don't want to store the image on my server.
{"attachments":
[
{
"fallback": "Required text summary of the attachment that is shown by clients that understand attachments but choose not to show them.",
"image_url":"",
"text":"",
"color":"#7CD197"
}
]
}
You can not submit a full image as attachments, only URLs to an image.
If you want to upload an image to Slack you can do so by using files.upload. Here is a curl example for uploading a GIF image from the Slack documentation:
curl -F file=#dramacat.gif -F channels=C024BE91L,#general -F token=xxxx-xxxxxxxxx-xxxx https://slack.com/api/files.upload
An alternative is to use an image hoster (e.g. http://imgur.com) to upload and store your image (through their API). Then you can include the image URL in your attachment.
I personally prefer the second option, since its more flexible to include image URLs in messages and images then do not reduce your precious storage space on Slack.

Slack bot send an image

I am developing a bot for slack. I am implementing a notification functionality, where it will send a notification for every one hour. Currently, I am sending normal text in notification, but I need to send an image along with text. Is it possible to send an image?
You can send images as part of the attachments of a message. That can be either a full image or a thumbnail.
Just add the image_url property for full images or the thumb_url property for a thumbnail image with a url to an image to your attachment and it will be displayed under your message. You can also send multiple images through adding multiple attachments.
Example attachment: (based on official Slack documentation example)
{
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"text": "Optional text that appears within the attachment",
"image_url": "http://my-website.com/path/to/image.jpg",
"thumb_url": "http://example.com/path/to/thumb.png"
}
]
}
This works with all approaches for sending message, e.g. API method, Incoming webhook, response to slash commands etc.
See here for the official Slack documentation for attachments.

Resources