{"_id":"5954fce97a147f001b918aa7","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"category":{"_id":"5954bc387a147f001b918915","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-29T08:37:12.853Z","from_sync":false,"order":7,"slug":"omni-chat","title":"OMNI Chat"},"user":"57a98d832242630e00cc8df7","__v":10,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-29T13:13:13.941Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"to\": \"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n  \"messageCount\": 1,\n  \"messageId\": \"1215f543ab19-345f-adbd-12ad31451ed25f35\",\n  \"status\": {\n    \"groupId\": 1,\n    \"groupName\": \"PENDING\",\n    \"id\": 7,\n    \"name\": \"PENDING_ENROUTE\",\n    \"description\": \"Message sent to next instance\"\n  }\n}"},{"status":400,"language":"json","code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"BAD_REQUEST\",\n      \"text\": \"Bad request\"\n    }\n  }\n}","name":""},{"language":"json","status":401,"code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"UNAUTHORIZED\",\n      \"text\": \"Invalid login details\"\n    }\n  }\n}"}]},"method":"post","examples":{"codes":[{"language":"json","code":"POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n  \"to\":\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n  \"message\": {\n    \"type\":\"TEXT\",\n    \"text\":\"Hello, World!\"\n  }\n}","name":""}]},"settings":"554860d6d2c8410d006c215e","auth":"required","params":[{"_id":"55155f2abc466623002afe8a","ref":"","in":"body","required":true,"desc":"User key.","default":"","type":"string","name":"to"},{"_id":"55155f2abc466623002afe89","ref":"","in":"body","required":true,"desc":"<a href=\"#section-message-object\">Message object</a>","default":"","type":"object","name":"message"},{"_id":"59550843be8877001b6dcfee","ref":"","in":"path","required":true,"desc":"","default":"application key","type":"string","name":"applicationKey"},{"_id":"59550843be8877001b6dcfed","ref":"","in":"path","required":true,"desc":"","default":"integration type","type":"string","name":"integrationType"}],"url":"/omnichat/:version/applications/{applicationKey}/integrations/{integrationType}/message"},"isReference":false,"order":6,"body":"# Response format \nIf successful, the response header HTTP status code will be 200 OK and the message will be sent.\nIf you try to send the message without authorization, you will receive a 401 Unauthorized error.\nIf the request is incorrectly formatted, the HTTP status code will be `400 Bad Request`.\n\n\n####Response\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|String|User key.|\n|*status*|[Status](#section-status)|Indicates whether the message is sent successfully, not sent, delivered, not delivered, waiting for delivery or any other possible status.|\n|*messageCount*|int|The number of sent message segments.|\n|*messageId*|String|The ID that uniquely identifies the sent message.|\n\n####Status\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|\n|*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.|\n\n# Request Format\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"0-0\": \"to\",\n    \"1-0\": \"message\",\n    \"0-1\": \"String\",\n    \"1-1\": \"Object\",\n    \"0-2\": \"Yes\",\n    \"1-2\": \"Yes\",\n    \"h-2\": \"Required\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"User key.\",\n    \"1-3\": \"[Message object](#section-message-object).\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\n## Message Object\n\nSupported message objects are: \n\n* [Text message](#section-text-message) (`TEXT`)\n* [Image message](#section-image-message) (`IMAGE`)\n* [Buttons message](#section-buttons-message) (`BUTTONS`)\n\n\n### Text Message\nType `TEXT` is used when sending a text message.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Required\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Yes\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Yes\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Constant value - `TEXT`.\",\n    \"1-3\": \"Text of the message.\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n  \\\"to\\\":\\\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"TEXT\\\",\\n    \\\"text\\\":\\\"Hello, World!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Image Message\n\nBesides the text message, image messages can also be sent over API. Before sending the message, you will need to upload your image to a publicly accessible server and supply the `url` of the file.\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Required\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Yes\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Yes\",\n    \"2-0\": \"url\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Yes\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Constant value - `IMAGE`.\",\n    \"1-3\": \"Text of the message.\",\n    \"2-3\": \"Image url.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n  \\\"to\\\":\\\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"IMAGE\\\",\\n    \\\"text\\\":\\\"Hello, World!\\\",\\n    \\\"url\\\":\\\"https://petersapparel.com/img/shirt.png\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Buttons Message\n\nA Buttons message contains a text shown to the user, as well as some predefined options that the user may select by tapping them.\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Required\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Yes\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Yes\",\n    \"2-0\": \"buttons\",\n    \"2-1\": \"Array of buttons\",\n    \"2-2\": \"Yes\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Constant value - `BUTTONS`.\",\n    \"1-3\": \"Text of the message.\",\n    \"2-3\": \"Button objects. Max 3.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n#### Postback button\n\nPostback button causes a callback event to be fired when the user presses a button.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Required\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Yes\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Optional\",\n    \"2-0\": \"payload\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Yes\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Constant value - `POSTBACK`.\",\n    \"1-3\": \"Text of the button (as displayed to the user).\",\n    \"2-3\": \"Value to be posted back when the user presses the button.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n#### URL button\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Required\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Yes\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Optional\",\n    \"2-0\": \"url\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Yes\",\n    \"h-3\": \"Description\",\n    \"0-3\": \"Constant value - `URL`.\",\n    \"1-3\": \"Text of the button (as displayed to the user).\",\n    \"2-3\": \"URL that should be opened when user presses the button.\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n  \\\"to\\\":\\\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"BUTTONS\\\",\\n    \\\"text\\\":\\\"Do you want to subscribe to our service X?\\\",\\n    \\\"buttons\\\": [\\n      {\\n        \\\"type\\\":\\\"POSTBACK\\\",\\n        \\\"text\\\":\\\"Yes\\\",\\n        \\\"payload\\\":\\\"userId:abc123\\\"\\n      },\\n      {\\n      \\t\\\"type\\\":\\\"URL\\\",\\n        \\\"text\\\":\\\"Learn more\\\",\\n        \\\"url\\\":\\\"http://company.com/about-service-x\\\"\\n      }\\n    ]\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"This method allows you to send a single message.","slug":"omni-chat-send-message","type":"endpoint","title":"Send message"}

postSend message

This method allows you to send a single message.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

applicationKey:
required
stringapplication key
integrationType:
required
stringintegration type

Body Params

to:
required
string
User key.
message:
required
object
<a href="#section-message-object">Message object</a>

Examples


Result Format


Documentation

# Response format If successful, the response header HTTP status code will be 200 OK and the message will be sent. If you try to send the message without authorization, you will receive a 401 Unauthorized error. If the request is incorrectly formatted, the HTTP status code will be `400 Bad Request`. ####Response |Parameter|Type|Description| |-|-|-| |*to*|String|User key.| |*status*|[Status](#section-status)|Indicates whether the message is sent successfully, not sent, delivered, not delivered, waiting for delivery or any other possible status.| |*messageCount*|int|The number of sent message segments.| |*messageId*|String|The ID that uniquely identifies the sent message.| ####Status |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.| |*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.| # Request Format [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "0-0": "to", "1-0": "message", "0-1": "String", "1-1": "Object", "0-2": "Yes", "1-2": "Yes", "h-2": "Required", "h-3": "Description", "0-3": "User key.", "1-3": "[Message object](#section-message-object)." }, "cols": 4, "rows": 2 } [/block] ## Message Object Supported message objects are: * [Text message](#section-text-message) (`TEXT`) * [Image message](#section-image-message) (`IMAGE`) * [Buttons message](#section-buttons-message) (`BUTTONS`) ### Text Message Type `TEXT` is used when sending a text message. [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Required", "0-0": "type", "0-1": "String", "0-2": "Yes", "1-0": "text", "1-1": "String", "1-2": "Yes", "h-3": "Description", "0-3": "Constant value - `TEXT`.", "1-3": "Text of the message." }, "cols": 4, "rows": 2 } [/block] Request example [block:code] { "codes": [ { "code": "POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"to\":\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n \"message\": {\n \"type\":\"TEXT\",\n \"text\":\"Hello, World!\"\n }\n}", "language": "json" } ] } [/block] ### Image Message Besides the text message, image messages can also be sent over API. Before sending the message, you will need to upload your image to a publicly accessible server and supply the `url` of the file. [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Required", "0-0": "type", "0-1": "String", "0-2": "Yes", "1-0": "text", "1-1": "String", "1-2": "Yes", "2-0": "url", "2-1": "String", "2-2": "Yes", "h-3": "Description", "0-3": "Constant value - `IMAGE`.", "1-3": "Text of the message.", "2-3": "Image url." }, "cols": 4, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"to\":\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n \"message\": {\n \"type\":\"IMAGE\",\n \"text\":\"Hello, World!\",\n \"url\":\"https://petersapparel.com/img/shirt.png\"\n }\n}", "language": "json" } ] } [/block] ### Buttons Message A Buttons message contains a text shown to the user, as well as some predefined options that the user may select by tapping them. [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Required", "0-0": "type", "0-1": "String", "0-2": "Yes", "1-0": "text", "1-1": "String", "1-2": "Yes", "2-0": "buttons", "2-1": "Array of buttons", "2-2": "Yes", "h-3": "Description", "0-3": "Constant value - `BUTTONS`.", "1-3": "Text of the message.", "2-3": "Button objects. Max 3." }, "cols": 4, "rows": 3 } [/block] #### Postback button Postback button causes a callback event to be fired when the user presses a button. [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Required", "0-0": "type", "0-1": "String", "0-2": "Yes", "1-0": "text", "1-1": "String", "1-2": "Optional", "2-0": "payload", "2-1": "String", "2-2": "Yes", "h-3": "Description", "0-3": "Constant value - `POSTBACK`.", "1-3": "Text of the button (as displayed to the user).", "2-3": "Value to be posted back when the user presses the button." }, "cols": 4, "rows": 3 } [/block] #### URL button [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Required", "0-0": "type", "0-1": "String", "0-2": "Yes", "1-0": "text", "1-1": "String", "1-2": "Optional", "2-0": "url", "2-1": "String", "2-2": "Yes", "h-3": "Description", "0-3": "Constant value - `URL`.", "1-3": "Text of the button (as displayed to the user).", "2-3": "URL that should be opened when user presses the button." }, "cols": 4, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /omnichat/:version/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/FACEBOOK/message HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"to\":\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n \"message\": {\n \"type\":\"BUTTONS\",\n \"text\":\"Do you want to subscribe to our service X?\",\n \"buttons\": [\n {\n \"type\":\"POSTBACK\",\n \"text\":\"Yes\",\n \"payload\":\"userId:abc123\"\n },\n {\n \t\"type\":\"URL\",\n \"text\":\"Learn more\",\n \"url\":\"http://company.com/about-service-x\"\n }\n ]\n }\n}", "language": "json" } ] } [/block]