How to create interest in interest category? - mailchimp

As per below link create interest functionality is nto avaialable.
http://developer.mailchimp.com/documentation/mailchimp/reference/lists/interest-categories/interests/#
But using API playgroung you can create interest. Even tried with REST api and I am able to create interest. Please let me know if "create interest " API has been removed from above page.

I think it never wasn't on that page. This new API Documentation lacks many things that are possible.
If you want to create new interest you can just POST to this endpoint:
/lists/{list_id}/interest-categories/{interest_category_id}/interests
Example request body:
{
"list_id": "id_of_the_list",
"name": "name of the interest",
"display_order": 1
}
So the answer for your question is that I am pretty sure they just haven't created documentation for that one yet.

Related

Starting a new conversation in a Teams channel via REST

As far as I know, there are two APIs that are required to interact with bots
Graph - Access to Microsoft Graph endpoints, which do not provide access to conversations in Teams.
Bot Framework - The endpoints in this API provide access to conversations.
Moving past the difficulty of finding bot-user IDs, the problem becomes the creation of a new conversation in a channel by the bot. This link says it should be possible, but I have not been successful after hours of attempts.
The service URL in the documentation does not match my requests. It says https://smba.trafficmanager.net/teams/, but I see https://smba.trafficmanager.net/amer/ and https://smba.trafficmanager.net/apis/ in other places. Which one is it?
The crux of the issue is the required fields in the JSON data. This link is meant to help with the creation of channel conversations, but it does not explain the data. In that section is the following comment:
Alternatively, you can use the REST API and issue a POST request to /conversations resource.
which leads to here. Unfortunately, that page does not explain how this works because the sample JSON data is incomplete and not targeted at channels. It appears to be related only to new group chats.
Ultimately, I am requesting an example JSON request to the POST /v3/conversations endpoint, which will create a new conversation in a Team (conversationType = channel, to be clear). This is how it is supposed to look for a new group chat, which does not work with a channel:
{
"bot": {
"id": "12345678",
"name": "bot's name"
},
"isGroup": false,
"members": [
{
"id": "1234abcd",
"name": "recipient's name"
}
],
"topicName": "News Alert"
}
What you're trying to do is called "Proactive Messaging" - basically, it's having your bot create the first message in a series, rather than being the 'recipient' in the usual case. You definitely will need a bot for this, but it sounds like you have one already so that's good. In essence, in a Teams context, you're never really starting a 'new' conversation with the bot, it's just 'continuing' an existing one, so you're wanting to post to the endpoint of that converation. I've covered (I hope well) in some other answers, so please refer here for more: Sending proactive messages from an outside process to organizational users via Teams chat bot . If you're still stuck, let me know and I'll try help further.
I managed to get a JSON object to create a conversation. I have been at this for days, by the way.
The following JSON object will create a new conversation in the General channel of a Team:
{
"activity": {
"type": "message",
"text": "got here"
},
"bot": {
"id": "{{botID}}",
"name": "{{botName}}"
},
"channelData":{
"teamsChannelId":"{{teamID}}",
"teamsTeamId":"{{teamID}}",
// The channel ID of the General channel is the team ID
// Use another channel ID here if you want the message to go elsewhere
"channel":{"id":"{{teamID}}"},
"team":{"id":"{{teamID}}"},
"tenant":{"id": "{{tenantID}}"}
},
"isGroup": true,
"tenantId": "{{tenantID}}"
}
Here is the way to reply:
POST {{urlBase}}/v3/conversations/{{conversationId}}/activities
{
"bot": {
"id": "{{botID}}",
"name": "{{botName}}"
},
"text": "reply test",
"type": "message"
}
where urlBase is something like https://smba.trafficmanager.net/amer and conversationId is something like 19:c25ae532345659b67313c54e1310fdb6#thread.tacv2;messageid=2456564642569 .
A ton of helpful information can be found here. That link is buried and completely obscure, but it has most of what you'll want for low-level calls.
Unfortunately, adding a title/subject to the conversation seems to be impossible, which completely breaks my use case. All that work yielded nothing for me because the easiest part is missing, but at least I figured it out. I hope this helps someone.

Google People API / Other Contacts - how to get photos of other contacts?

Google forces us to migrate from the deprecated Contacts API over new People API.
They even implemented "Other Contacts" feature in the People API which was so demanded.
But now I'm facing another problem - there is no way to get photos of Other Contacts in the People API.
I was digging into this problem and figured out that it's possible to add photos into the readMask (even though it's not documented):
https://people.googleapis.com/v1/otherContacts?access_token=<...>&readMask=emailAddresses,names,photos
...but it doesn't help, because it returns the default picture with the first letter for all contacts, even for contacts who has a real photo. Like this one: https://lh3.googleusercontent.com/cm/ABXenNkcRSTRZU8PEFQfJtaeEBZnxLgN-UO555npUt1idzcMohoSGuJFfKx0JX2AR6Qp=s100
I tried to add coverPhotos into the readMask but it doesn't let it there.
Then I was checking how old Contacts API formats photo urls and figured out the format:
https://www.google.com/m8/feeds/photos/media/<user-email-address>/<contact-id>
But it has 2 disadvantages:
this url has to be requested with access_token
it works only if the contact uploaded a custom photo, otherwise it returns error
So here is my question:
Is there any simpler and cleaner way to get real photos of Other Contacts in People API?
This bug has been solved and now we have a solution!
Updated documentation: https://developers.google.com/people/api/rest/v1/otherContacts/list
There is a new sources[] request parameter. To get the real photos of "other contacts" you need to specify 2 values: READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE.
The request would look like this:
GET https://people.googleapis.com/v1/otherContacts?readMask=photos&key=API_KEY&sources=READ_SOURCE_TYPE_CONTACT&sources=READ_SOURCE_TYPE_PROFILE
Now some contacts will contain 2 entries in the photos array:
photos: [
{
metadata: {
primary: true,
source: {
type: "PROFILE",
id: "11111"
}
},
url: "<THIS IS THE REAL PROFILE PICTURE>"
},
{
metadata: {
source: {
type: "OTHER_CONTACT",
id: "6666666"
}
},
url: "<THIS IS THE DEFAULT PHOTO STUB>",
default: true
}
]
The readMask fields accepted for the otherContacts.list method are the following:
emailAddresses
metadata
names
phoneNumbers
photos
As you can notice, the photos field is an accepted one while making the above request.
However, the returned response should yield a url which redirects you to the user's profile picture. Because of this, I have taken the opportunity to report it on Google's Issue Tracker here. I suggest you star the issue as any updates regarding this will be posted there.
Reference
People API otherContacts.list;
People API Support.

Get teamId in message extension handler

When developing a message extension for Microsoft Teams, is it possible to retrieve the ID of a team where the user is invoking the message extension command without first adding the bot to that team?
I can do this when the bot is added to the team manually based on TeamsInfo.getTeamDetails(), however, I don't really need (or want) to add the bot to the team for my goal. All I need is the channel ID (which is available from the context/conversation) and the ID of the underlying team. Retrieving the team details without the bot being added beforehand errors with "The bot is not part of the conversation roster".
Have a look at the ChannelData property on the Activity class, that should give what you need. You can read more about it here.
Here's an example of the underlying payload, for interest:
"channelData": { "eventType": "channelCreated", "tenant": { "id": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "channel": { "id": "19:693ecdb923ac4458a5c23661b505fc84#thread.skype", "name": "My New Channel" }, "team": { "id": "19:693ecdb923ac4458a5c23661b505fc84#thread.skype" } }
we had the same trouble with the Team documentation and APIs.
However for that specific case, we found a solution that may work for you. I will say is more a hack than a solution. But it worked on my use case. It will only work on messages with attachments.
When the context is received in a message, the message contains an attachments array. Each attachment object has a contentUrl. Inside that url is the mailNickname for the group. That mailNickname field represents a readeable unique id. The format is something like sites/{mailNickname}/General.
from there you can retrieve the field and use the Groups Graph API.
With a query like this one:
https://graph.microsoft.com/v1.0/groups?$filter=startswith(mailNickname, 'themailNicknameFromcontenturl')
You will get the group full information, including the aadGroupId
In general, is a nightmare to work with Teams documentation. Hope this hack helps you.

What public information in a profile does the G+ People search API look into when performing a search?

I am talking about the functionality of the API that can be tested here: https://developers.google.com/+/web/api/rest/latest/people/search
I used to think it looks into all the public fields of a profile ("Specify a query string for full text search of public text in all profiles."), but it seems you can't search by email, telephone or some of the education and work information (even if the expected resulting profiles make this information public).
So my question is, what public data does this search use to retrieve its results? I can't find any documentation on this.
People: search
query string Specify a query string for full text search of public text in all profiles.
I found a random user. here I picked this guy because he had a lot of text in his profile.
Lets search on "gdesignart" This is part of his display name.
{
"kind": "plus#person",
"etag": "\"Sh4n9u6EtD24TM0RmWv7jTXojqc/W9DoYLbchkxsXWI_HhuWV6G7lJY\"",
"objectType": "person",
"id": "116044052555068441384",
"displayName": "Marcello Ghirardi (gdesignart)",
"url": "https://plus.google.com/116044052555068441384",
"image": {
"url": "https://lh3.googleusercontent.com/-IqYeJSv07cI/AAAAAAAAAAI/AAAAAAAAAPM/yw8nbO0Ho6g/photo.jpg?sz=50"
}
Works fine and I get a response.
Now lets try some text from his tagline or introduction arguably we could say this qualifies as public text on his profile.
I tried the following
G-Design®
è un brand
Pollutre of different world
None worked. If you look at the response the only thing in the response is the users display name. From my experience with other google APIs I can tell you that I don't think its going to let you search on any field that is not part of its response. So you are only going to be searching on DisplayName. For the fun of it I searched on his ID that didn't return anything either.
Answer: search is on display name only.
I would recommend adding this as a feature request if you link it here I will happily add my name to it. Google plus issue forum

Google places api restaurant types

When you search for a restaurant in Google places and go to the business profile (i.e.:
https://plus.google.com/107507038669791289691/about?hl=en) the restaurant has a tag (in this case Mexican Restaurant). But when using the Google places api all I can see is a types list
"types" : [ "restaurant", "food", "establishment" ]
Anyone know if it's possible to get the tag "Mexican Restaurant" somehow?
I know about the supported types (https://developers.google.com/places/documentation/supported_types). It is not super helpful.
I was also working in a project which need to get more details about a place using Google Maps and Google Places APIs, and I really spent many hours trying to find something that can help ( Google Places API, Google Maps API, google+ APIs, ... ) but nothing ... the only things that I found is theses 2 issues ( feature requests ) which I hope that Google will add to their APIs someday :
Issue N° 5260 with 13 stars.
Issue N°7878 with 4 stars.
I hope with this SO question that we get more interested persons to get the feature in a soon future version of Google Map or Google Places APIs.
For the Google Places for Work API, I didn't find any information to confirm or not that it contains such feature, but I don't think so.
Hope that can help.
I think you would probably have to revert to the text search method on the api..
https://developers.google.com/places/documentation/search#TextSearchRequests
So your request would end up looking something like the below, restricted down to a specific area
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Mexican+Restaurant&sensor=true&location=40.846,-73.938&radius=20&key=yourKeyHere
However this will return all other Mexican restaurants in the area, so if you just want to return the one result I would use the Place Details request instead.
Separate your place types by PIPE symbol "|"
try like this :
String types = "cafe|restaurant|museum" // Listing places only cafes, restaurants and museums.

Resources