I am building a dashboard so I can easily view how many people currently have a specific label in my facebook messenger. I'm just developing this for my page that I'm admin at, so it's only for this one page.
The final result is this:
Label 1 - 38 People
Label 2 - 82 People
Label 3 - 47 People
First I get the participants using this endpoints: {page-id}/conversations?fields=participants
I get this sample:
{
"data": [
{
"participants": {
"data": [
{
"name": "Particiapnt's name",
"id": "<psid>"
},
{
"name": "My Page Name",
"id": "<my-pageid>"
}
]
},
"id": "<thread-id>"
}
]
}
Now when I use participants id (psid) to get custom labels using this endpint: /custom_labels
I get this error:
{
"error": {
"message": "Unsupported get request. Object with ID 'xxxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "A5kFh5U-xSMB83ZnQrbzEfy"
}
}
Please help.
Related
I have a collection named templates. It has a field 'sec_1' which is an array of objects with properties 'name' and 'des' both of type string. Now I'm using elastic search and when I try to execute a query that matches only title fields I get an error saying the sec_1 field is not nested. Upon checking the mappings here is what I get mapping type of sec_1 is text.
I checked online and saw the fix was to modify the mapping. I created a new index like:
`curl base_url/new_index_name
{
"mappings":
{"properties": {
"sec_1": {
"type":
"nested","properties": {
"name": { "type": "text" },
"des": { "type": "text" }
}
}
}
}
}
and then reindexed like this:
curl base_url/_reindex
{
"source": {
"index": "old_index"
},
"dest": {
"index": "new_index"
}
}`
First request is successful, the second one fails with this error:
{
"index": "new_index",
"type": "_doc",
"id": "be5123a4-d0e8-4d7b-a8f1-42f31d37fe55",
"cause": {
"type": "mapper_parsing_exception",
"reason": "object mapping for [sec_1] tried to parse field [null] as object, but found a concrete value"
},
"status": 400
},
I don't understand why this is happening and what I'm doing wrong. Please help. I do not know much about elastic search, I've looked for solutions online, tried chatgpt too but the same steps appear. I'm finding the reason for this error is that sec_1 is not nested type but I've checked in database it is an array of objects. What else could be wrong?
I tried creaing new index but cannot do that and without new index my search query cant function properly
Just before I go about having to learn Redux or use Immer, I was wondering if anyone knew of a simple way to do this. I checked the React docs but I must be making a mistake somewhere, and need new sets of eyes on this.
I've got a users array of objects that is set to state {i.e. users, setUsers) , where each user object that has nested within it posts and concerts. Here's an example of one of them:
{
"id": 305,
"username": "L0V3MUSIC",
"email": "kanisha.hansen#bayer.co",
"posts": [
{
"id": 129,
"body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
"for_sale": false,
"tickets": 4,
"concert_id": 51,
"user_id": 305
}
],
"concerts": [
{
"id": 51,
"date": "2023-07-22T00:00:00.000Z",
"location": "Brooklyn Steel",
"image": "https://i.imgur.com/SmFrzTC.jpg",
"artist_id": 37
}
]
},
I've also got concerts state holding an array of objects with the same information also and in the same way as above with users.
{
"id": 51,
"date": "2023-07-22T00:00:00.000Z",
"location": "Brooklyn Steel",
"image": "https://i.imgur.com/SmFrzTC.jpg",
"artist_id": 37,
"artist": {
"id": 37,
"name": "Adele",
"image": "https://i.imgur.com/zmGbfKS.jpg",
"genre": "Pop"
},
"posts": [
{
"id": 123,
"body": "2 tickets, $100 total OBO -- CHEAPEST YOU'LL EVER FIND FOR ADELE!!",
"for_sale": true,
"tickets": 2,
"concert_id": 51,
"user_id": 289
},
{
"id": 124,
"body": "3 tickets, $400 total OBO!",
"for_sale": true,
"tickets": 3,
"concert_id": 51,
"user_id": 289
},
{
"id": 129,
"body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
"for_sale": false,
"tickets": 4,
"concert_id": 51,
"user_id": 305
}
],
"users": [
{
"id": 289,
"username": "onlineguy1",
"email": "su#cronin.name"
},
{
"id": 305,
"username": "L0V3MUSIC",
"email": "kanisha.hansen#bayer.co"
}
]
},
My issue is that I want to update a post that a user enters. I'd like to iterate either through users or through concerts, as I'm not sure which is best just yet given that both are 'symmetrical' in a sense. I don't want to have a posts state object though as I'm being graded on my ability to access users through concerts, and concerts through users.
currentUser is just the user that is currently logged in, and who would be the author of the created post. What I've tried to do a bunch of different ways is this: (here's my latest iteration)
if (response.status >= 200 && response.status <= 299) {
response.json().then((createdPost) => {
console.log('createdPost: ', createdPost);
const updatedPosts = currentUser.posts.map((eachPost) => {
if (eachPost.id === createdPost.id) {
return createdPost;
} else {
return eachPost;
}
});
console.log('updatedPosts: ', updatedPosts);
setCurrentUser(...currentUser, currentUser.posts: updatedPosts)
// FIGURE OUT HOW TO UPDATE THE STATE OF THE ABOVE
// THEN MAP THROUGH USERS AND UPDATE THAT USER WITH CURRENTUSER INSTEAD
});
setError([]);
setSuccess('Your post has been created!');
setSubmitted(true);
} else {
What I have above is updating the currentUser's posts and have an updated collection of the currentUser's post, and then ideally update the users state itself with this currentUser (and his updated posts) replacing currentUser (and his now outdated posts, given that they don't include the newly created post). But I've managed to confuse myself through the nesting and mapping and staring at this too long.
Is there a concise way to go about either updating the posts altogether then iterating through the user then updating users state, in a way that doesn't require redux or a plugin? Or is there a better way to go about handling this entirely? I'm assuming for sure that I'm being sloppy in getting this done so I'll take any steps in the right direction
When I query the Google Page Speed API data is missing in the response.
Response when querying url https://www.online-it-support.dk using Pagespeed API https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://www.online-it-support.dk
The loadingExperience property is almost empty.
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://marketing-manager.dk/",
"loadingExperience": {
"initial_url": "https://marketing-manager.dk/"
},
"lighthouseResult": {
When querying developers.google.com (https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://developers.google.com/)
the loadingExperince is filled with data
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://developers.google.com/",
"loadingExperience": {
"id": "https://developers.google.com/",
"metrics": {
"CUMULATIVE_LAYOUT_SHIFT_SCORE": {
"percentile": 31,
"distributions": [
{
"min": 0,
"max": 10,
"proportion": 0.28354700854700876
},
Any idea what this is caused by?
I have tried with an API key but no difference.
I think I found out that it is caused by to little data on the website. In Google Page Speed it also says it lacks data so only data in lighthouseResult is present.
I cannot find any info if there is any limitations for dojo treegrid JSON store. Here is my simple store. It works perfect but fails if it has thousands of items. So is there a limit for number of items or childItems? Or is there a limit for JSON object size?
{
"identifier": "id",
"label": "name",
"items": [
{
"id": "id1",
"type": "year",
"year": "2018",
"childItems": [
{
"id": "id0",
"projname": "Project 1"
},
{
.....
}
]
},
{
.....
}
]
}
Dojo treegrid mostly shows this error message when it finds multiple items with the same id, so you want to make sure all "id" attributes in your "items" list have unique value. In my test setup I was able to load more than 20000 rows so most probably you have malformed data. Supply following option to grid to log any fetch related errors:
onFetchError: function(err, req){
console.log(err);
}
Hope it helps.
Previously I was using a json file with the following format:
[{"lat":43.788458853157117,"lng":-79.282781549043008,"category":"volunteer","name":"Rita","url":"", "description":"xxx is a member of 13"},{"lat":43.7,"lng":-79.4,"category":"organization","name":"TCAN","url":"http://tcan.ca","description":"Lorem ipsum"}]
Now I am attempting to generate the json file from a Drupal site and am getting the following structure. How can I reference the lowest level fields. I have looked at examples using d3.net but have not found any that apply.
{
"organizations": [
{
"member": {
"field_category": "organization",
"body": "A network of organizations in Toronto devoted to climate change mitigation and adaptation.",
"URL": "xxx.ca",
"title": "Toronto Climate Action Network",
"field_lat": 43.7,
"field_long": -79.4
}
},
{
"member": {
"field_category": "abc",
"body": "xxx.",
"URL": "",
"title": "yyy",
"field_lat": 43.7,
"field_long": -79.28
}
}
]
}
Assuming that your data is stored in the variable data:
var bottom = data.organizations.map(function(d) { return d.member; });