Cli-microsoft365: Feature addition: Yammer post message

Created on 8 Sep 2019  路  10Comments  路  Source: pnp/cli-microsoft365

Hi guys,
I would like to start providing some contributions to your project. This is the first time for me here and was wondering if you are interested to get some commands in the Yammer space as you already did for the Outlook section.
I thought I am going to start with a simple Yammer post command first.

Is this something you might be interested in?

Best regards,
Patrick

new feature work in progress

Most helpful comment

This command will post a message on behalf of a user. I am going to implement the basic parameters first. It can be extended in a second-round if required.

yammer message add --body "my body" --replied_to_id 1231 --direct_to_user_ids 12,11 --group_id 123123 network_id 123123

I am taking the details from https://developer.yammer.com/docs/messages-json-post.

  • body (required): The text of the message body.
  • replied_to_id (optional): The message ID this message is in reply to. If this is set then group_id and network_id are inferred from it.
  • direct_to_user_ids (optional): Send a private message to one or more users, specified by ID.
  • group_id (optional): Post the message to this group, specified by ID. If this is set then the network_id is inferred from it. A post without direct_to_user_ids, replied_to_id or group_id will default to All Company group
  • network_id (optional): Post a message in the 'All Company' feed of this network, if replied_to_id, direct_to_user_ids, and group_id are all omitted.

I am going to return the ID of the created message if the output method is not JSON. If the output method is JSON I am going to return the whole JSON object returned by Yammer.
Yammer is usually returning an array of objects even if we just have one entry. I am going to manipulate this to return a unique object.

If the way the command gets implemented is fine for you, I am going to start with this command first to get used to your process. I am going to implement some more commands in this area. For this, I am going to create new issues.

Thank you,
Patrick

All 10 comments

Of course! On behalf of the team, I appreciate you reaching out and offering help.

Typically, before we start building a command, we agree on its spec. Since you proposed the command, would you like to give it a shot? You can find an example of an issue with a command spec here: https://github.com/pnp/office365-cli/issues/1042. To help you understand how commands work and what's included, we put together some guidance here. Once again, thank you for reaching out and please, don't hesitate to ask any questions. 馃憤

This command will post a message on behalf of a user. I am going to implement the basic parameters first. It can be extended in a second-round if required.

yammer message add --body "my body" --replied_to_id 1231 --direct_to_user_ids 12,11 --group_id 123123 network_id 123123

I am taking the details from https://developer.yammer.com/docs/messages-json-post.

  • body (required): The text of the message body.
  • replied_to_id (optional): The message ID this message is in reply to. If this is set then group_id and network_id are inferred from it.
  • direct_to_user_ids (optional): Send a private message to one or more users, specified by ID.
  • group_id (optional): Post the message to this group, specified by ID. If this is set then the network_id is inferred from it. A post without direct_to_user_ids, replied_to_id or group_id will default to All Company group
  • network_id (optional): Post a message in the 'All Company' feed of this network, if replied_to_id, direct_to_user_ids, and group_id are all omitted.

I am going to return the ID of the created message if the output method is not JSON. If the output method is JSON I am going to return the whole JSON object returned by Yammer.
Yammer is usually returning an array of objects even if we just have one entry. I am going to manipulate this to return a unique object.

If the way the command gets implemented is fine for you, I am going to start with this command first to get used to your process. I am going to implement some more commands in this area. For this, I am going to create new issues.

Thank you,
Patrick

Thanks for the proposal. From the end-user point of view, how would the user know the IDs of the message to reply to, users, group or network? I'm afraid, that without offering a way to obtain these IDs first, this command will not be used much.

Good point. My aim was to provide more endpoints. I suggested in #1107 to return and search for users by id and e-mail. If you want, I can build that one first.

My code is ready for this solution. Should I just create both commands and submit one PR?

We should also consider returning all users in a Yammer network. #1113

Since Yammer is a new area, I'd suggest that we start on top of the hierarchy with commands for listing networks, users and other top-level objects which are necessary to perform other actions like posting messages,

On a related note, have you looked into Yammer auth and if there are any changes required for us to be able to connect to Yammer before we can implement any Yammer command?

Hi,
My suggestion is to follow this approach.

  • network listing: #1115
  • user retrieval: #1107
  • full user retrieval: #1113
  • yammer message list: #1104
  • yammer message retrieval: #1105
  • yammer message posting: #1105
  • yammer message delete: #1106
    Then i would got and implement the group commands. Afterward, we should try to look at what is left and improve the current commands further.

You need to add the delegated Yammer permissions in Azure AD to make it work with the CLI.
If you want to have a call to go through the discussion to speed up the process, let me know.

br,
Patrick

Makes sense. Let's start with network listing and take it from there. While working on it, you can use a custom AAD app so that you don't need to wait on us updating the CLI AAD app with the necessary permissions. Once you submit a PR we can then update the CLI AAD app so that everyone can use the command.

Fine. Will start with the work

Was this page helpful?
0 / 5 - 0 ratings