Unable to set action for mobile and web platform - php

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
}
}
}
}

Related

Send Current URL link to A Discord Webhook

So, basically I need a way to send the current URL link to A Discord webhook.
So for example, the URL would be https://www.example.com and I need that link to send to my Discord webhook.
Is there any way someone could help me with this? If this is not possible, are there any alternative methods?
I would recommend you first reading this—it explains in detail how to format the payload so that it renders as a message in Discord properly, you can even use markdown!
Second, I'm not sure what language you want to code this in, but here's a simple example using Python and httpx
The idea to take away here is
Pick a client library
Study the Discord webhook message format
Create a client for HTTP
Set the logic to send the payload to the webhook you want
Create and send the payload with the formatted webhook message in a POST request
data = {
"username": "Webhook",
"avatar_url": "https://i.imgur.com/4M34hi2.png",
"content": "Text message. Up to 2000 characters.",
"embeds": [
{
"author": {
"name": "Birdie♫",
"url": "https://www.reddit.com/r/cats/",
"icon_url": "https://i.imgur.com/R66g1Pe.jpg"
},
"title": "Title",
"url": "https://google.com/",
"description": "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
"color": 15258703,
"fields": [
{
"name": "Text",
"value": "More text",
"inline": true
},
{
"name": "Even more text",
"value": "Yup",
"inline": true
},
{
"name": "Use `\"inline\": true` parameter, if you want to display fields in the same line.",
"value": "okay..."
},
{
"name": "Thanks!",
"value": "You're welcome :wink:"
}
],
"thumbnail": {
"url": "https://upload.wikimedia.org/wikipedia/commons/3/38/4-Nature-Wallpapers-2014-1_ukaavUI.jpg"
},
"image": {
"url": "https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg"
},
"footer": {
"text": "Woah! So cool! :smirk:",
"icon_url": "https://i.imgur.com/fKL31aD.jpg"
}
}
]
}
import httpx # pip install httpx, or poetry add httpx
with httpx.Client() as client:
request = client.post("https://www.discordwebhook.com", data=data) # needs to be a POST
print(request.status_code)

How to hide the address bar in android app using trusted web activity

I have tried to convert codeigniter application into android app using trusted web activity .I have generated debug and release APK .I cannot hide address bar in app. I have put assetlinks.json file in .well known folder of application . It is not working .
This is my assetlinks.json
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.consultantnext.dmatri",
"sha256_cert_fingerprints":
["37:A8:DB:2C:EC:43:65:A9:3C:2A:60:88:16:8A:7A:07:BA:59:A7:7C:63:8C:57:4E:E2:52:40:46:DA:0E:65:AE"]
}
},
{
"relation": ["delegate_permission/common.get_login_creds"],
"target": {
"namespace": "web",
"site": "https://dmatri.consultantnext.com"
}
},
{
"relation": ["delegate_permission/common.get_login_creds"],
"target": {
"namespace": "android_app",
"package_name": "com.consultantnext.dmatri",
"sha256_cert_fingerprints":
["37:A8:DB:2C:EC:43:65:A9:3C:2A:60:88:16:8A:7A:07:BA:59:A7:7C:63:8C:57:4E:E2:52:40:46:DA:0E:65:AE"]
}
}]
I need to hide the address bar before uploading it into playstore. How to hide the address bar?

Create an Ad Creatives over LinkedIn API V2 not working

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.

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