Yammer.connect.embedFeed - starting a new conversation with a page URL that already belongs to another conversation - yammer

Here's the scenario: we're using yammer connect on an internal website for a specific team that has it's own yammer group. This website displays thousands of "items" and yammer is used to manage discussions about each item using the url (e.g. http://somesite/item?id=123). All was going well until someone in a different yammer group created a conversation and used a URL that points to a page in my internal website (e.g. http://somesite/item?id=123). So now when users go to that item they see a conversation for a different group.
I'm using the defaultGroupID in the config argument, but is there a way to tell yammer to ristrict it to a specific group id - and create a new conversation for that group only for the given URL (if one doesn't exist)? Can yammer even create multiple conversations in different groups regarding the same url - but keep the conversations restricted to each group?
Here's a code sample of how I'm creating the conversations:
var varYammerTargetUrl = $('#hidYammerTargetUrl').val();
var varYammerGroupId = $('#hidYammerGroupId').val();
var objProps = { url: varYammerTargetUrl, type: 'page', title: document.title };
yam.connect.embedFeed({
container: '#yammerFeed', network: 'mycompany.com', feedType: 'open-graph', feedId: '',
config: {
use_sso: false
, header: false
, footer: false
, showOpenGraphPreview: false
, defaultToCanonical: false
, hideNetworkName: false
, defaultGroupId: varYammerGroupId
, promptText: 'Start a conversation about this concession'
}
, objectProperties: objProps
});

When URLs are posted into Yammer there is an open graph object created. These objects don't live in groups by design and thus can be created anywhere within Yammer and are not restricted to certain groups.
Here is some additional documentation.

Related

Plaid Api wont let me authenticate account with account/routing number

Using Plaid version "2020-09-14". I am following these instructions https://plaid.com/docs/auth/coverage/same-day/
I'm using node js to generate a link token and i successfully do:
var plaid = require('plaid');
const client = new plaid.Client({
clientID: process.env.PLAID_CLIENT_ID,
secret: process.env.PLAID_SECRET,
env: process.env.PLAID_ENV
});
console.log('client is ',client)
app.post('/api/create_link_token', async function (req, res) {
try{
const response = await client.createLinkToken({
user: {
client_user_id: '123-test-user-id',
},
client_name: 'Plaid Test App',
products: ['auth'],
country_codes: ['US'],
webhook: 'https://webhook.example.com',
language: 'en'
})
return res.send({link_token: response.link_token})
} catch (error) {
// handle error
console.log('error',error)
return res.send({err: error.message})
}
});
I get a link token everytime I run this. Then, i use said link token to try to authenticate the user's bank by using same day micro deposits (my company is setup for this through Plaid).
What keeps happening is the screen pops up that asks you to search for your bank and I do not want that. I want the screen to popup just like the one at the top of the page in the link I listed above. It asks the user for their name first, then routing, then account numbers.
How do I make the Plaid api show me the screen that prompts the user for their accounting/routing numbers without trying to authenticate them automatically with their bank username and password?
Thanks
You can't, at least right now, using publicly released Plaid APIs. (You're not the first person to ask for this, and we're working on some stuff that should help, but it isn't yet available to the developer general public.)

Shopping cart saved in firebase - order processing

my next question is about Firebase.
I have an application with spare parts for a car. In the application, a user authorized by email and password adds spare parts to his cart, which is stored in Firebase.
Question: how, by clicking the "submit order" button, send the contents of the cart to the seller (me) by mail?
Perhaps Firebase already has a ready-made solution / service for a similar task?
Does Apple's policy allow you to send the user's email address that was provided during registration for order feedback along with the request?
Here i trying to send order by MFMailComposeViewController
#IBAction func sendRequestButtonTapped(_ sender: UIButton) {
// Modify following variables with your text / recipient
let recipientEmail = "MyMail#gmail.com"
let subject = "description"
var body = "some array with ordered spare parts"
for i in objectsList {
body.append(i.objectFromPartsCatalogueListCode! + " " + i.objectFromPartsCatalogueListName!+"\n")
}
// Show default mail composer
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self //!!!
mail.delegate = self //!!!
mail.setToRecipients([recipientEmail])
mail.setSubject(subject)
mail.setMessageBody(body, isHTML: false)
mail.modalPresentationStyle = .fullScreen
self.present(mail, animated: true)
// Show third party email composer if default Mail app is not present
} else if let emailUrl = SendEmailManager.createEmailUrl(to: recipientEmail, subject: subject, body: body) {
UIApplication.shared.open(emailUrl)
}
It is difficult and opens an additional menu for choosing the method of sending. I want to receive an order with content from the application on my mail, one click by the user of the "sendRequest" button.
You can easily send emails from your app via a secure backend environment (eg. cloud functions).
There are many possible solutions, but here is one of them:
When a user hits submit, you can create a new document in a special Firestore collection (eg. emails) and have a cloud function listening to changes in that collection using a background trigger Firestore event triggers. This function will get the document changes, retrieve its data (email information, and any other metadata you've specified), and send an email using whichever email API you decide to use (eg SendGrid).
Alternatively, you can use the Firebase email extension Extension, but writing your own function isn't difficult.
An added benefit is you can store your personal email in your secure backend environment so your users won't be able to access it on their devices.

How to show live users active on a particular page / routed vue-component, on home page?

I am developing an application where users create custom playlists from youtube video urls and those playlist are shown at homepage. When a user click on playlist, it is redirected to a page showing videos in that particular playlist.
Technology stack: Laravel 5.8, Vue, MySql, Pusher
What I have tried so far:
Home Page Component (PublicPlaylist.vue) listens to a channel: live-playlist-playing on mounted() event
this.channel = window.Echo.channel(`live-playlist-playing`);
this.channel.listen("LivePlaylistPlaying", e => {
this.object_array.push(e);
var array = this.object_array;
var seenNames = {};
array = array.filter(function(currentObject) {
if (currentObject.playlist_id in seenNames) {
return false;
} else {
seenNames[currentObject.playlist_id] = true;
return true;
}
});
this.distinct_object = array;
})
whenever another user goes to a playlist page e.g. www.example.com/playlist/1 its component SinglePlaylist.vue calls api to fetch details:
mounted(){
window.axios
.get(
"/api/playlist/"+this.playlist_id,
{
headers: fetchAuthHeaders()
}
)
.then(response => {
this.playlist = response.data.data;
})
.catch(error => {
// if (false == isErrorHandled(error, this)) {
// consoleLog(error);
// }
});
}
Above API method broadcasts an event which is listened by the channel live-playlist-playing, as follows:
public function viewPlaylist($playlistId)
{
/**
some code
*/
broadcast(new LivePlaylistPlaying(Auth::user()->name, $playlist->playlist_name, $playlistId));
return response()->api(true, 'Playlist fetched successfully', $playlist);
}
I hope I have tried to disclose as much as details but you are free to ask for more information; coming back to question, Above code works fine for this case, steps to be taken in consideration.
suppose a user A is on home page and
now user B access the single playlist page
A will get to know a playlist is being accessed by another user.
But what if user B comes first i.e
User B accesses the single playlist page
User A comes on home page
A will not get any information about playlist being played until a user C comes in the picture.
It seems you could benefit from using Presence Channels:
This makes it extremely easy to build chat room and "who's online"
type functionality to your application. Think chat rooms,
collaborators on a document, people viewing the same web page,
competitors in a game, that kind of thing.
You will need to authorise your connections, then you can subscribe to a presence channel. Presence channels broadcast a member_removed or member_added event whenever someone joins or leaves the channel, which you can use to identify when users are on the page regardless of what order the users join the page.

One Bot App to support many Facebook pages [duplicate]

I love the bot framework, but I want to scale to support hundreds if not thousands of Facebook pages all pointing to my single bot instance. My bot instance differentiates functionality by the incoming page id, or I guess by the MSFT App/Secret IDs.
The framework appears to require a 1:1 correspondence between logical bot hosted by MSFT and a FB page, but my single bot instance can handle thousands of such pages and apps.
It looks like I might need to create a unique ChatConnector and associated UniversalBot instance for every logical bot-page. This is horribly inefficient at the scale I'm suggesting.
One way to solve this might be to extend UniversalBot to accept a list of all MSFT App and Secret IDs that I create, but I haven't tried this yet. After reviewing the API, looks like it might be possible to register more connectors with a single UniversalBot instance.
UniversalBot:
/**
* Registers or returns a connector for a specific channel.
* #param channelId Unique ID of the channel. Use a channelId of '*' to reference the default connector.
* #param connector (Optional) connector to register. If ommited the connector for __channelId__ will be returned.
*/
connector(channelId: string, connector?: IConnector): IConnector;
But not sure what I pass for channelId unless that's an arbitrary unique local value.
I have reviewed other/similar posts here, but not found specifically anything that I believe addresses my issue. If I'm mistaken I apologize and would appreciate a reference.
I am hoping someone might have a better idea. I am using Node btw. Thanks.
Taken from here:
Creating a Single Bot Service to Support Multiple Bot Applications
var express = require('express');
var builder = require('botbuilder');
var port = process.env.PORT || 3978;
var app = express();
// a list of client ids, with their corresponding
// appids and passwords from the bot developer portal.
// get this from the configuration, a remote API, etc.
var customersBots = [
{ cid: 'cid1', appid: '', passwd: '' },
{ cid: 'cid2', appid: '', passwd: '' },
{ cid: 'cid3', appid: '', passwd: '' },
];
// expose a designated Messaging Endpoint for each of the customers
customersBots.forEach(cust => {
// create a connector and bot instances for
// this customer using its appId and password
var connector = new builder.ChatConnector({
appId: cust.appid,
appPassword: cust.passwd
});
var bot = new builder.UniversalBot(connector);
// bing bot dialogs for each customer bot instance
bindDialogsToBot(bot, cust.cid);
// bind connector for each customer on it's dedicated Messaging Endpoint.
// bot framework entry should use the customer id as part of the
// endpoint url to map to the right bot instance
app.post(`/api/${cust.cid}/messages`, connector.listen());
});
// this is where you implement all of your dialogs
// and add them on the bot instance
function bindDialogsToBot (bot, cid) {
bot.dialog('/', [
session => {
session.send(`Hello... I'm a bot for customer id: '${cid}'`);
}
]);
}
// start listening for incoming requests
app.listen(port, () => {
console.log(`listening on port ${port}`);
});
We are creating different bot and connector instances that capture the App ID and password for each customer, and binding it to the corresponding REST API that is used by the Bot Framework as the Messaging Endpoint.
When we create the bot instance, we call the bindDialogsToBot method, passing the bot instance and the customer ID. By doing that, we capture the customer ID in its closure making it accessible to the internal dialogs.
When a call is made to one of the REST APIs, the relevant bot instance is used, and the correct customer ID can be utilized by the dialog’s internal logic to process the request (for example, to retrieve a customer’s configuration/rules and act upon them).

Get a list of current clients with usernames

I am making a simple chat, so when someone logs on I have this:
socket.broadcast.emit('logon', {
socketID: socket.id,
username: username
});
So if I login via chrome as "Bob", and then I log in via Edge as "Ted", I will see "Ted" when "Ted" logs in and I am looking at the chat with chrome.
But how do I get the list of current clients with usernames as soon as I log in?
So if "Ted" is already there, and I log in as "Bob" from a different browser, I want to see "Ted" in the list.
Is it possible to do without using a database to store each user that logs in, as that is the only way I can think of but would prefer not to use a database?
There is no need to use a database. The only thing you must have is an array of users that is connected to certain event listeners server side. Example:
var users = []; // Array of users online
io.on('connection', function(socket) {
var user = { // On connection, create an object for the user.
socket: socket,
username: null
}
socket.on("login",function(data) { // When the user logs in, set his username and add him to the users array.
user.username = data.username;
users.push(user);
});
socket.on("disconnect",function() { // When user disconnects, remove the object from the array.
var index = users.indexOf(user);
if (index !== -1) users.splice(index);
});
});
As you can see, there is now an array of all online users that you can access.

Resources