How to post to just the "My Notifications" or "Action Required" view in Connections? - ibm-connections

In IBM Connections 4.0 and 4.5, I'm trying to make a custom Java app imitate much of the activity-stream behaviour of the Activities app.
The Java code uses the Social Business Toolkit to post to activity streams, and authenticates as a user that has access to post to other users' streams, but I'm also testing with RESTClient in Firefox while logged in as the same special user.
The Activities app sometimes does the following things, which I can't figure out how to do:
Posts to a user's "My Notifications" view; and
Posts to a user's "Action Required" view without the post also appearing in "I'm Following".
How do I achieve these things?
For the first item, I've tried posting to "http://server.company.net.au/connections/opensocial/basic/rest/activitystreams/UserId/#responses/#all", but that doesn't work as desired. The event always appears in "I'm Following" when I want it to appear in "My Notifications".
Additional note regarding "My Notifications":
One of several events I'm trying to imitate is the notification to a person that they were added to an activity. In attempting to create the notification, I have added a person to an activity, logged into Connections as that person, copied the JSON from their "My Notifications" stream, then posted one of those events back to that person's stream with the bare minimum of changes required to make Connections accept it.
No matter what group I post to (such as #responses), the event I've created always appears in "I'm Following" despite the original being in "My Notifications".
For the second item, I have got events to appear in "Action Required" by setting the actionable flag in the JSON data, but those events also appear in "I'm Following" when I don't want them to do so.

There is the actionable events component http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Support_for_Saved_and_Actionable_events_ic45&content=pdcontent
You'll need to use the connections extensions to the data model.
"connections": {
"actionable": "false",
"broadcast": "true",
"rollupid": "87d7a7fb-af22-403b-ab0d-d101d9caac4f",
"saved": "false",
"canUnFollow": "true"
},
For my notifications, I suggest you look at the data model of the other events already posted, such as a File share. These are generally events related to things created in a connections service... use the link
https://SERVERNAME/common/opensocial/basic/rest/activitystreams/#me/#responses/#all?shortStrings=true&format=json
to grab the fields you need from "connections"
You can also look at Data Model
The following describes the fields.
Extensions Overview

Related

Why doesn't the Azure Bot Service Slack connector forward Events and Interactive Messages?

Update: June 30, 2020
After more testing, I have details that might help someone recognize my problem.
The issue seems to be that Slack is sending data to Azure Bot Services, but that data isn't being forwarded to my code. Ive been able to use the Bot Emulator without any problems and the Azure Web Chat works fine.
I know that the Slack configuration for the OAuth Redirect URL is correct (I was able to add my bot to Slack) and the Request URL for Events is correct (they sent the 'challenge' and it's verified). I've subscribed to the exact Scopes and Events that are in the Microsoft documentation and I've verified that the Interactivity and Events options are enabled.
When a user types text in my bot's Slack channel, my app receives "message" activity and my code can send a response, so it looks like Microsoft can communicate end-to-end for normal messages. I do not receive any data when users first join my bot (like a ConversationUpdate) or if they click a button in a dialog. I can see Slack sending data when a button is pressed, it just never arrives.
As a test, I copied the Messaging Endpoint from my Azure bot settings and pasted it into Slack's Interactivity "Request URL" and when I click a button in Slack I can see the data that Slack is sending (sadly in a format that my code can't handle).
Original Post
I have a Bot Framework app (v4) that I've written in nodejs. It works well and I have an ActivityHandler that responds to people being added to a conversation and when they send messages. I was able to get pro-active messaging functioning and everything was great until I tried to get interactivity working.
I started off using some sample button code from Microsoft's documentation:
let reply = MessageFactory.suggestedActions(['Red', 'Yellow', 'Blue'], 'What is the best color?');
await turnContext.sendActivity(reply);
This works fine in the emulator, but in Slack it renders as a bulleted list. It looks like that's the way that "suggested actions" are handled in Slack.
I changed my code to use a "hero card":
let card = CardFactory.heroCard(
'What is the best color?',
undefined,
CardFactory.actions([
{
type: 'imBack',
title: 'Color Red',
value: 'Red Value'
}
])
);
let reply = MessageFactory.attachment(card);
await turnContext.sendActivity(reply);
This works okay in the emulator, except my app thinks the user typed "Red Value" and the button stays on-screen and is still clickable. I might be able to work around that, but the button doesn't work at all in Slack. It is rendered fine, but I don't get a notification in my app.
Clicking the button shows an HTTP request to:
https://{MY_SLACK}.slack.com/api/chat.attachmentAction?_x_id=f8d003c3-1592436018.632&_x_csid=NcWi3y50lFU&slack_route={OTHER_SLACK_STUFF}
And I can see that the request POSTs all sorts of data including:
payload: {"actions":[{"id":"1","name":"imBack","text":"Color Red","type":"button","value":"Red Value","style":"default"}],"attachment_id":"2","callback_id":"{MAGIC_NUMBER}:{TEAM_ID}","channel_id":"{CHANNEL_ID}","message_ts":"1592435983.056000","prompt_app_install":false,"team_id":"{TEAM_ID}"}
I'm not sure how to see anything useful in the Azure Portal - the analytics option for my bot doesn't seem to work and the activities option only says "Write a Bot Service". I don't see any sign of the message going from Slack to Azure.
I'm developing locally and configured ngrok so that my messaging endpoint in Azure could be set to https://69fe1382ce17.ngrok.io/api/messages On the Slack side of things, I've configured the Interactivity Request URL to be https://slack.botframework.com/api/Actions The Event Subscription Request URL is https://slack.botframework.com/api/Events/{MY_BOT_NAME}
What I would like is a set of buttons with different options and when the user clicks one, my bot gets some sort of "value" instead of message text. I'd also like for the button to go away so the user can't send repeated commands. It would be nice if the hero card collapsed with just the prompt being displayed.
Are there any interactive options that work for Slack and other channels?
Thanks!
Lee
I know linking to another site with no additional detail is frowned upon, but I don't have enough expertise to answer your question. I suspect the link here might move you in the right direction:
Choice Prompts are not translated over to Slack format #3974
Good luck!
Your question is multifaceted so I'll try to break it down into smaller pieces.
What's the deal with suggested actions in Slack?
Suggested actions are not supported in Slack, but the Bot Builder SDK thinks they are. This is a longstanding bug. I've just reported it again on the docs page you linked: https://github.com/MicrosoftDocs/bot-docs/issues/1742
This means you would encounter problems if you were trying to have the choice factory automatically generate the right kind of choices for your channel. You're not doing that, so you should be fine. Hero cards are supposed to work in Slack.
Why aren't hero cards working in Slack?
First I need to mention that hero cards only work with the Slack connector and not the Slack adapter. You seem to be using the connector so you should be fine.
I suspect your problem is related to how you've configured your bot's settings on the Slack side. There is a step in the Bot Framework doc that seems to be important if you want to get buttons to work. If you've followed the doc exactly and you still can't get buttons to work, it may be worthwhile to dig into the Slack API documentation.
How do I only allow a button to be clicked once?
You can update or delete the activity. There's no easy way to do this, but if you voice your support for my cards library then it can be done for you automatically.
The Slack connector actually puts a lot of relevant information in the incoming activity's channel data, and you can use that to figure out what activity the incoming activity came from. That would take some experimentation on your part.
There's another approach that works on more channels than just Slack. It's real complicated, but if you wanna tackle this then here are the basic steps:
You need to put an ID in the action data to help your bot identify the action.
You need to save the activity ID that gets returned when you send the action to Slack.
You need to associate the returned activity ID with the ID you put in the action data.
You need to retrieve the activity ID using the action data ID when the user clicks the button.
You need to use that activity ID to update or delete the activity.
Unfortunately there's no centralized guide to help you do this, but there are many examples explaining it scattered across Stack Overflow. Here is a good one: https://stackoverflow.com/a/55174866/2122672

How To Change "Action and parameters", later on in your Google Action?

So I was using Gmail Google Action on my Assistant device and One thing that I found particularly intriguing was that when a user has given its message and email, after that assistant gives options for change or adding the message. That means on selecting those options, assistant will change the value of message entity or edit it as per user command, without re-enabling the whole intent.
My question is how can I implement this functionality in my Google Action. Is there any particular function made by Google that I can use or do I have to create one from scratch ?
Gmail's integration is a bit different than the way a third-party developer would do it, but you can save user input from the current session and modify it later on in your conversation. In your Action, this wouldn't be just one intent, but a few that would handle the work of modifying some session data and finally using that data to complete the user's original action.

subscription service - email sending

Am looking for some help in a subscription service email sending from domino using Xpages.
scenario : Paul Goodman is a building contractor and he would like to subscribe to his category named "Buildings and Road”.
When someone asks question about his category "Buildings and Road” he and everyone else that have the same subscription , should get email. I have a LS Agent that goes thought a view to send these emails but I would like
to have his done as soon as the message is saved and it has to send one at the time to void spam filters. I know I could execute the LS agent onSave but do you see another solution maybe with JavaScript ? I have only seen some .NET & PHP solutions here.
You have a series of options here:
Extract your logic into a LS library, so it can be used by several agents. Then have on that runs on save (and another one on a new subscription)
Use a DOTs task to listen to documents save - you can write your logic in Java then
Call an ?OpenAgent URL from your client side JavaScript
Put it into your XPage for new articles
Since you have the agent already, I'd go with the first one

Slack bot to pre-format channel responses of structured data input from user

At work we have a Slack channel where each person posts their daily scrum updates. The format is something like this:
Yesterday:
- Did something
- Did something else
Today:
- Did something
- Did something else
Blocks:
- This is blocking my progress
Now, I'm trying to find a way in which I can have this preformatted for my colleagues i.e. like placeholder text in HTML
Is there a way to achieve this in Slack?
The options I have considered so far are as seen here
1. Create a / command on Slack that would respond with this text when a user types /daily and populate the response (I'm not sure about the feasibility of this, I have only created slash commands that triggered an external process, not returned any text to Slack)
2. Create a custom application and integrate with Slack
I realize that the answer to this can be opinionated, and that that is discouraged in the community, but I'm thinking others might also have come across this issue or will, in the future, and the answer is relatively objective here, not purely subjective.
I have been developing a several Slack apps and came across similar requirements. Slack does currently not offer good options for entering structured data in my opinion, so I would recommend to rather use a HTML page with a simple form for entering the data which then automatically posts the update on Slack.
Options with pure Slack
You can use slash commands or a bot to receive the input from your user, but in both cases the user has to enter data command line style and is it not possible to use something like HTML placeholders. Your options are either to use keywords or to have a conversation between the user and the bot. The input is free text and will need to be parsed by your app.
Example for slash commands with keywords:
/daily yesterday "this and that"
/daily today "this and that"
/daily blocks "this and that"
Example for a bot conversation:
#scrumbot daily
"What is your update for yesterday?"
#scrumbot this and that
"What is your update for today"
#scrumbot this and that
etc.
I have been using both approached in my apps, but they are pretty clumsy and not very user friendly for entering larger amount of structured text.
Slack with HTML page
My recommendation would therefor be to rather use a simple HTML form to enter the text and then automatically post the result in the Slack channel. You can either use Sign-in with Slack or let the user click a generated link on Slack to connect a generated HTML page to the correct Slash user. The first offers better security, the later is more user-friendly.
Example:
/daily
"Please click *here* to enter your daily update"
Then a generated HTML page opens in the browser which allows the user to enter his data in a form. After submit the input is posted on Slack in the correct channel
Btw. the Slack team is planning to implement input field for Slack in the future, but this is currently scheduled for mid term, so I would not expect it to be available in the near future. See "Interactive messages Stage 3" on the Slack Plattform Roadmap.
Update September 2017
The Slack team have introduced a new method to enable users to enter structured data called dialogs.
Dialogs are similar to forms in HTML and allow to create modal dialog windows with multiple input field of various types (currently text, textarea, select) within Slack. They can be triggered as response to a slash command or an interactive message (buttons, menus).
The new dialog feature would now be the best choice to get structured input from the user like requested in this question.

IBM Connections Profile API to retrieve "about me"

I'm trying to access the "about me" field of a user's Connections 5 profile for a synchronization with our third party tool.
However, I don't seem to be able to find this field anywhere. I tried to access a user's (also my own) profile on /profiles/atom/profile.do?userid=5EEA50A0-0643-7A7D-C125-7D3800334349 but he returned feed does not include the desired information.
If i query profiles/atom/profileService.do I will get various link elements for my user profile none of which seem to include the "about me" field. However the result of this query includes a snx:editableFields section which contains a <snx:editableField name="description"> element which might refer to the desired "about me". Sadly, this field is empty for this request, although I know that my user has some information stored for "about me". All other fields in the snx:editableFields section do also not contain any data, so maybe this information is just structure description rather than really meant to hold the data?
Has anyone successfully tried to retrieve the "about me" or maybe "background" (snx:experience?) user properties via the API? Am I just missing the right call in the API documentation?
Thanks!
Try this URL
https://<your host>/profiles/atom/profileEntry.do?output=vcard&format=full&userid=<userid>
You will have two fields in the response
X_EXPERIENCE:<p dir="ltr">FOOBAR</p>
X_DESCRIPTION:<p dir="ltr">ABOUTLUCKY<br>

Resources