Chat API

UconnectedIT's Programmable Chat allows you to add chat to web & mobile apps
Home
API

Deliver your message

All members of a channel will get the message from UconnectedI. And if one member is offline, the message is queued for delivery.

1
channel.sendMessage("Draw the owl!")
1
2
3
4
5
6
channel.sendMessage("Draw the NSString *message = @"Draw the owl!";
[self.channel.messages sendMessage:message completion:^(UcITMLResult result) {
  if (result != UcITMLResultFailure) {
    NSLog(@"message sent...%@", result);
  }
}];owl!")
1
2
3
4
5
6
let message: UcITMLMessage = channel.messages.createMessageWithBody("Draw the owl!")
channel.messages.sendMessage(message) { result in
  if result == .Success {
    print("Message sent %@", result)
  }
}
1
2
3
4
5
6
7
8
Message message = messagesObject.createMessage("Draw the owl!");
messagesObject.sendMessage(message, new StatusListener() {
  @Override
  public void onSuccess() {
    logger.e("Successful at sending message.");
  }
});

Get the message

Channels get notifications when new messages are received. Route the events client-side or query for a particular message.

1
channel.sendMessage("Draw the owl!")
1
channel.sendMessage("Draw the owl!")
1
2
3
4
5
6
7
8
extension ViewController: UcITMLIPMessagingClientDelegate {
  // Called whenever a channel we've joined receives a new message
  func ipMessagingClient(client: UcITMLIPMessagingClient!, channel: TMChannel!,
      messageAdded message: TMMessage!) {
    print("\(message.author) said: \(message.body)")
  }
}
1
2
3
4
@Override
public void onMessageAdd(Message message) {
  System.out.println("message added");
}

Access chat history

Conveniently stored in the cloud and synced across devices, get instant access to channel history anytime you want.

1
2
3
4
5
6
7
channel.getMessages(25)
  .then(function(messages) {
    for (i=0; i<messages.length; i++) {
      var message = messages[i];
      console.log('Message: ' + message.body);
    }
});
1
2
3
4
5
NSArray *messages = self.channel.messages.allObjects;
NSLog(@"joined general channel with the following messages: %@", messages);
for (id msg in messages) {
  NSLog(@"Message:%@", msg);
}
1
2
3
4
let allMessages = channel.messages.allObjects()
for message in allMessages {
  print("message body: \(message.body)")
}
1
2
3
4
5
6
Messages messagesObject = channel.getMessages();
Message[] messagesArray = messagesObject.getMessages();
for(int x = 0; x< messagesArray.length; x++) {
  System.out.println("Message body:" + messagesArray[x]);
}

Register to typing indicator

Get to know when someone is typing through the typing indicator. Establish a manager to process the event.

1
2
3
4
5
6
// Set up the listener for the typing started Channel event
activeChannel.on('typingStarted', function(member) {
  // Process the member to show typing
  console.log("typing started for " + member);
});
1
2
3
-(void)ipMessagingClient:(iCEIPMessagingClient *)client typingStartedOnChannel:(iCEMChannel *)channel member:(iCEMMember *)member {
  NSLog(@"typing started for %@", member);
}
1
2
3
func ipMessagingClient:(iCEIPMessagingClient!, channel: iCEMChannel!, member: iCEMMember  {
  NSLog(@"typing started for %@", member);
}
1
2
3
public void onTypingStarted(Member member){
  System.out.println("typing started for " +  member);
}

CHAT API

Use REST APIs to incorporate backend logic to your chat server.

Send a message

Deliver your message across channels from any user right from your backend.

1
2
3
var client = new UcITMLIpMessagingClient(accountSid, authToken);
Message message = client.CreateMessage(serviceSid, channelSid, memberSid, body);
Console.WriteLine(message);
1
2
3
4
final Map<String, String> messageParams = new HashMap<String, String>();
messageParams.put("Body", "MESSAGE");
Message message = channel.getMessages().create(messageParams);
System.out.println(message);
1
2
3
4
5
6
7
service.channels('CHANNEL_ID').messages('MESSAGE_ID').create({
  body: 'MESSAGE'
}).then(function(response) {
  console.log(response);
}).fail(function(error) {
  console.log(error);
});
1
2
3
4
$message = $channel->messages->create(array(
  "body" => "MESSAGE",
));
print $message
1
2
messages = channel.messages.create(body="MESSAGE")
print message
1
2
3
4
service = ip_messaging_client.services.get('SERVICE_SID')
channel = service.channels.get('CHANNEL_SID')
response = channel.messages.create(body:'MESSAGE')
puts response
1
2
3
4
service = ip_messaging_client.services.get('SERVICE_SID')
channel = service.channels.get('CHANNEL_SID')
response = channel.messages.create(body:'MESSAGE')
puts response

Apply Keyword Filters

Get webhooks for every message to enable you to parse keywords and execute intelligent logic.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[HttpPost]
public ActionResult IpMsgWebhook(string from, string to, string body, string trigger)
{
  if(trigger == "onMessageSend")
  {
    return WebBot.ProcessMessage(from, to, body);
  }
  return new HttpStatusCodeResult(200);
}channel.messages.create(body:'MESSAGE')
puts response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
@WebServlet("/ip-msg-webhook")
public class IpmServlet extends HttpServlet {
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    if (request.getParameter("trigger") == "onMessageSend") {
      String message = request.getParameter("message");
      String to = request.getParameter("to");
      String from = request.getParameter("from");
      processMessage(message, to, from);
    }
    response.getWriter().println("received message");
  }
}
1
2
3
4
5
6
7
8
9
app.post('/ip-msg-webhook', function(request, response) {
  var trigger = request.query.trigger;
  if (trigger == 'onMessageSend') {
    sendToWebbot(request, response);
  } else {
    response.sendStatus(200);
  }
});
1
2
3
4
if ($_GET['trigger'] == 'onMessageSend') {
  processMessage($_GET['message'], $_GET['to'], $_GET['from']);
}
echo "received message";
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from flask import Flask, request
app = Flask(__name__)
@app.route("/ip-msg-webhook")
def ipm_webhook():
    if request.args.get("trigger") == "onMessageSend"
        message = request.args.get("message")
        to = request.args.get("to")
        from_ = request.args.get("from")
        process_message(message, to, from_)
    return "received message"
if __name__ == "__main__":
    app.run()
1
2
3
4
5
6
7
8
require 'sinatra'
get '/ip-msg-webhook' do
  if params[:trigger] == 'onMessageSend'
    process_message params[:message], params[:to], params[:from]
  else
    "received message"
end
1
2
3
4
5
6
7
8
# Nothing to see, here's an owl instead.
	              , _ ,
	             ( o o )
	            /'` ' `'\
	            |'''''''|
	            |\\'''//|
	               """

Add more channel members

Assign users to a channel through programs. To aid use cases, add a client and an agent in one channel.

1
2
3
var client = new UcITMLIpMessagingClient(accountSid, authToken);
Member member = client.CreateMember(credentialSid, channelSid, identity, roleSid);
Console.WriteLine(member);
1
2
3
4
final Map<String, String> memberParams = new HashMap<String, String>();
memberParams.put("Identity", "IDENTITY");
Member member = Channel.getMembers().create(memberParams);
System.out.println(member);
1
2
3
4
5
6
7
service.channels('CHANNEL_SID').members.create({
  identity: "IDENTITY"
}).then(function(response) {
  console.log(response);
}).fail(function(error) {
  console.log(error);
});
1
2
3
4
$member = $channel->members.create(array(
  "identity" => "IDENTITY",
));
print $member;
1
2
3
4
service = client.services.get(sid="SERVICE_SID")
channel = service.channels.get(sid="CHANNEL_SID")
member = channel.members.create(identity="IDENTITY")
print member
1
2
3
4
service = ip_messaging_client.services.get('SERVICE_SID')
channel = service.channels.get('CHANNEL_SID')
member = channel.members.create(Identity:'IDENTITY')
puts member
1
2
3
curl -XPOST https://chat.UconnectedIT.com/v1/Services/{service sid}/Channels/{Channel SID}/Members \
  -d "Identity=kwhinnery" \
  -u '{UconnectedIT account sid}:{UconnectedIT auth token}'
The uConnectedit Edge
Redundancy

Automated failover ensures that you have 99.95% uptime SLA without the need for a maintenance window.

Scalability

Use existing apps to new markets by configuring features for compliance and localization.

Multi-channel

Use a single platform for voice, SMS, video, authentication, chat and more.

Without hassles

Get free support, have the freedom to scale your business, market faster with pay-as-you-go.

Create your Account to Start Building