How to get the users list from the current flow / thread with Hubot on Flowdock? I'd like to create plugin showing messages with the usage of current flow user names.
I have found this: robot.brain.data.users
but it returns the whole list of users from organization rather than from the current flow.
The list of a flow’s users can be fetched using the Flows resource. You'll need to know the Organization name and Flow name. See the 'Get a Flow' section here:
https://www.flowdock.com/api/flows
The format is:
GET /flows/:organization/:flow
and returns:
{
"id": "deadbeefdeadbeef",
"name": "My flow",
"parameterized_name": "my-flow",
"organization": {
"id": 8,
"name": "Acme",
"parameterized_name": "acme",
"user_limit": 0,
"user_count": 5,
"active": true,
"url": "https://api.flowdock.com/organizations/acme"
}
"unread_mentions": 0,
"open": true,
"url": "https://api.flowdock.com/flows/acme/my-flow",
"web_url": "https://www.flowdock.com/app/acme/my-flow",
"join_url": "https://www.flowdock.com/invitations/eedd2bf0643f75c14be9099272429351c7132a71-my-flow",
"access_mode": "link",
"users": [
{
"id": 9,
"nick": "Joe",
"name": "Joe Smith",
"email": "joe#example.com",
"avatar": "https://d2cxspbh1aoie1.cloudfront.net/avatars/f5b8fb60c6116331da07c65b96a8a1d1/",
"status": "Testing API",
"disabled": false,
"last_activity": 1328016726423000,
"last_ping": 1328017690004000
},
{
"id": 42,
"nick": "Stevie",
"name": "Stevie Johnson",
"email": "stevie#example.com",
"avatar": "https://d2cxspbh1aoie1.cloudfront.net/5bdd089a099acc56fc7120f6325a5d5c/",
"status": null,
"disabled": false,
"last_activity": 1328016712345000,
"last_ping": 1328017612345000
}
]
}
Related
I'm trying to get all profiles using ~all option with this endpoint
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.
https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles
Am I doing something wrong or is this GA API bug?
I sugst you look into using account summaries list
GET https://www.googleapis.com/analytics/v3/management/accountSummaries
This will return all the account information for a user.
{
"kind": "analytics#accountSummaries",
"username": "me#gmail.com",
"totalResults": 15,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "59183475",
"kind": "analytics#accountSummary",
"name": "Cube Analytics",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-59183475-1",
"name": "Cube Analytics",
"internalWebPropertyId": "93305066",
"level": "STANDARD",
"websiteUrl": "XXXXXXX",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "115455750",
"name": "Alaternate",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "97191919",
"name": "All Web Site Data",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "178538323",
"name": "MobileView",
"type": "APP"
}
]
}, ]
}
By using this call you should only need to make one call and get all of the information back.
I was asked to store leads like below in Marketo's lead database through rest api "POST /rest/v1/leads.json".
{
"action": "createOnly",
"lookupField": "email",
"input": [{
"email": "kjashaedd-1#klooblept.com",
"firstName": "Kataldar-1",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "available"
},
{
"type": "car",
"status": "sold out"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
},
{
"email": "kjashaedd-2#klooblept.com",
"firstName": "Kataldar-2",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "sold out"
},
{
"type": "car",
"status": "available"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
}
]
}
Input field is not in flat json structure. What could be the best approach? Do I really need to use custom objects in this case? Can I dump "property" object as it is in the lead database and use velocity script to parse it ?
If 'Property' is a custom object, you'll want to call that separately for the record and associated the record with that object via the custom object API
So you can push (create) the record first and then associate (add) the custom object to the record.
You can create a List<Dictionary<string,object>> in C# and retrieve the data and then store it using Entity Framework.
I am considering .Net framework in this case
I have taken the Blog App, added a Category ContentType as a field in the BlogPost ContentType and built a query to factor Category into the results.
But I am having trouble with the In-ValueProvider. Following the example here the Visual Query Designer seems to be ignoring the incoming value from my ModuleDataSource.
I have double checked the In-Stream name, my Entity names, case, TestParameters, etc. Are there any known bugs in 2sxc 8.44 and up that would cause this issue? What have I missed?
In this case I am using a RelationshipFilter. Relationship is "Category". Filter is "[In:Config:Category]". I can switch out to a [Querystring:Category] and that works fine and runs all my code.
Thanks for reading.
OK I found a workaround.
It turns out that the In-ValueProvider is working but it's struggling with the Category of my BlogPost I think because Category is an entity.
For background I have a BlogPost ContentType, a Category ContentType, and an Articles Home Header ContentType. Articles Home Header sets both the header info for the articles page and the Category entity.
For some reason the RelationshipFilter is having trouble comparing the Category entities between Articles Home Header and BlogPost. I tried the following for my Filter and neither worked:
[In:Config:Category]
[In:Config:Category:Title]
I wonder if this is a case sensitivity issue, a bug, or if I am just misunderstanding the filter syntax.
To work around I created a temp field called TempCategory in my Articles Home Header and used [In:Config:TempCategory] for the filter.
That worked.
For reference here is a snippet from the Query:
{
"Config": [
{
"Title": "Coaching Articles",
"SubTitle": "",
"Image": "/Portals/0/uploadedimages/AcademicPrograms/Christ_College/crosswise-hero.jpg",
"ImageAlt": "Crosswise stained glass",
"Category": [
{
"Id": 2716,
"Title": "Coaching"
}
],
"Id": 3118,
"Modified": "2016-06-21T10:44:21.9Z",
"_2sxcEditInformation": {
"sortOrder": 0
}
}
],
"Paging": [
{
"Title": "Paging Information",
"PageSize": 10,
"PageNumber": 1,
"ItemCount": 0,
"PageCount": 0,
"Id": 0,
"Modified": "0001-01-01T00:00:00Z",
"_2sxcEditInformation": {
"entityId": 0,
"title": "Paging Information"
}
}
],
,
"Default": [
{
"Title": "Protect Your Players and Your Program: An Athletic Leader's Legal Duties",
"UrlKey": "an-athletic-leaders-legal-duties",
"PublishingGroup": null,
"PublicationMoment": "2016-06-15T00:00:00Z",
"Image": "/Portals/0/uploadedimages/AcademicPrograms/Graduate/Coaching/an_athletic_leaders_legal_duty.jpg",
"ImageSquare": false,
"Teaser": "<p>When the clock started on the new year earlier this month, all but one state joined the growing legal effort to protect and prevent concussions and head injuries among America’s young.</p>",
"Body": "<p><strong>When the clock started on the new year earlier this month,</strong> all but one state joined the growing legal effort to protect and prevent concussions and head injuries among America’s young.</p>\n<p>As sports-related injuries and issues continue to dominate the headlines and influence programs throughout the country, laws like “return-to-play” are becoming a sign of the times when it comes to protecting players and athletic programs alike. The world of athletics is experiencing a significant shift in the perception of the roles and responsibilities of coaches, schools and athletic personnel.</p>",
"DesignedContent": [],
"Tags": [
{
"Id": 2576,
"Title": "coaching"
},
{
"Id": 2575,
"Title": "management"
},
{
"Id": 2574,
"Title": "sports"
},
{
"Id": 3035,
"Title": "legal"
}
],
"Author": [
{
"Id": 3030,
"Title": "Shaleek Blackburn"
}
],
"ImageAlt": "Referee holding a red",
"Thumbnail": "",
"ThumbnailAlt": "",
"RelatedArticles": [
{
"Id": 2564,
"Title": "Athletic Personnel's Duty To Warn"
},
{
"Id": 2565,
"Title": "Get A Better Grip On Bullying"
},
{
"Id": 2717,
"Title": "Good Coaching Develops Exceptional Athletes and People"
}
],
"Category": [
{
"Id": 2716,
"Title": "Coaching"
}
],
"ArticleRelationships": null,
"Id": 2513,
"Modified": "2016-06-15T19:32:17.913Z",
"_2sxcEditInformation": {
"entityId": 2513,
"title": "Protect Your Players and Your Program: An Athletic Leader's Legal Duties"
}
}
]
}
here is the json data that the visual query returns with no valueFilter:
{
"Default": [
{
"Title": "Demo Image",
"Id": 2062,
"Description": "<p>Wonderful Description Goes here</p>",
"Available": true,
"Image": "/Portals/29/gallery/image-holder.jpg",
"Category": "Landscapes"
},
{
"Title": "Second Image",
"Id": 2179,
"Description": "<p>More info about gallery item</p>",
"Available": true,
"Image": "/Portals/29/adam/Image Gallery/d_1cnVC7ok2XkNwelFfzxw/Image/NorthEastWomensVids.jpeg",
"Category": "Landscapes"
},
{
"Title": "Krisis",
"Id": 2191,
"Description": "<p>Super duper</p>",
"Available": true,
"Image": "/Portals/29/adam/Image Gallery/5lWMBOhQrU240JeahWVojg/Image/11L202413A.jpg",
"Category": "Landscapes"
},
{
"Title": "Banff Mountain",
"Id": 2195,
"Description": "<p>Acrylic on canvas - 24-38 inches</p>",
"Available": false,
"Image": "/Portals/29/adam/Image Gallery/8rD59K5dikald8csgfGbiA/Image/Cheryl_Muth_Painting-28.jpg",
"Category": "Landscapes"
},
{
"Title": "Dark mountain day",
"Id": 2196,
"Description": "<p>acrylic on canvas - 32x38 inches</p>",
"Available": false,
"Image": "/Portals/29/adam/Image Gallery/GNm6lv__sU-3jsfxtFOMIQ/Image/Cheryl_Muth_Painting-32.jpg",
"Category": "Portraits"
},
{
"Title": "jans painting",
"Id": 2197,
"Description": "<p>acrylic on canvas 45x33 inches</p>",
"Available": true,
"Image": "/Portals/29/adam/Image Gallery/3GvRbdwiUUSRieqBro8nBQ/Image/jans_painting.jpg",
"Category": "Flowers"
}
]
}
If I add a value filter to the visual query and specify the Attribute = Category and the Value = Landscapes, then when I test the query I get only the landscapes items.
However the problem is when I try to perform a value filter on the Available attribute. It is a boolean field value with a yes no toggle in the entry form.
If I set the valueFilter Attribute to Category and the value to either "true/false" "yes/no" or "1/0" I get no records of any kind.
Can you help me figure out why I can not perform a valueFilter on a boolean field.
I am using the latest release of 2sxc
Thanks
SOLUTION:
It was a case issue.
When I am trying to perform a value filter in the visual query on a boolean / "yes-no" field, using lower case did not work.
For example I had to use True or False NOT true or false in the value field for the filter. This was a little misleading as the returned json results use lower case as seen by the actual results below:
{
"Default": [
{
"Title": "Banff Mountain",
"Id": 2195,
"Description": "<p>Acrylic on canvas - 24-38 inches</p>",
"Available": false,
"Image": "/Portals/29/adam/Image Gallery/8rD59K5dikald8csgfGbiA/Image/Cheryl_Muth_Painting-28.jpg",
"Category": "Landscapes"
},
{
"Title": "Dark mountain day",
"Id": 2196,
"Description": "<p>acrylic on canvas - 32x38 inches</p>",
"Available": false,
"Image": "/Portals/29/adam/Image Gallery/GNm6lv__sU-3jsfxtFOMIQ/Image/Cheryl_Muth_Painting-32.jpg",
"Category": "Landscapes"
}
]
}
I want to find the ceo of IBM. What would be the MQL query for this?
The MQL for this search looks like the following.
This particular instance may be a tat more complicated than necessary because I got it initially produced from a Freebase interactive search and then simply added/improved the filters manually.
I verified it with various company names with relative success, i.e. it works provided that the underlying data is properly codified in Freebase (some companies are missing, for some companies the leadership data is incomplete etc.)
There are a few tricks to this query:
the company name in u0 fitler needs to match precisely the company name as recorded in Freebase. You could use a contains predicate rather than an equal one, but that could introduce many irrelevant hits. For example you need to use "IBM", "Apple Inc.", "General Motors" rather than common alternatives to these names ("International Business Machines", "Apple", "GM"...")
the u1 filter, on the leadership role is expressed in a extensive One of predicate because unfortunately the nomenclature for these roles is relatively loose, with duplicates (e.g. could be CEO or Chief Executive Officer) and with the fact that the role of CEO is often coupled with other corporate roles such as Chairman [of the board] and/or President etc. I hand picked this list by first looking up (in Freebase) the instances of Leadership Roles which contained "CEO" or "Chief Executive".
the u2 filter expresses that the to date should be empty, to select only the person currently in office, as opposed to former CEOs (for which hopefully Freebase recorded the end date of their tenure).
Depending on your application, you may need to test that the query returns one and exactly one record, and adapt accordingly if it doesn't.
Freebase MQL editor is a convenient tool test and edit with this kind of queries.
[
{
"from": null,
"id": null,
"limit": 20,
"organization": {
"id": null,
"name": null,
"optional": true
},
"person": {
"id": null,
"name": null,
"optional": true
},
"role": {
"id": null,
"name": null,
"optional": true
},
"s0:type": [
{
"id": "/organization/leadership",
"link": [
{
"timestamp": [
{
"optional": true,
"type": "/type/datetime",
"value": null
}
],
"type": "/type/link"
}
],
"type": "/type/type"
}
],
"sort": "s0:type.link.timestamp.value",
"title": null,
"to": null,
"type": "/organization/leadership",
"u0:organization": [
{
"id": null,
"name": "IBM",
"type": "/organization/organization"
}
],
"u1:role": [
{
"id": null,
"name|=": ["Chief Executive Officer", "President and CEO", "Chairman and CEO", "Interim CEO", "Interim Chief Executive Officer", "Founder and CEO", "Chairman, President and CEO", "Managing Director and CEO", "Executive Vice President and Chief Operating Officer", "Co-Founder, Chairman and Chief Executive Officer"],
"type": "/organization/role"
}
],
"u2:to": [
{
"value": null,
"optional": "forbidden"
}
]
}
]
Sample return (for "IBM", specifically)
{
"code": "/api/status/ok",
"result": [{
"from": "2012-01-01",
"id": "/m/09t7b08",
"organization": {
"id": "/en/ibm",
"name": "IBM"
},
"person": {
"id": "/en/virginia_m_rometty",
"name": "Virginia M. Rometty"
},
"role": {
"id": "/en/chairman_president_and_ceo",
"name": "Chairman, President and CEO"
},
"s0:type": [{
"id": "/organization/leadership",
"link": [{
"timestamp": [{
"type": "/type/datetime",
"value": "2010-01-23T08:02:57.0006Z"
}],
"type": "/type/link"
}],
"type": "/type/type"
}],
"title": "Chairman, President and CEO",
"to": null,
"type": "/organization/leadership",
"u0:organization": [{
"id": "/en/ibm",
"name": "IBM",
"type": "/organization/organization"
}],
"u1:role": [{
"id": "/en/chairman_president_and_ceo",
"type": "/organization/role"
}],
"u2:to": []
}