POST tp/message/send

Sends a message to an indoona resource: a resource can be a user chat or a group chat.
It is possible to send text, stickers, location, address book contacts and various types of media messages.
Returns a representation of the message just sent, according to the format defined in the Message Reference section.

Address book contacts are sent as an XML string, defined according to the following XSD schema:

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="indoona:x:contact" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  	<xs:element name="contact">
    	<xs:complexType>
      		<xs:sequence>
       			<xs:element type="xs:string" name="name"/>
        		<xs:element type="xs:string" name="surname"/>
        		<xs:element name="phone" maxOccurs="unbounded" minOccurs="0">
          			<xs:complexType>
            			<xs:simpleContent>
              				<xs:extension base="xs:long">
                				<xs:attribute type="xs:string" name="type" use="optional"/>
              				</xs:extension>
            			</xs:simpleContent>
          			</xs:complexType>
        		</xs:element>
      		</xs:sequence>
    	</xs:complexType>
  	</xs:element>
</xs:schema>

Accepted mime-types on media messages are:

TYPE SUPPORTED MIME TYPES PREFERRED
picture image/jpeg, image/pjpeg, image/png, image/gif image/jpeg
movie video/3gp, video/3gpp, video/mpeg, video/avi, video/mkv, video/mp4, video/flv, video/divx, video/x-flv, video/x-divx, video/x-xvid, video/x-msvideo, video/quicktime video/mp4
sound audio/amr, audio/amr-wb, audio/mpeg, audio/mp3, audio/mp4, audio/caf, audio/aiff, audio/x-aiff, audio/aif, audio/wav, audio/x-wav, audio/x-mpeg audio/mp3
file any other mime type

Resource URL

https://api.indoona.com/tp/message/send.json

Parameters

name description
user_id (optional) to be specified only when using an application-level token
contact_id unique identifier of the sender contact
resource_id resource identifier (user_id or room_id)
msg_type message type, can be "text", "sticker", "location", "picture", "movie", "sound" (audio file), "voice" (audio note), "file" (other than media)
no_push (optional) boolean value which specifies whether the message should not produce a push notification; default is 'false'

Custom parameters

name description
text message body as string, only for "text" message type
sticker_id sticker identifier as string, only for "sticker" message type
geo_description location description
geo_lat latitude as double precision floating point, only for "location" message type
geo_lon longitude as double precision floating point, only for "location" message type
vcard xml string representation of an address book contact according to the XSD schema above, only for "contact" message type
file file as binary data, only for "picture", "movie", "sound", "voice" or "file" message types (WARNING: a POST multipart request is needed)

Examples

Text message


POST https://api.indoona.com/tp/message/send.json
Content-Type=application/x-www-form-urlencoded

user_id=1i7qr9t0dxc0kiw8u4fmzx69f&resource_id=1i7qr9t0dxc0kiw8u4fmzx69f&contact_id=54&msg_type=text&text=Hello!&no_push=true

Response: see Message Text reference

Sticker message


POST https://api.indoona.com/tp/message/send.json
Content-Type=application/x-www-form-urlencoded

user_id=1i7qr9t0dxc0kiw8u4fmzx69f&resource_id=1i7qr9t0dxc0kiw8u4fmzx69f&contact_id=54&msg_type=sticker&sticker_id=tp-status_01.png&no_push=true

Response: see Message Sticker reference

Location message


POST https://api.indoona.com/tp/message/send.json
Content-Type=application/x-www-form-urlencoded

user_id=1i7qr9t0dxc0kiw8u4fmzx69f&resource_id=1i7qr9t0dxc0kiw8u4fmzx69f&contact_id=54&msg_type=location&geo_lat=9.2292391&geo_lon=9.07051&no_push=true

Response: see Message Location reference

Address book contact message

	
POST https://api.indoona.com/tp/message/send.json
Content-Type=application/x-www-form-urlencoded

user_id=1i7qr9t0dxc0kiw8u4fmzx69f&resource_id=1i7qr9t0dxc0kiw8u4fmzx69f&contact_id=54&msg_type=contact&vcard=%3Ccontact+xmlns%3D%27indoona%3Ax%3Acontact%27%3E%3Cname%3EJohn%3C%2Fname%3E%3Csurname%3EDoe%3C%2Fsurname%3E%3Cphone+type%3D%22home%22%3E%2B12223335566%3C%2Fphone%3E%3Cphone+type%3D%22work%22%3E%2B12223335567%3C%2Fphone%3E%3C%2Fcontact%3E

Response: see Message Address Book reference

Media message (picture, movie, sound, voice, file)

	
POST https://api.indoona.com/tp/message/send.json
Content-Type=multipart/form-data

Parts:
user_id=1i7qr9t0dxc0kiw8u4fmzx69f
resource_id=1i7qr9t0dxc0kiw8u4fmzx69f
contact_id=54
msg_type=picture	// or any other valid media message type
no_push=true
file = (file as binary data)

Response: see Message Media reference