A user or an app can send a message either to another user or to a group. One can send both plain text messages and messages with rich content. Plain text messages display the sender name, the user avatar, the text of the message, and the time at which it was sent.
On the other hand, messages with rich content (formally referred to as attachments) can show widgets, FlockML, images, buttons, and provide files to download, among other things. See Sending Attachments for more details.
Your app can send messages either –
Your app can send messages via the chat.sendMessage method. Prior to that, however, you will need to create an app.
To be able to send a message to a contact or a group, you will need to know their identifier first. The methods roster.listContacts and groups.list can help you do this. Typically, your configuration URL will use these methods to set up an interface wherein a user can select which contact or group he wants to send messages from your app to.
Send this message using the chat.sendMessage method. You can use either HTTP GET
:
https://api.flock.co/v1/chat.sendMessage?to=u:513a9f4ae409&text=hello&token=632542db-1a23-4e06-8b39-01f8b0868d57 |
or POST
to call the method.
POST /v1/chat.sendMessage HTTP/1.1 Host: api.flock.co Content-Type: application/x-www-form-urlencoded Content-Length: 70 to=u:513a9f4ae409&text=hello&token=632542db-1a23-4e06-8b39-01f8b0868d57 |