twitter oauth php - oauth

I am implementing a log-in system for my application based on twitter oAuth and I would like to get the email address and other basic info of tech user, is it possible to get it?

Yes it is possible to get basic info of user,Here is the list of all operations you can perform using twitter Rest API.
https://dev.twitter.com/docs/api/1.1

GET account/settings
Returns settings (including current trend, geo and sleep time information) for the authenticating user.
I cant find the email of logged user, but you can see other information.
Example:
{
"always_use_https": true,
"discoverable_by_email": true,
"geo_enabled": true,
"language": "en",
"protected": false,
"screen_name": "theSeanCook",
"show_all_inline_media": false,
"sleep_time": {
"enabled": false,
"end_time": null,
"start_time": null
},
"time_zone": {
"name": "Pacific Time (US & Canada)",
"tzinfo_name": "America/Los_Angeles",
"utc_offset": -28800
},
"trend_location": [
{
"country": "United States",
"countryCode": "US",
"name": "Atlanta",
"parentid": 23424977,
"placeType": {
"code": 7,
"name": "Town"
},
"url": "http://where.yahooapis.com/v1/place/2357024",
"woeid": 2357024
}
],
"use_cookie_personalization": true
}

Related

Graph API calendar endpoint doesn't support sending Adaptive card as attachment

We are using https://graph.microsoft.com/v1.0/me/calendar/events for creating Calendar events. What we are trying to achieve additionally is to send an adaptive card as attachment. We are using below code as POST body
{
"subject": null,
"body": {
"contentType": "html",
"content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
},
"attachments": [
{
"id": "74d20c7f34aa4a7fb74e2b30004247c5",
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": "{\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.5\",\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"Container\",\"style\":\"emphasis\",\"items\":[{\"type\":\"TextBlock\",\"text\":\"TheEYorganizationtodayannouncesthedetailsofthe52womenfounders\",\"wrap\":true},{\"type\":\"ColumnSet\",\"columns\":[{\"style\":\"default\",\"width\":\"stretch\",\"items\":[{\"type\":\"ColumnSet\",\"columns\":[{\"items\":[{\"type\":\"Image\",\"width\":\"200px\",\"url\":\"https://tse3.mm.bing.net/th/id/OIP._awI5wQIVTy1k8QdHtpSWQHaEK?w=292&h=180&c=7&r=0&o=5&dpr=1.3&pid=1.7\"}],\"type\":\"Column\",\"width\":\"auto\"},{\"items\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"SomeText\",\"wrap\":true},{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"[https://adaptivecards.io](https://adaptivecards.io)\",\"wrap\":true}],\"type\":\"Column\",\"width\":\"auto\"}]}],\"minHeight\":\"100px\",\"type\":\"Column\"}]}]}]}",
"name": null,
"thumbnailUrl": null
}
],
"start": {
"dateTime": "2022-11-18T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2022-11-18T12:30:00",
"timeZone": "Pacific Standard Time"
},
"location": {
"displayName": "Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address": "xero.01234#contoso.com",
"name": "Orex"
},
"type": "required"
}
],
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"}
Using above body, I am getting below error
{
"error": {
"code": "UnableToDeserializePostBody",
"message": "were unable to deserialize "
}}
As I understand this has something to do with the JSON I am passing as content inside attachment, I want to know if calendar invites endpoint supports adaptive card or not or is there any way, we can send adaptive card (using .NET SDK) to mail or events in outlook
Thanks, in advance
You can send actionable messages via emails only, see Supported scenarios for more information.

Not getting any webhook notification for Microsoft O365 Management APIs

I have created the below webhooks and all are enabled.:
[
{
"contentType": "Audit.AzureActiveDirectory",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.General",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
},
{
"contentType": "Audit.SharePoint",
"status": "enabled",
"webhook": {
"authId": "12345",
"address": "https://978b7cfb66d9.ngrok.io/callback/",
"expiration": "",
"status": "enabled"
}
}
]
I don't see any notifications coming when there are changes made in sharepoint. Anything in particular need to change?
From the access token, I do see correct app permissions:
"roles": [
"ServiceHealth.Read",
"ActivityFeed.Read"
]
I manually queried to get content and it shows empty.
https://manage.office.com/api/v1.0/{tenant-guid}/activity/feed/subscriptions/content?contentType=Audit.Sharepoint
Looks like the auditing for Office 365 organization is disabled.
Make sure you turn on audit log search.

Microsoft graph API: empty BCC field

Scenario:
Jenny and Tom have gmail accounts. Jerry is o365 user
Jenny sends email to Tom (in TO: field) and BCC: Jerry.
When Jerry gets message from graph api and doesn't see himself in BCC entry, which is empty (in both versions of API - 1 and beta).
If Jenny, Jerry and Tom would be in the group and Jenny have sent email to group, it would exactly the same for Jerry. There is no way to distinguish those two cases.
I would expect that when user is in BCC he should see himself there.
I know if sender is O365 user and getsMessage via graph API he will see all BCC users.
Is there any API call that I could use to learn that given user was in BCC of given message?
Here is what Jerry sees:
{
"#odata.etag": "W/\"CQAAABYAAACWhXAbJxpFRb0V3o8I2vIPAACwRstA\"",
"id": "AAMkAGMyNDE4NGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgBGAAAAAABT6x1NTxG_S7bw4uHJw-_tBwDEbTtXm_E6Rr8LT_x2xj5KAAAAnJfJAACWhXAbJxpFRb0V3o8I2vIPAACwGG_qAAA=",
"createdDateTime": "2017-11-15T19:50:57Z",
"lastModifiedDateTime": "2017-11-15T19:50:57Z",
"changeKey": "CQAAABYAAACWhXAbJxpFRb0V3o8I2vIPAACwRstA",
"categories": [],
"receivedDateTime": "2017-11-15T19:50:57Z",
"sentDateTime": "2017-11-15T19:50:54Z",
"hasAttachments": false,
"internetMessageId": "<CAHF5u5KsOQd43c4dtnx0uTQRor_dt7Y1uy=F3G4i6-c+TdUgug#mail.gmail.com>",
"subject": "test bcc=",
"bodyPreview": "test bcc",
"importance": "normal",
"parentFolderId": "AAMkAGMyE4NGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgAuAAAAAABT6x1NTxG_S7bw4uHJw-_tAQDEbTtXm_E6Rr8LT_x2xj5KAAAAnJfJAAA=",
"conversationId": "AAQkAGMyGI5LTRlNmItNDUzMy04ZTBlLTgxNjM3MDZhODE5NgAQAMaAYzrmsyxGq7ZujLh23q0=",
"conversationIndex": "AQHTXxoBjOuazLEartm6MuHberQ==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": false,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGMyNDE4NAACwGG%2BqAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"unsubscribeData": [],
"unsubscribeEnabled": false,
"body": {
"contentType": "html",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body>\r\n<div dir=\"ltr\">test bcc<br>\r\n</div>\r\n</body>\r\n</html>\r\n"
},
"sender": {
"emailAddress": {
"name": "Jenny",
"address": "jenny1234#gmail.com"
}
},
"from": {
"emailAddress": {
"name": "Jenny",
"address": "jenny1234#gmail.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Tom",
"address": "tom1234#gmail.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"mentionsPreview": null,
"flag": {
"flagStatus": "notFlagged"
}
},
For any messages that comes from an external source (in this case GMail), there is no BCC data available.
This works this way in order to meet the requirements set forth for "Blind Carbon Copy" in RFC 2822.

twitter api trends swift

Developing a twitter connect app and getting the trends with the url:
https://api.twitter.com/1.1/trends/closest.json?lat=42&long=36
Output:
[
{
"name": "Turkey",
"placeType": {
"code": 12,
"name": "Country"
},
"url": "http://where.yahooapis.com/v1/place/23424969",
"parentid": 1,
"country": "Turkey",
"woeid": 23424969,
"countryCode": "TR"
}
]
How can i get the actual content of the trends? Hope there are some solutions. Thanks
You want to call
GET trends/place
not trends/closest you have everything in api documentation
documentation

Getting only selected fields of user timeline from Twitter API

I am getting user's timeline from an iOS app, with a big number of tweets being pulled from the API. I am using the statuses/user_timeline endpoint to get the data, however, as I'm on a mobile device and as I only need the tweet text only, I'd like to filter only the actual text data of the tweets. I've already set include_entities to no and trim_user to true, but even with entities and user data trimmed off, I'm still getting a lot of data that I don't need. Here is a sample tweet that I get from the endpoint:
{
"created_at": "Tue Nov 27 14:13:13 +0000 2012",
"id": 273429272209801200,
"id_str": "273429272209801217",
"text": "you could list #5ThingsIFindAttractive but you can actually find them on Facebook with Social Match on iPhone! http://t.co/zRr1ggbz",
"source": "web",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 62828168,
"id_str": "62828168"
},
"geo": null,
"coordinates": null,
"place": {
"id": "682c5a667856ef42",
"url": "http://api.twitter.com/1/geo/id/682c5a667856ef42.json",
"place_type": "country",
"name": "Turkey",
"full_name": "Turkey",
"country_code": "TR",
"country": "Turkey",
"bounding_box": {
"type": "Polygon",
"coordinates": [
[
[
25.663883,
35.817497
],
[
44.822762,
35.817497
],
[
44.822762,
42.109993
],
[
25.663883,
42.109993
]
]
]
},
"attributes": {}
},
"contributors": null,
"retweet_count": 0,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false
}
The only thing I actually need is the text key of the dictionary. The rest is currently useless for my app. I'll be requesting LOTS of tweets like this. How can I send a request to just to pull of the text key of the tweets? Currently, this method is extremely inefficient.
You can't. The best you can do is set up a proxy which will request the data, strip it back, and then forward it to the mobile.
If it's any consolation, the JSON will be gzip'd and so should still be relatively small - so won't take too long to transfer or eat in to the user's data allowance.

Resources