How to send pushes with "conditions" to pushwoosh with remote API? - pushwoosh

I use the pushwoosh remote API and I can send pushes to all users and to just one device, good!
But now Im trying to be able to send pushes to different groups and Im trying to get "conditions" to work. But Im missing something and I don´t know what!
I have first created a tag called "Grupper" as a listtag at pushwoosh.
And it is registering the value "5A" at pushwoosh from the app.
And this is how I try to send a push from my server.
var tags="5A"
var data = {
"request": {
"application": applicationId,
"auth": authKey,
"notifications": [{
"send_date": "now",
"ignore_user_timezone": true,
"content": {
"en": pushtext
},
"conditions":["Grupper", "EQ", tags]
}]
}
};
And here its the "conditions" that is wrong somehow?
If I remove the row with "conditions" then it sends a push to all users, but if I use it, it sends nothing. No errors.
Any input really appreciated, after a couple of days trying, I still don´t know what Im missing :-)

A condition is always an array of arrays, therefore try this:
"conditions":[["Grupper", "EQ", tags]]
Also, since "Grupper" is a List-type tag, you can only use IN operator with it (see the docs here)

Related

Firebase Cloud Messaging Reports - not displaying sent count in Reports

We have set "analytics_label" in the message as stated in the documentation and the message is getting delivered as well. But we do not see any entry in the report. Please check our message string and let us know what might be wrong. Appreciate your help.
REST API being called
https://fcm.googleapis.com/fcm/send
Message being sent
{"topic":"81xxxxx42","android":{"priority":"high"},"priority":"high","fcm_options":{"analytics_label":"nwy81xxxxx42"},"data":{"MID":-1,"frm":"99xxxxx32","MTP":9,"msg":""}}
I'm not certain what library you're using or if you're just POSTing directly to the REST API, but looking at code that I know works I think you just need to make fcm_options and analytics_label camel case.
{
"topic": "81xxxxx42",
"android": {
"priority": "high"
},
"priority": "high",
"fcmOptions": {
"analyticsLabel": "nwy81xxxxx42"
},
"data": {
"MID": -1,
"frm": "99xxxxx32",
"MTP": 9,
"msg": ""
}
}

YouTube Data API V3 not returning Livestream from Channel ID

I'm working on a project that requires me to get a YouTube live stream's chat for use in my program. Everything was working perfectly with this js package, but it seems that google has changed something because it suddenly stopped working. I have regenerated keys, and am well below my quota, so I know that isn't the problem.
Strangely, when I use the youtube data api "try this api" section in their online documentation, the same problem is happening where the live stream is not found by the id. I've tried it on many different live channels, and all have returned an empty "items" array. Anyone else have this issue?
function execute() {
return gapi.client.youtube.search.list({
"part": "snippet, id",
"channelId": "UCSJ4gkVC6NrvII8umztf0Ow",
"eventType": "live",
"type": "video"
})
.then(function(response) {
// Handle the results here (response.result has the parsed body).
console.log("Response", response);
},
function(err) { console.error("Execute error", err); });
}
Results from the request:
{
"kind": "youtube#searchListResponse",
"etag": "\"8jEFfXBrqiSrcF6Ee7MQuz8XuAM/4y-zlkAvKOyrH7TNQpxpBtYUxKU\"",
"regionCode": "US",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": []
}
I can confirm this issue but the issue is a bug from Google. Hope it gets fixed soon.
There is definitely something going on with the YouTube Data API. If you give it a try on the on the Deverloper Console for Search: list it won't work if you are providing channelId. However, if you leave channelId blank it will return all of YouTube's live streams.
Google's instructions for getting help say to add the tag google-apis-explorer to your post. I have submitted an edit to add that tag to your original post. Hopefully we'll all get some answers soon.

Google Assistant - Account linking with Google Sign-In

I have an Express app which supports Google authentication and authorization via passport. I have begun integrating it with Google Assistant and things were going quite well but I am having trouble with the account linking as described at https://developers.google.com/actions/identity/google-sign-in#start_the_authentication_flow
Using the method in the docs at https://codelabs.developers.google.com/codelabs/actions-2/#4 I was able to get user details but when I try to modify to support
app.intent('Start Signin', conv => {
conv.ask(new SignIn('To get your account details'))
})
and
app.intent('Get Signin', (conv, params, signin) => { ...}
the dialogflow always falls back to my default fallback intent and I get an error in Express console
Error: Dialogflow IntentHandler not found for intent: Default Fallback Intent
My dialogflow intent is set to use webhook and other intents work fine (until I add these sign-in intents!)
Reading this thread Dialogflow IntentHandler not found for intent: myIntent (Dialogflow V2) it was suggested that the intent name rather than the action name is used so I check my Actions on Google simulator and the request contains:
"inputs": [
{
"intent": "actions.intent.SIGN_IN",
"rawInputs": [
{
"inputType": "KEYBOARD"
}
],
"arguments": [
{
"name": "SIGN_IN",
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "OK"
}
}
]
}
],
so I tried updating my Dialogflow intent name to actions.intent.SIGN_IN and modifying the intent name in my Express app accordingly but it doesn't make any difference.
The simulator response includes:
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
},
but I'm not sure if that is just because for some reason the intent names are not matching up. Any help much appreciated!
As you speculate in the comments, the issue is that your "Get Signin" Intent isn't registered to get the event indicating that the user has signed in (or failed to). Since there is no such Intent setup, it ends up calling the Fallback Intent, which apparently doesn't have an Intent Handler registered in your webhook.
To make your "Get Signin" Intent get the sign-in event, set the "Event" field to actions_intent_SIGN_IN. (Note the similarity to the Intent name you saw in the simulator, but using underscores instead of dots.)
As an aside, the simulator was showing you what the communication between the Assistant and Dialogflow looks like, so it can be somewhat confusing to understand what Dialogflow is doing with it. It didn't have anything to do with the name of your Intent or anything else.
Finally, it often isn't necessary to do this check. You will know if the user is signed in because either the auth token has been set or the id token has been set (depending on your method of Account Linking).

Unable to retrieve page insights using Graph API explorer

I have the 'Insights Analyst' permission to my facebook page, and I try to use Graph API Explorer to get the metric page_fans
I "Get Access Token" with 'read_insights' and 'manage_pages', and "Submit" a graph API call that looks something like
GET /<page_id>/insights/page_fans
But then I get an empty response. (This occurs for all metrics except page_story_adds_unique, page_storytellers, and page_admin_num_posts)
{
"data": [
],
"paging": {
"previous": "https://graph.facebook.com/<page_id>/insights/post_storytellers/?since=1369004893&until=1369264093",
"next": "https://graph.facebook.com/<page_id>/insights/post_storytellers/?since=1369523293&until=1369782493"
}
}
What permissions am I missing? What am I doing wrong?
There seems to be a larger than usual backlog of data missing in the insights at the moment. Use values for since and until to see where the data is.
/<page_id>/insights/page_fans?since=1369008000&until=1371686400
The numbers are unix timestamps to specify the date range you want. If the range is too large then you will get
"error": {
"message": "Unsupported operation",
"type": "FacebookApiException",
"code": 100
}
I know it's very frustrating and Facebook seems to not have any proper way of checking that the data is backlogged.

How to get the original message's message field through FbGraph /me/inbox?

I am trying to get the original message content from the /me/inbox through the API. I have authorized the read_inbox permission and got a bunch of message objects back. However, each of the message has no Subject nor Message (content). But it does contain comments which include a list of comments with the comment's message content.
Is this a permission issue? Or am I using the API wrong?
Message example below (using fake content for privacy reason.)
{
"id": "97654321",
"to": {
"data": [
{
"name": "Luke C.",
"id": "12346"
},
{
"name": "Mark D.",
"id": "12345"
}
]
},
"updated_time": "2013-01-31T19:10:17+0000",
"unread": 0,
"unseen": 0
}
Upon asking my colleague who have worked with FBgraph api for sometime already. It seems like the fbgraph inbox does behaved like this for a while and there does not seem to have any intention to fix it. And I also noticed that the me/outbox would behave as expected where a 'from'
Thus, I have moved onto using FQL to replace the me/inbox api:
SELECT body, recipients, sender, thread_id, message_id
FROM unified_message where thread_id IN
(SELECT thread_id FROM unified_thread WHERE folder = 'inbox')
If anyone know why FbGraph api does not work, please still help contribute to this question.