I have two iOS apps, lets call it Agent app and Customer App.
I have a chat feature between these two apps, but the chats need to be recorded on the server.
I have created two Pusher Apps, one for each of the iOS apps. They both subscribe to their respective private-{id}-channel.
Now every time a message is generated from say Agent app (via HTTP request to server), I want server to create a pusher event with Agent's message on Customer's private channel.
Is it possible to achieve the above using Pusher Private channels?
One way you could achieve this is by having both users join the same channel.
Let's say you have two users: user-a and user-b. Both users subscribe to a common private channel private-chat-user-a-user-b.
let myChannel = pusher.subscribe("private-chat-user-a-user-b")
Then triggering client events on the channel
myChannel.trigger(eventName: "client-my-event", data: ["your": "data"])
Client events are a way of sending messages just between clients, without a server relaying them.
Disclosure: I work at pusher.
I wanted to record the chat on server, therefore, instead of making Customer App directly sending message on Agent App channel, I made the Customer App call my server API, which records the message and relies it on channel that Agent App is listening to.
Related
I have a deal I'm working on designing to deploy Amazon Connect to a contact center with 200 agents. Their volume is 95% outbound, and 5% inbound voice only. Their account managers receive qualified leads in their CRM (in this case SalesForce Service Cloud) and upon opening up the lead would like to click on the phone number in SalesForce and use the StartOutboundVoiceContact API to call the customer. Once they have the customer on the phone they would like to be able to do a no-hold consultative transfer to a different department that is staffed by loan officers and want to be able to do the following:
Agent A clicks on a button in the CCP or SF that places a new outbound call to a queue staffed with loan officers. Want to notify Agent B (the loan officer) that they are being reserved for a call from the account management department and then they "accept" the inbound call and Agent A is then able to bridge the two parties together and complete the transfer.
Is there a way to use DynamoDB, Custom CCP, and Lambda to build this type of solution?
Any thoughts or ideas would be greatly appreciate.
Sounds like you are looking for a "cold transfer"? This is doable using the Amazon Connect Streams API. Good blog post here that goes through several transfer scenarios.
It would not be possible to do a "no-hold" transfer for merging a call. Amazon Connect will always place someone on hold before joining a connection together for a conference call.
However, if you really wanted to bypass Amazon Connect's system, you could try the following( Using Amazon Connect Stream API ):
Silent the music for the queue that you are sending the call through.
Customer will be placed on hold for a few seconds.
Immediately merge the call onto the current call(Using Amazon Connect Stream API)
If agent connects within 7 seconds then current agent will terminate the call.
The one thing you can't get rid of would be the ringing to the third-party agent. Additionally, there may be some type of delay between the customer being placed on hold and being merged onto the current call. So, this may not be 100% ideal for your situation.
How can I listen for the creation of any new public channel on a chat service? I have seen client.channelAdded but it only works for private channels.
channelAdded
Fired when a Channel becomes visible to the Client. Fired for created
and not joined private channels and for all type of channels Client
has joined or invited to.
My use case is an internal support application where every first-time incoming SMS message from a customer user results in a new chat service channel for that particular customer user being created, and a chat message being added to the channel representing the SMS. The new channel is created via Twilio REST API.
I want to be able to have every agent user made away that there is a newly created channel (i.e. and open ticket), and then be able to join it if they want (thus making the channel public).
I supposed I could create all private channels and just invite all the agent users to the channel, but seems slightly hacky. Feels like there should be a cleaner way to do this.
Twilio developer evangelist here.
Thanks for the extra information you provided about your use case.
To start with, the channelAdded event will only fire under the circumstances that you described and not for every new public channel. Danila suggested using the webhook to trigger an event, but as you say you are already creating the channel yourself, so no need for a webhook.
Perhaps you could use a channel as a notification for your agents. Create a special channel that all logged in agents join. Then, when you create a new channel for a new open ticket, also send a message to the "open tickets" channel. You could use this channel to then simply notify your agents there is a new request, or you could fire off a function to get the latest channels so it is loaded and ready for your agent to join.
If you wanted something a little more lightweight than a chat channel for this, you could consider using a Twilio Sync list for the currently open tickets that you can then sync with your agents.
Let me know if that helps at all.
One of the possibilities to achieve desired is to add a webhook for the channel creation.
It may add member (customer support person) using REST API to the channel or will send a message to them using REST API.
I try to build a support center app with twilio or pubnub. it's fairly simple:
user starts a public chat
someone from the support team accepts -> public chat turns private
when supporter has anwsered the chat request, chat turns public again
The app would be build with titanium appcelerator for the user and angular for the support team.
Twilio
Since twilio doesn't provide a native titanium sdk, I looked into its programmable chat rest api - but in my opinion it lacks one important feature: when i open up a channel, I can't modify the create_by property. It is system by default. All I can do is, get all the channels at once for all users.
So I can't get all the channels one user is subscribed to. I would have to manage all channels by myself. Is that right so far?
PubNub
PubNub on the other hand I don't get. They encourage you to have not more than two channels per connection. But one user has to be able to open as many tickets as he likes. So how can i organize it? Also, their approach to private chats is to have a private chat-name. but then I don't know how I could switch between private and public without loosing the history. Can I move messages from public to private channel? One way I could think of is having a unique uuid assigned to each conversation thread. That way I could group messages into threads, regardless of the channel. Would that be a valid approach?
I am developing an app that requires communication between other users of the same app. A user might want to invite another user to an event, so the request must be sent directly to a specific user with the event data. If the invitee accepts the invite, the inviter will need to receive a message back to notify and record the acceptance. How would I go about achieving this communication functionality? What are the main pieces to this functionality?
Like you would with any platform, using the network.
The question is how do users discover each other? Vicinity? Common interests?
Either way you will need to create a server to which the apps connect via a web service with the proper information (e.g. location, common interests etc.) then the server can return the identifier for the appropriate match and facilitate communication between them.
I'm learning pubnub and I read their documentation but I just can't find how to manage a multi room chat box.
By default, a channel can be listened by anyone.
Subscribing to it and publishing on it is easy.
What I want is to have a main public room (so far so good) but anyone should also be able to talk privately to anyone else without the risk of being read by other users.
These dynamic rooms would be tabbed and the user should be able to go from one to another.
Another requirement would be that talking privately to someone doesn't kick you out of the other rooms you subscribed to (you can still be notified that a new message has been posted on another room while chatting)
What would be the best practice to achieve this?
Would I use different channels (created dynamically)?
Would I use one channel and filter the messages according to their status, pseudo-room id or protagonists?
Would I use multiplexing (one socket only)?
I need to know the best way to achieve this as the documentation only describes basic scenarios with a single room and there's nothing about this on the internet.
Thank you.
PS: I know PubNub doesn't recommend more than 2 channels at a time (even though I have a hard time finding the explanation of this).
PPS: I'm using punbub with socket.io
Socket.IO and PubNub Managing Private Rooms for Chat Services
You are asking for a way to create a Multiroom Chat Service, likely similar to IRC clients, where you are able to join and sit in on multiple chat rooms (on freenode.net for example). This is possible and will take some special tasks to get it right on your part.
You will start by opening Two Channels, one for the main chat room and one for your Private "ME" side chats. With this side Private "ME" channel, you will need to create a long and unpredictable session-id style channel name which typically looks like this:
YTQyOGFiNWEtNTZmZC00OGVhLTgxZjktMWE3ZmMyMzc3MTRhCg==
This is like a reference ID for the user. This ID can be used for Private 1-on-1 chats and the other room can be used for Group Chat. You will secure this Group chat using Access Control Management that we call PubNub Access Manager (PAM).
For additional Security Practices, you will need to review our security recommendations guides available here on PubNub Support for Security on our Help Desk and Knowledge Base.
Now that we have the private channels established, secure communication will be possible by sending and receiving chats via your private server (one that can provide authority) to allow messages to be relayed on a per user basis. You can learn how to do this by reading this section of the Sending Events from a Server to a Socket IO Client Documentation on PubNub.
The second channel will be for public chat for all rooms. For the Multi-tab support you will simply use the channel multiplexing feature of Socket IO on PubNub by adding new rooms via io.connect() method. Every time you open a new tab, you will open a new namespace via io.connect() of which you can have unlimited. Note however that you only should connect to no more than 2 PubNub channels at once (which you already noted in your question).
Here is the PubNub Socket IO method to subscribing to multiple feeds and categories:
Socket.IO Documentation
https://github.com/pubnub/pubnub-api/tree/493d7fc97fb683379fc78be3ca7ad9bc97eb4200/socket.io#restricting-yourself-to-a-namespace
Socket.IO Video on Vimeo
http://vimeo.com/34496366
Example Socket.IO Multiplexing Code
https://github.com/pubnub/pubnub-api/tree/493d7fc97fb683379fc78be3ca7ad9bc97eb4200/socket.io/multiplexing
As a quick conclusion, you will use secure methods to establish a private "ME" channel to send/receive messages on a per-users basis. And a public "Chat" channel that pushes all the public chat room data. Multiplexing will be important for the public chat.
The answers above were correct in 2012, but a lot has changed since then. Private chat rooms can be enabled with PubNub Access Manager, which explicitly grants Publish/Subscribe access on specific channels.
The way this works is through access tokens (aka an "Auth Key"). The developer (you) creates an Auth Key (basically any string of characters) and passes it to PubNub Access Manager. You then set the rules for this Auth Key (i.e. which channels the Auth Key can publish and/or subscribe to).
This Auth Key is provided to any device that needs access to the channel, and used when the device subscribes or publishes to the channel.
Basic docs are available here: http://www.pubnub.com/docs/javascript/tutorial/access-manager.html
Grant 60 minute read/write privilege to channel "privateChat" to an auth_key:
pubnub.grant({
channel : 'privateChat',
auth_key : 'abxyz12-auth-key-987tuv',
read : true,
write : true,
ttl : 60
});
To add to the previous answer, I'm not sure if this is just me hacking things but in order to make multi channel connections with the current socket-io library, you need to set io.connected = false; before passing in another channel config object.
For example:
var pubnub_setup = {
channel : 'public_channel',
publish_key : 'demo',
subscribe_key : 'demo'
};
var private_setup = {
channel : 'private_channel',
publish_key : 'demo',
subscribe_key : 'demo'
};
// Make your public socket connections
var publicSocket = io.connect( 'http://pubsub.pubnub.com/pub_socket', pubnub_setup );
var anotherPublicSocket = io.connect( 'http://pubsub.pubnub.com/another_pub_socket', pubnub_setup);
// Set false otherwise you keep getting back the previous created socket which is
// bound to the original channel 'public_channel'
io.connected = false;
var secretSocket = io.connect( 'http://pubsub.pubnub.com/secret_mulitplex_socket_namespace', private_setup );
Now you can keep creating new secret sockets on the private channel.