How to get the follow user with details from GetStream following API - node.js

I have created users with GetStream (using client.user(user.id).getOrCreate({});) and getting those users full details in the Feeds. Could I get the same User details in the following API too?.
currently, I get the
user:ID as target_id
only.
"results": [
{
"feed_id": "timeline:d9fa73e8-9cd7-4ac1-aa4b-fe148971e1f0",
"target_id": "user:6bb0fb62-ed9a-4966-b713-774f1d7aa3e5",
"created_at": "2019-03-06T06:36:36.97424846Z",
"updated_at": "2019-03-06T06:36:36.97424846Z"
},
{
"feed_id": "timeline:d9fa73e8-9cd7-4ac1-aa4b-fe148971e1f0",
"target_id": "user:admin",
"created_at": "2019-03-05T13:49:13.52832166Z",
"updated_at": "2019-03-05T13:49:13.52832166Z"
}
]
Is there any chance to get the user full details in following and followers APIs too??

Unfortunately there is no way to do it, although we are aware of this limitation and we have this task in our backlog.
For now, the recommended approach is to request the user data from your own backend

Related

How to get the user id from Slack to bot service

I am creating a simple bot using Azure LUIS and this is my first one. I made some decent progress after doing some research and also now integrated with Slack as channel to test it.
The bot functionality is working fine, but I am looking to identify the user. So that I can personalize the bot conversation and also to pull the user specific information from his profile table.
Is there anyway, that I can get a UID or any reference ID of the slack user and so I can store that in my user table along with user profile?
So next time, when the user greets the bot, the bot can say "Hello, John." instead of justing say "Hello."
Thanks!
Yes. You can use the channelData object to get the ApiToken, and user values. For example, in C#, you could use turnContext.Activity.ChannelData to get those values in JSON:
{{
"SlackMessage": {
"token": "............",
"team_id": "<TEAM ID>",
"event": {
"type": "message",
"text": "thanks",
"user": "<USER WHO MESSAGED>",
"channel": "............",
"channel_type": "channel"
},
"type": "event_callback",
"event_id": ""............",
"event_time": 1553119134,
"authed_users": [
"............",
"<USER WHO MESSAGED>"
]
},
"ApiToken": "<ACTUAL TOKEN HERE>"
}}
Then, using those two pieces of information, you can then retrieve info from Slack.
https://slack.com/api/users.info?token=<ACTUAL TOKEN HERE>&user=<USER WHO MESSAGED>&pretty=1
And get a response that has the info you need:
{
"ok": true,
"user": {
"id": "<USER WHO MESSAGED>",
"team_id": "<TEAM ID>",
"real_name": "Dana V",
Ideally, you would would probably want to have bot user state setup and check that first, then if not there, then make the API call to Slack, then store in state. Therefore further requests don't need to go to Slack, but will just pull from the state store.
Basically, you could/should do this in the onTurn event. First, create your user state storage such as here.
Then you could check for that value and write to it if not populated. This example on simple prompts, might be helpful. You won't need to prompt for your user's name, as this example does, but does read/write username from state. You could still use dialogs, but you won't need them for the name prompting as you are doing that dynamically.
You can see here where username is being set and here where it is being retrieved. In this case, it is in the dialogs, but again; you would/could just do in the turn context (using logic to get and if not there, set).
I found the solution by priting the whole session object, which is having all the required informaiton. This could be same as mentioned by Dana above, but after debugging, this follwing made simple without making any changes.
var slackID = session.message.address.user.id
With above, I am able to identify the user.
Thanks.

Docusign - API to reactivate a closed user

I've been able to reactivate a closed Docusign user from the Admin Console, but is there a REST API for that? The Users doc doesn't seem to mention this.
I know there's a similar question on this topic, but there was no resolution found yet. I'm posting this question again hoping that it gets the attention of Docusign people, as they recommend posting API-related questions on SO rather than their own support/community forums.
Also, if there's an API that does exist to recreate/reactivate a deleted user, please document it with clarity. Spelling out what each REST operation does and how it affects something are very important to developers who use such API.
You can reactivate the deleted user by passing the same user details to CreateUsers api.
Please note that the email/password/userName combination should match the user that was deleted.
Here is a sample request to the CreateUsers API.
{
"newUsers": [
{
"email": "johnsmith#acme.com",
"password": "**********",
"userName": "johnsmith"
}
]
}
This is also possible to do via the UserId and an UpdateUsers call
PUT {VX}/accounts/{accountid}/users/
{
"users": [{
"userId": "00000000-0000-0000-0000-000000000000",
"sendActivationEmail": "send"
}]
}

Api version change but docs not updated?

I've been trying to do various things through your Mail REST API today and not having much success... My project (using the api) has been running for at least a month now, but requests to your api are failing.
For example:
GET https://outlook.office365.com/EWS/OData/Me/messages (works)
GET https://outlook.office365.com/EWS/OData/Me/inbox (doesn't work)
Looking at the documentation, still says its available.
Trying to send an email using:
POST https://outlook.office365.com/EWS/OData/Me/Messages?MessageDisposition=SendAndSaveCopy also just returns 400 (Bad Request)
Any info about this?
Also, the http status codes returned are not useful at all; almost all errors return as 400's. In one instance, I didn't provide auth creds, and a 400 was returned instead of the appropriate 401. The accompanying status code detail could also be more helpful.
Thanks for the feedback and sorry for the inconvenience. We are currently deploying some non-backwards compatible changes described here, and this is causing your issues. The current set of changes including versioning support, and deploying non-backwards compatible changes won't cause issues for your app in the future. For the queries, that don't work, please use the following:
Accessing Inbox: https://outlook.office365.com/ews/odata/me/folders/inbox
Send email (new action called SendMail):
POST https://outlook.office365.com/ews/odata/me/sendmail
{
"Message":
{
"Subject": "Test message",
"Body":
{
"Content": "This is test message!"
},
"ToRecipients":
[
{ "EmailAddress": { "Address": "John#contoso.com", "Name": "John Doe" }},
{ "EmailAddress": { "Address": "Jane#fabrikam.com", "Name": "Jane Smith" }}
]
},
"SaveToSentItems": true
}
Hope this helps. We are updating the documentation to reflect the changes, and it should be available shortly. Thanks for the feedback on the HTTP status codes, we will review the status codes returned currently and make any fixes required.
Conversation support is in our roadmap but we don't yet have a timeline to share. Currently, you can search using https://outlook.office365.com/ews/odata/Folders/FolderId/Messages?$filter=ConversationId%20eq%20%%27ConversationID%27 but this will only return messages within the specified folder belonging to that conversation.
Let me know if you have any questions or need more info.
Thanks,
Venkat

GitHub API v3: Determine if user is an Owner of an Organization

It's easy to determine if a User is a member of a Team if you know the id:
GET /teams/:id/members/:user
But how can one easily determine the ID of the special "Owners" team that every Organization has?
As far as I can tell, the only way is to retrieve a full list of all Teams (which I assume may be multiple pages?) and walk through them until you find one with the name "Owners".
This is doable of course, but it's uncharacteristically inconvenient for GitHub's otherwise fantastic API. ;)
For what it's worth, I've tried the following (with no luck):
GET /orgs/:organization/teams?name=Owners # Lists all teams
GET /orgs/:organization/owners # 404
Just to be clear, I've made sure to use a token associated with the user that owns the organization in question, so there shouldn't be any authorization issues.
There is currently no easy way to check if a user is in the owners team. Thanks for the cool feature suggestion, though! ;)
A hacky workaround would involve performing a non-destructive operation which only owners are allowed to do. If the operation succeeds - the authenticated user is an owner.
For example, you could try editing the organization's settings by sending an empty JSON hash:
$ curl -v -X PATCH -d '{}' https://api.github.com/orgs/:org?access_token=TOKEN
If this returns a 200 status code, the user is an owner. A 404 status code signals otherwise.
Hopefully we can provide a more elegant solution in the future.
As an alternative, quicker solution, you can use the memberships API to get details about the authenticated user's membership to each organization they belong to.
The request is simply GET /user/memberships/orgs?state=active, and the response looks like this:
[
{
"state": "active",
"role": "admin",
"organization": {
"login": "octocat",
"id": 1,
},
"user": {
"login": "defunkt",
"id": 3,
"gravatar_id": "",
"type": "User",
"site_admin": false
}
},
{
"state": "active",
"role": "member",
"organization": {
"login": "invitocat",
"id": 2,
},
"user": {
"login": "defunkt",
"id": 3,
"gravatar_id": "",
"type": "User",
"site_admin": false
}
}
]
The important field to note is role; we only want "role": "admin".
I'm not sure that this guarantees that the user is a member of Owners, but it does indicate that they have administrative powers of the organization.
Simply determine if they are part of the team named "owners" for that org https://developer.github.com/v3/orgs/teams/#list-team-members
Owners are a special team for GitHub with only owners.
See https://github.com/orgs/YOURORG/teams/owners

unable to configure a permission role in RavenDB

looking for some help or a blog post really regarding using the auth bundle with RavenDB..
using the HelloWorld example: http://ravendb.net/tutorials/hello-world
i'm trying to disable the user from querying for orders.. i've tried different auth roles approaches but i can't get the damn thing to work.
at present i've:
* created a authorization user
* created a authorization role
Id: Authorization/Roles/Orders
{
"Permissions": [
{
"Operation": "order/1",
"Tags": [
"Orders"
],
"Allow": false,
"Priority": 1
}
]
}
ID: Authorization/Users/ayende
{
"Name": "Ayende Rahien",
"Roles": [
"Authorization/Roles/Orders"
]
}
just can't get my head around how to filter out the orders from queries.
for example, querying orders/1 will return an order of 1 prior to applying the permission.
after using:
session.SecureFor("Authorization/Users/ayende", "orders/1");
I would expect orders to return no orders..
do i have this concept totally wrong or just configured my permission's wrong?
thanks
You can use the IsAllowed method to check whatever or not you can access a document or now, but also to check why you can / can't access a document.
Have you applied your permission to the document then invoked SaveChanges? Maybe if you post your code it would easier to tell what's happening.

Resources