Sending PM from server side.

0 views
Skip to first unread message

Calvin

unread,
May 9, 2009, 10:13:19 AM5/9/09
to Jabbify
Hi,

I was looking at https://jabbify.com/demos/api.html #7. Send direct
message and I came up this question: can I send a direct message to a
user from server side?

So I tried:

https://jabbify.com/message_push?key=<API
KEY>&name=Neo&type=message&action=direct&message=sweet&to=<Username>

It returned

Sent to <Domain>

but it didn't come up on the client side as well as in moderate panel.

Any chance I can do this?

Also, will I be able to send arbitrary data thru the REST?

Thanks in advance,

Calvin

Brian Moschel

unread,
May 9, 2009, 10:38:56 AM5/9/09
to jab...@googlegroups.com
Yes you can do this, but the "to" attribute has to be the person's call_id (their "from" attribute) not their username.  Give that a try.

You should be able to send arbitrary data through REST.

- Brian

Calvin

unread,
May 9, 2009, 11:10:02 AM5/9/09
to jab...@googlegroups.com
Just to make sure I can get the recipient's call_id by `CurrentUser.from` right?
--
/Da Capo/

Calvin

unread,
May 9, 2009, 12:37:40 PM5/9/09
to jab...@googlegroups.com
Sorry but I can't get it to work

  https://jabbify.com/message_push?key=<API_KEY> &type=message&action=direct&message=PM&to=<Recipient's Jabbify.from>

Also, I wasn't able to broadcast arbitrary data as well
  https://jabbify.com/message_push?key=<API_KEY> &type=message&action=create&message=PM&hello=world
--
/Da Capo/

Brian Moschel

unread,
May 9, 2009, 1:29:31 PM5/9/09
to jab...@googlegroups.com
Ok.  I will try it today in a little while and get back to you.

- Brian

Brian Moschel

unread,
May 11, 2009, 1:57:13 AM5/11/09
to jab...@googlegroups.com
Hey Calvin,

As for direct messages, the following works:

https://jabbify.com/message_push?message=PM&action=create&type=message&to=<A valid User.from>&key=<api key>&name=test

I tested this by opening the same page with the Jabbify chat client in two browsers.  Only one browser displays the message, as you'd expect.

Let me know if you can't get this to work.  Looking into arbitrary data in one second.

Calvin

unread,
May 11, 2009, 2:37:40 AM5/11/09
to jab...@googlegroups.com
Great stuff!

One thing I have noticed is that even though it is a private message, others can see it once they reload their browser. Does it suppose to work like this?

Calvin
--
/Da Capo/

Brian Moschel

unread,
May 11, 2009, 2:44:40 AM5/11/09
to jab...@googlegroups.com
The reason that is happening is because the query for new messages isn't specifying only "domain_wide" messages, so it gets those direct ones also.  If you build a 1-1 client, you'd grab history by grabbing the latest messages just from userA to userB, or from userB to userA.  If your chat client doesn't grab the history of your conversation, this won't be a problem.

Currently this doesnt quite work yet because we haven't implemented the right search to return messages from/to a certain user.  Are you making a chat client that would use history like this?  If so I will push up the priority of implementing this.

- Brian

Calvin

unread,
May 11, 2009, 2:55:17 AM5/11/09
to jab...@googlegroups.com
I'm not building a 1-1 client, but while using Jabbify with public, I'm going to send personalized messages to a user. And I really don't like to reveal private messages to the public.
--
/Da Capo/

Brian Moschel

unread,
May 11, 2009, 3:00:40 AM5/11/09
to jab...@googlegroups.com
Just to make sure I understand...do you mean you're going to send messages that will appear in the chat client to a user, but you don't want these messages showing up when a new person comes to the page?

One way to do that is send a message that isn't of type "message" and action "create" and change the simple client to listen for your new message type.  Only message.create messages get saved in the database.

Brian Moschel

unread,
May 11, 2009, 3:05:48 AM5/11/09
to jab...@googlegroups.com
You are right about not being able to send arbitrary data in a URL.  I will fix this issue tomorrow and email you when its working.  Sorry about that.

- Brian

Calvin

unread,
May 11, 2009, 3:13:58 AM5/11/09
to jab...@googlegroups.com
Cool, I thought I had to use type=message&action=create to post messages!

Yeah I reckon that would work well :)
--
/Da Capo/

Calvin

unread,
May 11, 2009, 3:15:23 AM5/11/09
to jab...@googlegroups.com
No worries. Again, thanks for doing such a brilliant job. I really appreciate your work :)
--
/Da Capo/

Brian Moschel

unread,
May 11, 2009, 4:36:10 AM5/11/09
to jab...@googlegroups.com
Ok, fixed.  I tested with the following URL:

Let me know if you have any trouble.  Thanks for the useful feedback and keep us posted on your work.

- Brian
Reply all
Reply to author
Forward
0 new messages