Confluence User Macro get email address - confluence

Hi I'm trying to get the email address of a user with a supplied username parameter. I've been looking on here: https://docs.atlassian.com/atlassian-confluence/6.6.0/
But I haven't been able to find what I'm after.
I'm able to get the users name and profile pic, but I'm stuck on email, so if anyone could point me in the right direction that would be great!
I'm looking to do something like this, where I request the users email address based on the supplied username. But I can't find anything that matches up to that.
#set($email = $action.getEmail($paramUsername)) //one that I've tried but doesn't work!
--Full name and User pic if that helps anyone else!
> #set($displayName = $action.getUserFullName($paramUsername))
> #set($userPic = $userAccessor.getUserProfilePicture($userAccessor.getUserByName($paramUsername)).getUriReference())
Thanks!

Someone on another forum kindly helped me out and I thought I'd post the answer here in case anyone else stumbles on this question!
$userAccessor.getUserByName('$paramUsername').getEmail()

Related

Get user that made the comment in facebooks instagram graph api

Im building an application that manages comments for instagram business profiles, and i'm a little surprised that there doesn't seem to be a way to get info of the user who made the comment.
The docs seem to point this way too:
Reading a Comment
To read an individual comment's metadata, send a GET request to the /{instagram_comment_id} node and include any of the following fields:
...
user (only returned if the user making the query also made the comment)
So, am i to understand that there is no way to get the info of a user which made a comment on a media of the profile i manage or is there something i am missing? any help would be appreciated.
Thanks in advance
This url worked for me:
v3.0/{comment_id}?fields=id,timestamp,username,text
somehow I was able to get the username from graph API, but I'm not getting the fields name, profile_picture_url, etc. this is my URL for getting the username.
GET https://graph.facebook.com/v2.11
/123?fields=mentioned_comment.comment_id(456){user{id, username}, text}
123 - instagram_business_account id
456 - comment id
You can get full user details from username by Calling Instagram API(Maybe it's against there privacy policy). suppose stackoverflow is the username, by calling this API you will get full data.
https://www.instagram.com/stackoverflow/?__a=1

Either / Or "Optional" Required Fields in Zapier

I am making an Action in Zapier for my App.
I have two fields where only one needs to be filled.
For eg: The user can either enter the email or phoneNumber but not both.
So I cant use the 'Required' attribute because it will ask user to enter both.
I couldnt find a solution in the Zapier Documentation also.
Kindly Help
Thanks
David from the Zapier Platform team here.
The best way to do this is mark neither field as required, but include help text for each field that mentions that either one or the other is needed.
Then, before you make your request, verify that a || b is true. If it's not, throw an error telling the user they have to supply either.
Hope that clears it up!

Custom tags in Jira email handler

Is there a way to make a Jire email handler ignore the From field in an email and go for a custom tag instead? I know I could work with the API instead but that's in the pipe. this is a temporary solution that will be used until a more robust system is built.
To clarify what we have today:
Email is sent to inbox, (hr#company.com)
Jira picks is up and creates an issue.
Jira looks at the From field and creates a uses if none exist.
What we're trying to achieve:
Form is filled out, and an area is chosen (hr, facilities etc.).
Form is posted to an API that creates an email (basically a no-reply adress over SMTP) and sends it to the appropriate inbox (for example hr#company.com).
Email lands in the inbox and Jira looks in it and creates an issue in project or label 'HR'.
Jira now looks in the email and finds custom tags named [user] and [user-email] (or something) and creates a user from the tag.
Example email
From: no-reply#company.com
To: hr#company.com
Subject: Some problem
Body: Explanation of problem
Have a good day!
/Mike
[user:"Michael Smith"]
[userEmail:"michael.smith#company.com"]
If we were to implement this system now, we would loose the possibility to create new users because all emails would come from the same "no-reply" adress.
I have searched in the Atlassian forums and such, but with no luck. Have not found anything in the official documentation, but I fear that I might be looking in the wrong place.
I hope that I'm being clear, and that someone has any idea if it is possible.
Thank you!
You need to write your own plugin and create your own Mailhandler.
For example you can use a regex which looks for the tag
[userEmail:"michael.smith#company.com"] and retrieve the emailadress from the string. Do the same for the [user]-tag, if the user doesn't exist.
Here is a tutorial that shows how to create and setup custom Message Handlers:
https://developer.atlassian.com/jiradev/jira-platform/guides/email/tutorial-custom-message-mail-handler-for-jira#Tutorial-Custommessage(mail)handlerforJIRA-Step7:Implementarealmessagehandlerback-end
The rest should be easy from here.

Yammer REST API - Documented Parameter not working

The API documented here - http://developer.yammer.com/restapi/#rest-users clearly states:
"4) Alias to /api/v1/users/current user’s id.format. Supports include_followed_users, include_followed_tags, and include_group_memberships parameters.
GET https://www.yammer.com/api/v1/users/by_email.json?email=user#domain.com`
Yet, when we try this, it does not return any followed user information at all! The request we're using is like so:
https://www.yammer.com/api/v1/users/by_email.json?email=me#company.com&include_followed_users=true
However, this request DOES return followed users, but only for the current user:
https://www.yammer.com/api/v1/users/current.json?include_followed_users=true
Am I missing something completely obvious and being stupid or is there a real issue here? If this was taken out for whatever reason, then you'd have thought that the API documentation would have been updated.
The Yammer Team did eventually get back to me on this. Their response below:
(I've removed https://www.yammer.com from URLs because I don't have enough rep' to post more links)
Hey Jason Dunbar looks like the documentation here is wrong.
I looked in to this and had some conversations with a few engineers this week and have the following (albeit more arduous workaround):
1) Call get user by email endpoint and retrieve the id attribute from here: /api/v1/users/by_email.json?email=user…
2) To grab following users, take that id and:
GET /api/v1/users/following/[:id].json
3) To grab group memberships for that user you'll need to impersonate him/her (verified admin only) and
GET /api/v1/users/current.json
We'll get the documentation updated ASAP with this. Also happy to keep the conversation going to help if needed.
Make sure you are setting the email parameter to the user's email that they are registered with.
E.G. if your company has multiple domains but the Yammer network is under bigco.com and the user is registered with an email under bigcosubsidiary.com you'll need to make a request to the API with user#bigcosubsidiary.com.
-as mentioned - it looks like its only for current.json - you can check it here http://yammer-dev.herokuapp.com/endpoints/4 - hope it helps.
Rich

Tagging a user in a wall post/update using Facebook API

I'm using stream.publish to write to the user's wall and attempted to get "# tagging" to work but with no avail.
If the user's name is Fred and his uid is 1234, I tried sending over "#Fred", "#1234", "#[1234]", "#[Fred]", etc. and couldn't get it to work. The raw string would display every time.
Can someone confirm if this is possible with the API or not? Thanks!
the correct syntax is
#[user_id:1:name]
it shows as a tag, but it doesn't trigger a notification. Anyone knows why?
Maybe you need follow this: NOTE: You cannot specify this field without also specifying a place.
You need to specify a place with the fan page ID of the location associated with the post.
more… https://developers.facebook.com/docs/reference/api/user/#posts
reese:
#[user_id:1:name] - It will replace it with the 'name' which you have given
#[user_id:0] - This will notify the user BUT it will happen when you MANUALLY typing it in wall or comment section NOT through graph api, say for eg., if you want to notify this user #[user_id:0] so you are appending this text in message parameter of https://graph.facebook.com/feed api it won't work, I hope you understand :)