{"_id":"58c25ee89609c40f004b4cf8","user":"57c6d393bd38ec0e00facdd9","category":{"_id":"58b04a023529383900a759b5","__v":0,"version":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-02-24T14:58:10.723Z","from_sync":false,"order":17,"slug":"telegram-messaging","title":"Telegram messaging"},"project":"54eb50e5615ffc1900305a16","__v":1,"parentDoc":null,"version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":26,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-03-10T08:08:08.323Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{\n  \"to\": \"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\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}","language":"json","status":200},{"name":"","code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"BAD_REQUEST\",\n      \"text\": \"Bad request\"\n    }\n  }\n}","language":"json","status":400},{"status":401,"code":"{\n  \"requestError\": {\n    \"serviceException\": {\n      \"messageId\": \"UNAUTHORIZED\",\n      \"text\": \"Invalid login details\"\n    }\n  }\n}","language":"json"}]},"settings":"554860d6d2c8410d006c215e","examples":{"codes":[{"language":"http","code":"POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{  \n  \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n  \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n  \"message\": {\n    \"type\":\"TEXT\",\n    \"text\":\"Hello, World!\"\n  }\n}"}]},"method":"post","auth":"required","params":[{"_id":"58c263224922930f0050b1bb","ref":"","in":"body","required":false,"desc":"Application key you are using to send messages.","default":"","type":"string","name":"from"},{"_id":"58c263224922930f0050b1ba","ref":"","in":"body","required":false,"desc":"User key, assigned when user starts a conversation with your bot.","default":"","type":"string","name":"to"},{"_id":"58c263224922930f0050b1b9","ref":"","in":"body","required":false,"desc":"<a href=\"#section-message-object\">Message object</a> contains type and text properties","default":"","type":"object","name":"message"}],"url":"/telegram/:version/single"},"isReference":false,"order":1,"body":"# Response format \nOn success, 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.\nOn an incorrectly formatted request, the HTTP status code will be `400 Bad Request`.\n\n####Response\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|String|User key or phone number.|\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\": \"from\",\n    \"1-0\": \"to\",\n    \"2-0\": \"message\",\n    \"0-1\": \"String\",\n    \"1-1\": \"String\",\n    \"2-1\": \"Object\",\n    \"0-2\": \"Application key you are using to send messages.\",\n    \"1-2\": \"User key.\",\n    \"2-2\": \"[Message object](#section-message-object).\",\n    \"h-2\": \"Description\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n## Message Object\n\nSupported message objects are: \n* [Text message](#section-text-message) (`TEXT`)\n* [Image message](#section-image-message) (`IMAGE`)\n* [Audio message](#section-audio-message) (`AUDIO`)\n* [File message](#section-file-message) (`FILE`)\n* [Sticker message](#section-sticker-message) (`STICKER`)\n* [Video message](#section-video-message) (`VIDEO`)\n* [Voice message](#section-voice-message) (`VOICE`)\n* [Location message](#section-location-message) (`LOCATION`)\n* [Venue message](#section-venue-message) (`VENUE`)\n* [Contact message](#section-contact-message) (`CONTACT`)\n* [Request msisdn message](#section-request-msisdn-message)(`REQUEST_MSISDN`)\n\n\n### Text Message\nType `TEXT` is used when sending a text message. Message must be UTF-8 encoded.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `TEXT`.\",\n    \"1-0\": \"text\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Text of the message.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"TEXT\\\",\\n    \\\"text\\\":\\\"Hello, World!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Image Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `IMAGE`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the image.\",\n    \"2-0\": \"text\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional text to display alongside the image.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"IMAGE\\\",\\n    \\\"url\\\":\\\"https://example.com/image.png\\\",\\n    \\\"text\\\":\\\"Image description\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Audio Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `AUDIO`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the audio file.\",\n    \"2-0\": \"text\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional text to display alongside the audio.\",\n    \"3-0\": \"duration\",\n    \"3-1\": \"number\",\n    \"3-2\": \"Optional duration of the audio file in milliseconds.\",\n    \"4-0\": \"performer\",\n    \"4-1\": \"String\",\n    \"4-2\": \"Optional name of the audio file performer.\",\n    \"5-0\": \"title\",\n    \"5-1\": \"String\",\n    \"5-2\": \"Optional title of the audio file.\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"AUDIO\\\",\\n    \\\"url\\\":\\\"https://example.com/song.mp3\\\",\\n    \\\"text\\\":\\\"Audio file description\\\",\\n   \\t\\\"duration\\\": 180000,\\n    \\\"performer\\\": \\\"Performer name\\\",\\n    \\\"title\\\": \\\"Track title\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### File Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `FILE`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the file.\",\n    \"2-0\": \"text\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional text to display alongside the file.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"FILE\\\",\\n    \\\"url\\\":\\\"https://example.com/file.pdf\\\",\\n    \\\"text\\\":\\\"Sample pdf file\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Sticker Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `STICKER`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the sticker. Must be in `.webp` format.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"STICKER\\\",\\n    \\\"url\\\":\\\"https://example.com/sticker.webp\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Video Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `VIDEO`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the video.\",\n    \"2-0\": \"text\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional text to display alongside the video.\",\n    \"3-0\": \"duration\",\n    \"3-1\": \"number\",\n    \"3-2\": \"Optional duration of video in milliseconds.\",\n    \"4-0\": \"width\",\n    \"4-1\": \"number\",\n    \"4-2\": \"Optional width of the video file.\",\n    \"5-0\": \"height\",\n    \"5-1\": \"number\",\n    \"5-2\": \"Optional height of the video file.\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"VIDEO\\\",\\n    \\\"url\\\":\\\"https://example.com/video.avi\\\",\\n    \\\"text\\\":\\\"Video description\\\",\\n    \\\"duration\\\": 10000,\\n    \\\"width\\\": 640,\\n    \\\"height\\\": 320\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Voice Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `VOICE`.\",\n    \"1-0\": \"url\",\n    \"1-1\": \"String\",\n    \"1-2\": \"URL of the voice file. It must be an OPUS encoded .ogg file.\",\n    \"2-0\": \"text\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional text to display alongside the voice file.\",\n    \"3-0\": \"duration\",\n    \"3-1\": \"number\",\n    \"3-2\": \"Optional duration of the voice file.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"VOICE\\\",\\n    \\\"url\\\":\\\"https://example.com/voice.ogg\\\",\\n    \\\"text\\\":\\\"Voice description\\\",\\n    \\\"duration\\\": 10000\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Location Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `LOCATION`.\",\n    \"1-0\": \"latitude\",\n    \"1-1\": \"number\",\n    \"1-2\": \"Location latitude.\",\n    \"2-0\": \"longitude\",\n    \"2-1\": \"number\",\n    \"2-2\": \"Location longitude.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"LOCATION\\\",\\n    \\\"latitude\\\": 45.793413,\\n\\t\\t\\\"longitude\\\": 15.946782\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Venue Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `VENUE`.\",\n    \"1-0\": \"latitude\",\n    \"1-1\": \"number\",\n    \"1-2\": \"Venue latitude.\",\n    \"2-0\": \"longitude\",\n    \"2-1\": \"number\",\n    \"2-2\": \"Venue longitude.\",\n    \"3-0\": \"title\",\n    \"3-1\": \"String\",\n    \"3-2\": \"Venue title.\",\n    \"4-0\": \"address\",\n    \"4-1\": \"String\",\n    \"4-2\": \"Venue address.\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"VENUE\\\",\\n    \\\"latitude\\\": 48.858370,\\n\\t\\t\\\"longitude\\\": 2.294481,\\n    \\\"title\\\": \\\"Eiffel tower\\\",\\n\\t\\t\\\"address\\\": \\\"5 Avenue Anatole France, Paris\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n### Contact Message\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Constant value - `CONTACT`.\",\n    \"1-0\": \"phoneNumber\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Contact's phone number.\",\n    \"2-0\": \"firstName\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Contact's first name.\",\n    \"3-0\": \"lastName\",\n    \"3-1\": \"String\",\n    \"3-2\": \"Contact's last name.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n  \\\"from\\\":\\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n  \\\"to\\\":\\\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\\\",\\n  \\\"message\\\": {\\n    \\\"type\\\":\\\"CONTACT\\\",\\n    \\\"phoneNumber\\\": \\\"447700...\\\",\\n\\t\\t\\\"firstName\\\": \\\"William\\\",\\n\\t\\t\\\"lastName\\\": \\\"Shakespeare\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Request msisdn message\n\nThis type of message is used for requesting user's phone number. The user receives the keyboard with one button that is used for providing the phone number.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"type\",\n    \"1-0\": \"text\",\n    \"2-0\": \"buttonText\",\n    \"0-1\": \"String\",\n    \"1-1\": \"String\",\n    \"2-1\": \"String\",\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"Constant value - `REQUEST_MSISDN`.\",\n    \"1-2\": \"Message text.\",\n    \"2-2\": \"Button text.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /telegram/1/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n\\t\\\"from\\\": \\\"8F0792F86035A9F4290821F1EE6BC06A\\\",\\n\\t\\\"to\\\": \\\"986ABBBD989A7430A27439B955F2AEDA\\\",\\n\\t\\\"message\\\": {\\n\\t\\t\\\"type\\\": \\\"REQUEST_MSISDN\\\",\\n\\t\\t\\\"text\\\":\\\"For something we need your phone number\\\",\\n\\t\\t\\\"buttonText\\\":\\\"Give my phone number\\\"\\n\\t}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"This method allows you to send a single message.","slug":"send-telegram-message","type":"endpoint","title":"Send Telegram message"}

postSend Telegram message

This method allows you to send a single message.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

from:
string
Application key you are using to send messages.
to:
string
User key, assigned when user starts a conversation with your bot.
message:
object
<a href="#section-message-object">Message object</a> contains type and text properties

Examples


Result Format


Documentation

# Response format On success, 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. On an incorrectly formatted request, the HTTP status code will be `400 Bad Request`. ####Response |Parameter|Type|Description| |-|-|-| |*to*|String|User key or phone number.| |*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": "from", "1-0": "to", "2-0": "message", "0-1": "String", "1-1": "String", "2-1": "Object", "0-2": "Application key you are using to send messages.", "1-2": "User key.", "2-2": "[Message object](#section-message-object).", "h-2": "Description" }, "cols": 3, "rows": 3 } [/block] ## Message Object Supported message objects are: * [Text message](#section-text-message) (`TEXT`) * [Image message](#section-image-message) (`IMAGE`) * [Audio message](#section-audio-message) (`AUDIO`) * [File message](#section-file-message) (`FILE`) * [Sticker message](#section-sticker-message) (`STICKER`) * [Video message](#section-video-message) (`VIDEO`) * [Voice message](#section-voice-message) (`VOICE`) * [Location message](#section-location-message) (`LOCATION`) * [Venue message](#section-venue-message) (`VENUE`) * [Contact message](#section-contact-message) (`CONTACT`) * [Request msisdn message](#section-request-msisdn-message)(`REQUEST_MSISDN`) ### Text Message Type `TEXT` is used when sending a text message. Message must be UTF-8 encoded. [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `TEXT`.", "1-0": "text", "1-1": "String", "1-2": "Text of the message." }, "cols": 3, "rows": 2 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"TEXT\",\n \"text\":\"Hello, World!\"\n }\n}", "language": "json" } ] } [/block] ### Image Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `IMAGE`.", "1-0": "url", "1-1": "String", "1-2": "URL of the image.", "2-0": "text", "2-1": "String", "2-2": "Optional text to display alongside the image." }, "cols": 3, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"IMAGE\",\n \"url\":\"https://example.com/image.png\",\n \"text\":\"Image description\"\n }\n}", "language": "json" } ] } [/block] ### Audio Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `AUDIO`.", "1-0": "url", "1-1": "String", "1-2": "URL of the audio file.", "2-0": "text", "2-1": "String", "2-2": "Optional text to display alongside the audio.", "3-0": "duration", "3-1": "number", "3-2": "Optional duration of the audio file in milliseconds.", "4-0": "performer", "4-1": "String", "4-2": "Optional name of the audio file performer.", "5-0": "title", "5-1": "String", "5-2": "Optional title of the audio file." }, "cols": 3, "rows": 6 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"AUDIO\",\n \"url\":\"https://example.com/song.mp3\",\n \"text\":\"Audio file description\",\n \t\"duration\": 180000,\n \"performer\": \"Performer name\",\n \"title\": \"Track title\"\n }\n}", "language": "json" } ] } [/block] ### File Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `FILE`.", "1-0": "url", "1-1": "String", "1-2": "URL of the file.", "2-0": "text", "2-1": "String", "2-2": "Optional text to display alongside the file." }, "cols": 3, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"FILE\",\n \"url\":\"https://example.com/file.pdf\",\n \"text\":\"Sample pdf file\"\n }\n}", "language": "json" } ] } [/block] ### Sticker Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `STICKER`.", "1-0": "url", "1-1": "String", "1-2": "URL of the sticker. Must be in `.webp` format." }, "cols": 3, "rows": 2 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"STICKER\",\n \"url\":\"https://example.com/sticker.webp\"\n }\n}", "language": "json" } ] } [/block] ### Video Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `VIDEO`.", "1-0": "url", "1-1": "String", "1-2": "URL of the video.", "2-0": "text", "2-1": "String", "2-2": "Optional text to display alongside the video.", "3-0": "duration", "3-1": "number", "3-2": "Optional duration of video in milliseconds.", "4-0": "width", "4-1": "number", "4-2": "Optional width of the video file.", "5-0": "height", "5-1": "number", "5-2": "Optional height of the video file." }, "cols": 3, "rows": 6 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"VIDEO\",\n \"url\":\"https://example.com/video.avi\",\n \"text\":\"Video description\",\n \"duration\": 10000,\n \"width\": 640,\n \"height\": 320\n }\n}", "language": "json" } ] } [/block] ### Voice Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `VOICE`.", "1-0": "url", "1-1": "String", "1-2": "URL of the voice file. It must be an OPUS encoded .ogg file.", "2-0": "text", "2-1": "String", "2-2": "Optional text to display alongside the voice file.", "3-0": "duration", "3-1": "number", "3-2": "Optional duration of the voice file." }, "cols": 3, "rows": 4 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"VOICE\",\n \"url\":\"https://example.com/voice.ogg\",\n \"text\":\"Voice description\",\n \"duration\": 10000\n }\n}", "language": "json" } ] } [/block] ### Location Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `LOCATION`.", "1-0": "latitude", "1-1": "number", "1-2": "Location latitude.", "2-0": "longitude", "2-1": "number", "2-2": "Location longitude." }, "cols": 3, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"LOCATION\",\n \"latitude\": 45.793413,\n\t\t\"longitude\": 15.946782\n }\n}", "language": "json" } ] } [/block] ### Venue Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `VENUE`.", "1-0": "latitude", "1-1": "number", "1-2": "Venue latitude.", "2-0": "longitude", "2-1": "number", "2-2": "Venue longitude.", "3-0": "title", "3-1": "String", "3-2": "Venue title.", "4-0": "address", "4-1": "String", "4-2": "Venue address." }, "cols": 3, "rows": 5 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"VENUE\",\n \"latitude\": 48.858370,\n\t\t\"longitude\": 2.294481,\n \"title\": \"Eiffel tower\",\n\t\t\"address\": \"5 Avenue Anatole France, Paris\"\n }\n}", "language": "json" } ] } [/block] ### Contact Message [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "String", "0-2": "Constant value - `CONTACT`.", "1-0": "phoneNumber", "1-1": "String", "1-2": "Contact's phone number.", "2-0": "firstName", "2-1": "String", "2-2": "Contact's first name.", "3-0": "lastName", "3-1": "String", "3-2": "Contact's last name." }, "cols": 3, "rows": 4 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"8F0792F86035A9F4290821F1EE6BC06A\",\n \"to\":\"9c29bd43-054b-4cfe-a1d4-0b37812b4ed3\",\n \"message\": {\n \"type\":\"CONTACT\",\n \"phoneNumber\": \"447700...\",\n\t\t\"firstName\": \"William\",\n\t\t\"lastName\": \"Shakespeare\"\n }\n}", "language": "json" } ] } [/block] ###Request msisdn message This type of message is used for requesting user's phone number. The user receives the keyboard with one button that is used for providing the phone number. [block:parameters] { "data": { "0-0": "type", "1-0": "text", "2-0": "buttonText", "0-1": "String", "1-1": "String", "2-1": "String", "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-2": "Constant value - `REQUEST_MSISDN`.", "1-2": "Message text.", "2-2": "Button text." }, "cols": 3, "rows": 3 } [/block] Request example [block:code] { "codes": [ { "code": "POST /telegram/1/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n\t\"from\": \"8F0792F86035A9F4290821F1EE6BC06A\",\n\t\"to\": \"986ABBBD989A7430A27439B955F2AEDA\",\n\t\"message\": {\n\t\t\"type\": \"REQUEST_MSISDN\",\n\t\t\"text\":\"For something we need your phone number\",\n\t\t\"buttonText\":\"Give my phone number\"\n\t}\n}", "language": "json" } ] } [/block]