whatsapp business api not displaying public image urls in chat - whatsapp

I'm testing whatsapp business api image section, it seems like the images available at platform are the ones which are getting displayed and no other images which I pick from s3 bucket or google images.
message = {"type": "image",
"previewUrl": "https://cdn.shopify.com/s/files/1/0445/8545/1685/products/2_9082b428-a7fa-4648-84b5-b34cc1fea9a1_360x.png",
"originalUrl": "https://cdn.shopify.com/s/files/1/0445/8545/1685/products/2_9082b428-a7fa-4648-84b5-b34cc1fea9a1_360x.png",
"caption": "some caption",
"filename": "Sample.jpeg"}
headers = {
'Cache-Control': 'no-cache',
'Content-Type': 'application/x-www-form-urlencoded',
'apikey': 'mykey',
'cache-control': 'no-cache',
}
the above used url doesn't seem to be displayed in chat whereas https://www.buildquickbots.com/whatsapp/media/sample/png/sample01.png comes fine

Related

Linkedin versioning Marketing API - isDSC returns True by default

I'm trying to use Linkedin versioning (the new approach) Marketing API to publish posts on the company page.
I'm following the official docs and trying to use provided example:
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api
Here is my request:
content = "x"
headers = {
"Authorization": f"Bearer {self.access_token}",
"X-Restli-Protocol-Version": "2.0.0",
"LinkedIn-Version": "202207",
"Content-Type": "application/json",
}
author = f"urn:li:organization:{self.page_id}"
data = {
"author": author,
"commentary": content,
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": False,
}
response = requests.post("https://api.linkedin.com/rest/posts", headers=headers, json=data)
return response
But I get the error:
{"errorDetailType":"com.linkedin.common.error.BadRequest","code":"MISSING_REQUIRED_FIELD_FOR_DSC","message":"Field /adContext/dscAdAccount is required when the post is a Direct Sponsored Content, but missing in the request","errorDetails":{"inputErrors":[{"description":"Field /adContext/dscAdAccount is required when the post is a Direct Sponsored Content, but missing in the request","input":{"inputPath":{"fieldPath":"/adContext/dscAdAccount"}},"code":"MISSING_REQUIRED_FIELD_FOR_DSC"}]},"status":400}
I don't want to use DSC at all. But cannot disable it since isDsc field is read-only.

Jira REST API for configuring dashboard gadget

My goal is to create dashboard gadgets automatically and programatically.
I tried to create dashboard gadget, Filter Results, using jira rest api (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-dashboards/#api-rest-api-3-dashboard-dashboardid-gadget-post). However, there isn't any parameters to set 'Saved filter', 'Number of results' or 'Columns to display' for Filter Results gadget in the api. The only thing I can do with the api is create an empty gadget.
How can I configure gadgets using api?
ScriptRunner has some support for this
https://scriptrunner.adaptavist.com/latest/jira/recipes/dashboard-gadgets.html
Not an official one, but 100% work.
End point: /rest/dashboards/1.0/{dashboardId}/gadget/{gadgetId}/prefs
Method: PUT
Example payload:
{
"up_isConfigured": true,
"up_num": "20",
"up_refresh": "false",
"up_columnNames": "issuetype|issuekey|summary|priority|assignee",
"up_filterId": "10001"
}
I use jira api, set dashboard item properties, to configure gadgets (dashboard item).
payload = json.dumps({
"filterId": "10711",
"num": "50",
"columnNames": "issuetype|summary|issuekey",
"refresh": "true",
"isConfigured": "true"
})
res = requests.request(
"PUT",
f"{HOST}/rest/api/3/dashboard/{dashboard_id}/items/{item_id}/properties/config",
headers={
"Accept": "application/json",
"Content-Type": "application/json"
},
data=payload,
auth=HTTPBasicAuth(EMAIL, TOKEN)
)
Thanks for the answer from Atlassian Community.

HTTP Response Error with Post to LinkedIn using Share API v2

I am trying to post a Share to LinkedIn using OAuth v2 - I have got authorisation correctly and have the appropriate access keys.
This code is supposed to share a link on LinkedIn, but for some reason it's not working - I'm not sure why. Can anyone help?
this is my request body:
{
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:XXXXXX",
"subject": "Test Share Subject",
"text": {
"text": "Hello !"
}
And this my call API shares :
publishPostLink(body : any, token : any){
this.headers = new HttpHeaders(
{
'Content-Type': 'application/json',
'Authorization':'Bearer '+token,
'cache-control': 'no-cache',
'X-Restli-Protocol-Version':'2.0.0', });
return this.http.post("https://api.linkedin.com/v2/shares" , body, {headers: this.headers});}
I get this issue:
I've already installed the Moesif CORS and it didn't worked
I fixed the error using this post..
it should use REST API from the backend and not from frontend
http://localhost is an insecure request origin so its not supportted in many cases.
Try using tunneling software like Ngork https://ngrok.com/

How to make POST request with __RequestVerificationToken header in Postman

I want to send a POST request with Postman to receive back information from a database with a list of elements.
Case:
On a Home page, I have a search engine when I'm choosing parameters. URL://example.com
I'm clicking button: Display on a list URL://example.com
I'm receiving list with searched elements URL://example.com/Search/Result
Fist Test
Method: Post
URL: example.com
Headers: Content-Type - application/json
Temporary Headers: which include : __RequestVerificationToken
Body:
{
"options": "1",
"IsMember": "false",
"ID": "2",
"btnShowList" : "true"
}
Result:
Status: 200,
But in a body I have HTML of whole home page, so probably post was not executed
Second Test
Method: Post
URL: example.com/Search/Result
Headers: Content-Type - application/json
Temporary Headers: which include : __RequestVerificationToken
Body:
{
"options": "1",
"IsMember": "false",
"ID": "2",
"btnShowList" : "true"
}
Result:
Status: 404, Not Found
Questions:
Is it possible to do the post if in URL is no query parameres?
Any idea how can I write such a test case?
Have anyone writes post method with dynamic parameters such as eg. __RequestVerificationToken
Receiving an HTML in response is totally normal, especially if the technology used is ASP.net WebForms for instance.
To answer some of your questions: It is possible to make a post with no query params. All you need to do is hit the correct url with the expected body

How to load search params to Leankit Post request from Google Apps Script

I have set up a working api call using Postman that returns the information that I want to return. I need to set up the same API call using google apps script but for some reason the search params are not loading. The api response gives the same result as the Postman response was without any search params being loaded.
My code so far is shown below. I've tried removing and adding back different settings in various orders but haven't found anything that finds the card related to the search term that I used.
function cardSearch(part) {
var settings = {
"method": "POST",
"contentType": "application/json",
"headers": {
"async": true,
"crossDomain": true,
"Authorization": "Basic *********",
"User-Agent": "PostmanRuntime/7.15.0",
"Accept": "*/*",
"Cache-Control": "no-cache",
"Postman-Token": "************",
"accept-encoding": "gzip, deflate",
"contentLength": "60",
"Connection": "keep-alive",
"cache-control": "no-cache"
},
"payload": JSON.stringify({"searchOptions": { "SearchTerm": part, "Page": 1 } })
// part is loaded into this function as a variable
}
var url = "https://**********.leankit.com/kanban/api/board/********/searchcards";
var response = UrlFetchApp.fetch(url,settings);
Logger.log(response);
var result = JSON.parse(response.getContentText());
var results = result.ReplyData[0].Results;
Logger.log(results);
}
Expected Result:
JSON describing 1 or more cards titled or header'd with the search term of my choosing if one exists.
Actual Result:
JSON describing the first 20 cards that were uploaded to the leankit board I'm referencing.
{TypeName=Test, ClassOfServiceId=0, Size=1, BlockReason=null, IsOlderThanXDays=true, SystemType=Card, Index=139, ActualStartDate=9/12/2018 4:11:09 PM, DrillThroughStatistics=null, CreateDate=9/10/2018, PriorityText=High, StartDate=9/12/2018, CurrentTaskBoardId=*****, ExternalCardIdPrefix=null, LastComment=null, AssignedUserIds=[******], CardTypeIconColor=212121, Version=84, LaneTitle=Finished As Planned, DrillThroughBoardId=null, Tags=Testing, SmallGravatarLink=********, ClassOfServiceCustomIconName=null, TypeId=*******, ClassOfServiceIconPath=null, DrillThroughProgressSizeComplete=null, ParentBoardId=0, Priority=2, Color=#0084FF, CurrentContext=Tasks, ExternalCardID=Material Testing, AssignedUsers=[{AssignedUserId=*********, AssignedUserName=*********, FullName=******** *****, Id=********, EmailAddress=******#*****.com, GravatarLink=*********, SmallGravatarLink=**********}], GravatarLink=********, DrillThroughProgressComplete=null, HasDrillThroughBoard=false, Active=false, ExternalSystemName=null, ExternalSystemUrl=null, Icon=, Id=********, DrillThroughCompletionPercent=null, CountOfOldCards=0, Description=<p>***********</p>, AssignedUserId=*******, ClassOfServiceTitle=null, LastAttachment=null, BoardId=**********, TypeColorHex=#0084FF, ActualFinishDate=9/15/2018 8:28:55 PM, HasMultipleDrillThroughBoards=false, CardDrillThroughBoardIds=[], TypeIconPath=null, ClassOfServiceColorHex=null, BoardTitle=********, TaskBoardTotalCards=3, DueDate=09/19/2018, DrillThroughProgressSizeTotal=null, IsBlocked=false, ParentCardId=null, ParentCardIds=[], AssignedUserName=******, TaskBoardCompletedCardSize=11, Title=Test Card, ClassOfServiceCustomIconColor=null, ParentBoardIds=[], CardTypeIconName=blank_icon, LastActivity=09/18/2018 03:28:55 PM, AttachmentsCount=0, DrillThroughProgressTotal=null, TaskBoardCompletionPercent=100, TaskBoardTotalSize=11, Type={Id=********}, CommentsCount=0, DateArchived=01/15/2018, LaneId=********, ParentTaskboardId=null, LastMove=09/16/2018 04:18:34 PM, TaskBoardCompletedCardCount=3, BlockStateChangeDate=null}
You need to put both the keys and values of the JSON request in quotes, as specified in the documentation E.g. 'method':'post'
Everything that is not a valid parameter for options for UrlFetchApp.fetch() goes into headers or payload - depending on the required syntax of the API you are calling. In particular: async and crossDomain belongs into headers, while everything inside data should be assigned to payload
The documentation for the request you are using specifies that the page number should not be in quotes
Those questions might be helpful for you:
https://stackoverflow.com/a/35155175/11599789
Unable to send Post Request on Google Apps Script