Create an Ad Creatives over LinkedIn API V2 not working - php

I use the api version 2.0 and want to create an ad creatives https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-creatives#create-a-sponsored-content-share
PHP Code
POST https://api.linkedin.com/v2/adCreativesV2
{
"campaign": "urn:li:sponsoredCampaign:XXXXXXXX",
"reference": "urn:li:share:XXXXXXXXXXXXX",
"status": "ACTIVE",
"type": "SPONSORED_STATUS_UPDATE",
"variables": {
"data": {
"com.linkedin.ads.SponsoredUpdateCreativeVariables": {
"directSponsoredContent": true,
"share": "urn:li:share:XXXXXXXXXX",
"activity": "urn:li:activity:XXXXXXXXXXX"
}
}
}
}
API response
{"message":"Your application is not configured to access the related advertiser account(s), please ensure you have added the account ID(s) in your Account Management list.","status":403}
Any idea, How to fix this error?

Try with an empty object for the SponsoredUpdateCreativeVariables variable as in the example in the doc:
{
"campaign": "urn:li:sponsoredCampaign:XXXXXXXX",
"reference": "urn:li:share:XXXXXXXXXXXXX",
"status": "ACTIVE",
"type": "SPONSORED_STATUS_UPDATE",
"variables": {
"data": {
"com.linkedin.ads.SponsoredUpdateCreativeVariables": {}
}
}
}

There is no issue with the request, you are using Ad account id which don't have access to your developer application, been faced the same issue. You need to add your account id in the developer application. its working for me.

Related

PayPal Smart buttons patch order via PHP API

I'm implementing Smart Buttons with Express checkout, so customers can select the delivery address on Paypal's popup. As agreed with Paypal support, I'm doing the communication with Paypal servers via PHP instead of Javascript. So in the onShippingChange event, I'm calling my server to calculate the delivery price and patch the order so Paypal updates the delivery price. The success path works fine, I need your help on error case(s).
How the patch request shall look like to instrument Paypal to display the warning that my webshop is not delivering to the selected location? (When implementing on Javascript, this was the return actions.reject in the onShippingChange.)
Thanks!
This is the patch request of a successful patch:
{
"path": "/v2/checkout/orders/xxxxxxxxxxxxxxxxxxxxx?",
"body": [
{
"op": "replace",
"path": "/intent",
"value": "CAPTURE"
},
{
"op": "replace",
"path": "/purchase_units/#reference_id=='default'/amount",
"value": {
"currency_code": "GBP",
"value": 265.95,
"breakdown": {
"item_total": {
"currency_code": "GBP",
"value": 236
},
"shipping": {
"currency_code": "GBP",
"value": 29.95
}
}
}
}
],
"verb": "PATCH",
"headers": {
"Content-Type": "application/json"
}
}
in the onShippingChange event, I'm calling my server to calculate the delivery price and patch the order
Great. But if the address is unsupported, your server must return the failed status in its response to that call. Based on that response, onShippingChange must return actions.reject() to the calling PayPal JS.

shareable link of messanger using facebook graph api

I am using a Facebook graph to fetch comments on particular posts. The response is something like this
{
"data": [
{
"message": "43211234",
"created_time": "2021-01-09T05:33:14+0000",
"from": {
"name": "USER NAME",
"id": "USER ID"
},
"id": "COMMENT ID"
}
],
"paging": {
"cursors": {
"before": "M...",
"after": "M.."
},
"next": "https://graph.facebook.com/v9.0/10...."
}
}
the response looks good, but I also want a shareable messenger link of the user who has commented so that I can talk to that person later. is there any solution for this? I searched for it but could not find any solution.

Unable to set action for mobile and web platform

We are using Airship API to send push notification on mobile and web platforms and for deep linking we are using action like
"notification": {
"actions": {
"open": {
"type": "deep_link",
"content": "https://www.urbanairship.com/settings",
}
}
}
and web action is:
"notification": {
"actions": {
"open": {
"type": "url",
"content": "http://www.urbanairship.com"
}
},
}
Above parameters working well as individually but we want to use both parameters together like in attached screen shot "screenshot.png". We didn't find any solution on documentation that show how to use deep linking and web action together same as attached screen shot. So could you suggest us how to merge these parameters so that we can use deep linking action for mobile devices and web action for websites together?
I have solved this and may be useful for someone.
Here's an example payload:
{
"audience": "all",
"device_types": ["ios", "android", "web"],
"notification": {
"alert": "Opening this message will open a defined deep link.",
"actions": {
"open": {
"type": "deep_link",
"content": "prefs", // for mobile platform
"fallback_url": "https://airship.com" // for web platform
}
}
}
}

PHP Messengerbot : Stuck User during test

I working on a BotMan based Messenger chatbot. I set up everything, tried to test out, everything went fine, but I got stuck.
I wanted to send an image as a response from my bot to my Facebook profile. It sent the image, but after it I got stuck: It tries to send the message again and I see in nGrok, that I have an 500 error request from my webhook.
I tried the following:
comment out the code to debug
restart the webserver
restart nGrok and set up a new webhook with the new address
restart computer than do the earlier
Nothing is helped from the following. With other Facebook profile I can "speak" with it (I got the good responses for my test cases), but the first profile is stuck. How to "unstuck" it?
EDIT:
This is the object, what tries to send, but gains error 500:
{
"object": "page",
"entry": [
{
"id": "1718785685111526",
"time": 1518649220812,
"messaging": [
{
"sender": {
"id": "1718785685111526"
},
"recipient": {
"id": "1702775193145548"
},
"timestamp": 1518641306603,
"message": {
"is_echo": true,
"app_id": 813542108832080,
"mid": "mid.$cAAZBynpFHa9nx1ij61hlhNatNiJj",
"seq": 353844,
"attachments": [
{
"type": "image",
"payload": {
"url": "https://scontent-ort2-2.xx.fbcdn.net/v/t34.0-12/28001431_2003444363312322_578145807_n.jpg?_nc_ad=z-m&_nc_cid=0&oh=7088ad6e09a1c9851a967c8193ea3bf4&oe=5A871570"
}
}
]
}
}
]
}
]
}

Docusign not hitting webhook URL

I'm trying to use webhooks, but no events are being sent to my application via the webhook url. So far I was able to configure and send correctly envelopes with enough information to monitor status, but when things changes in the envelopes, nothing happens, I mean, no requests are made to my webhook URL, at all.
My app is doing good, so if I manually hit (GET) https://subdomain.app.com/docusign/webhook, it works fine and it shows both on my app log and Nginx log. But viewing, signing and completing documents/envelopes are not generating events to the webhook url.
I noticed that, in the examples, the events are capitalized for recientEvents, but not for envelopeEvents, is this right?
Is there anything else to be configured?
Is is possible to see this information in the Docusign web interface (https://account-d.docusign.com/logout#/username)? I would like to check if this data is correctly set in the envelope.
Here's the envelope request (minus some data):
{
"documents": [{
"documentId": 1,
"name": "XXXXXXXXX.pdf",
"documentBase64": "XXXXXXX"
}],
"recipients": {
"signers": [{
"tabs": {
"signHereTabs": [{
"documentId": 1,
"recipientId": 1,
"pageNumber": 1,
"anchorString": "recipient_signature"
}]
},
"name": "XXXXXX",
"email": "XXXX#XXXX.co",
"recipientId": 1,
"clientUserId": XXXX
}]
},
"eventNotification": {
"url": "https:\/\/subdomain.app.com\/docusign\/webhook",
"loggingEnabled": "true",
"envelopeEvents": [{
"envelopeEventStatusCode": "sent"
}, {
"envelopeEventStatusCode": "delivered"
}, {
"envelopeEventStatusCode": "completed"
}, {
"envelopeEventStatusCode": "declined"
}, {
"envelopeEventStatusCode": "voided"
}, {
"envelopeEventStatusCode": "sent"
}, {
"envelopeEventStatusCode": "sent"
}],
"recipientEvents": [{
"recipientEventStatusCode": "Sent"
}, {
"recipientEventStatusCode": "Delivered"
}, {
"recipientEventStatusCode": "Completed"
}, {
"recipientEventStatusCode": "Declined"
}, {
"recipientEventStatusCode": "AuthenticationFailed"
}, {
"recipientEventStatusCode": "AutoResponded"
}]
},
"status": "sent",
"emailSubject": "XXXXXX",
"brandId": "XXXXXXXXXX"
}
EDIT:
Entering Connect -> Log/Failures looks like the system is not really performing as it should, because sometimes I get
And some other times I get an empty list. Going in the publish option, when it's working I get a list of documents/envelopes, and I see the last envelope I sent there, which looks fine.
You can view your recent connect logs/failures at the Docusign Admin web application. See instructions to use the Admin site here
If your connect messages were not sent, to the listener URL you provided, they should show up in the failures section.
API : You can also view your connect logs/failure using the connectEvents api's
Here is some documentation for troubleshooting connect issues.
The capitalization of status codes is not an issue. They are case insensitive.

Categories