{"id":25524,"date":"2021-03-25T08:30:00","date_gmt":"2021-03-25T07:30:00","guid":{"rendered":"https:\/\/www.sms77.io\/?p=25524"},"modified":"2023-05-22T07:29:36","modified_gmt":"2023-05-22T05:29:36","slug":"tutorial-forward-sms-to-telegram","status":"publish","type":"post","link":"https:\/\/www.seven.io\/en\/blog\/tutorial-forward-sms-to-telegram\/","title":{"rendered":"Tutorial: Forward SMS to Telegram"},"content":{"rendered":"<section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h2>From the everyday life of our customers: Use the Telegram chatbot to receive text messages<\/h2>\n<p>The beauty of working with an SMS gateway is that you can benefit from SMS as a strong medium, while the gateway&#8217;s capabilities give you a lot of flexibility. Especially the function to forward SMS is very popular with our customers to realize many creative application scenarios. For example, one of our customers had the following request: He wanted to forward SMS to Telegram.<\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3>The idea &#8211; Forward SMS to Telegram<\/h3>\n<\/div><\/div><div class=\"w-separator size_small\"><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-8 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>Our customer receives SMS via a <a href=\"https:\/\/seven.io\/en\/products\/inbound-sms\/\" rel=\"noopener\">dedicated inbound number<\/a>. Both the text of the incoming SMS and the sender need to be forwarded to the chatbot. Here&#8217;s the thing: Making the <a href=\"https:\/\/help.seven.io\/en\/receive-replies\" target=\"_blank\" rel=\"noopener\" data-schema-attribute=\"\">settings to forward incoming SMS<\/a> is easy in our webapp, but the addition that both text and sender are forwarded requires additional parameters.<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-4 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"ult-just-icon-wrapper  \"><div class=\"align-icon\" style=\"text-align:center;\">\n<div class=\"aio-icon none \"  style=\"color:#52c0fa;font-size:85px;display:inline-block;\">\n\t<i class=\"Defaults-lightbulb-o\"><\/i>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small color_alternate\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3>The implementation<\/h3>\n<p>To put this idea into action, we need three components: The chatbot, a chat ID, and the actual redirection for incoming SMS. We create the chatbot in Telegram, after which we can determine the chat ID. We then set the forwarding in the seven webapp. If you already have a chatbot and know the chat ID, you can skip to <a href=\"#theforwarding\">The forwarding<\/a> section.<br \/>\nLet&#8217;s get started! You&#8217;ll be able to forward SMS to Telegram in no time.<\/p>\n<\/div><\/div><div class=\"w-separator size_small\"><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-8 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h4>The chatbot<\/h4>\n<p>First, let&#8217;s create a Telegrambot. For this you will need:<\/p>\n<ul>\n<li>A <a href=\"https:\/\/telegram.org\" target=\"_blank\" rel=\"noopener\" data-schema-attribute=\"\">Telegram account<\/a>.<\/li>\n<li>Access to the Telegram messenger.<\/li>\n<\/ul>\n<p>Open the Messenger and log in if necessary. Then search for <strong>@BotFather<\/strong> in the contacts search bar and select the BotFather. Notice that the correct bot has a <strong>blue check<\/strong> mark. Then click <strong>Start<\/strong> in the chat.<\/p>\n<p>In this chat you can manage your bots and create new bots. We want to create a new bot and send the <strong>\/newbot<\/strong> command to do so. You will be prompted to choose a name for your bot. This name will be displayed in the conversation. After that, you choose a username for your bot. This one must end in &#8220;bot&#8221;.<\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-4 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-image align_center\"><div class=\"w-image-h\"><img decoding=\"async\" width=\"300\" height=\"375\" src=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-300x375.png\" class=\"attachment-us_300_0 size-us_300_0\" alt=\"W\u00e4hlen Sie den richtigen Bot aus. Sie erkennen ihn an dem blauen Haken.\" loading=\"lazy\" srcset=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-300x375.png 300w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-240x300.png 240w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-819x1024.png 819w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-250x313.png 250w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-600x750.png 600w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-768x961.png 768w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-400x500.png 400w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-320x400.png 320w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather-200x250.png 200w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_botfather.png 957w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p style=\"text-align: center;\"><em>Be careful, only the top bot is the right one!<\/em><\/p>\n<\/div><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-separator size_small\"><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>That&#8217;s it! You have created your Telegram bot. In the confirmation message you will receive the link to the conversation with your new bot and your token, which will become important for us in the next section.<\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_middle type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h4>The Chat ID<\/h4>\n<p>Now we are missing the chat ID to successfully set up the forwarding. There are a few ways to find out this ID, but we recommend this one: Open the chat with your new bot and click &#8220;Start&#8221;. Send a message to the bot. Then call <code>https:\/\/api.telegram.org\/botTOKEN\/getUpdates<\/code>. Instead of TOKEN, of course, you put the token for your bot that you received from BotFather. In your return, you will see the chat id. It is after the value <code>\"id\"<\/code>, not after <code>\"update_id\"<\/code>.<\/p>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><pre class=\"prettyprint\">{\r\n  \"ok\":true,\r\n  \"result\":[\r\n    {\r\n      \"update_id\":583557485,\r\n      \"message\":{\r\n        \"message_id\":3,\r\n        \"from\":{\r\n          \"id\":1687380549,\r\n          \"is_bot\":false,\r\n          \"first_name\":\"Jana\",\r\n          \"last_name\":\"L\",\r\n          \"language_code\":\"de\"\r\n        },\r\n        \"chat\":{\r\n          \"id\":1687380549,\r\n          \"first_name\":\"Jana\",\r\n          \"last_name\":\"L\u201d\",\r\n          \"type\":\"private\"\r\n        },\r\n        \"date\":1615446212,\r\n        \"text\":\"Hello again\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>In one of our test runs, we had to send our bot a second message to get an output other than <code>{\"ok\":true, \"result\":}<\/code>. Perhaps a little more patience would have done the trick though! In all other cases, the output worked immediately after sending the first message.<\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small color_alternate\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h4 id=\"theforwarding\">The forwarding<\/h4>\n<p>Now we want your new chatbot to show you incoming SMS with their sender. To do this, log in to our webapp and go to the <a href=\"https:\/\/app.seven.io\/developer\" data-schema-attribute=\"\" rel=\"noopener\">Developers<\/a> menu item. On the right side you will find your webhooks. We want to create a new webhook for our chatbot function and click on the green plus sign.<\/p>\n<\/div><\/div><div class=\"w-separator size_small\"><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-6 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-image no-border align_center\"><a ref=\"magnificPopup\" href=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en.png\" aria-label=\"blog_telegram_sms_webhooks_en\" class=\"w-image-h\"><img decoding=\"async\" width=\"1080\" height=\"726\" src=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en.png\" class=\"attachment-full size-full\" alt=\"You can set SMS forwarding via webhook in the developer area\" loading=\"lazy\" srcset=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en.png 1080w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-300x202.png 300w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-1024x688.png 1024w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-250x168.png 250w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-600x403.png 600w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-768x516.png 768w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-400x269.png 400w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-595x400.png 595w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_sms_webhooks_en-200x134.png 200w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-6 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-image no-border align_center\"><a ref=\"magnificPopup\" href=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN.png\" aria-label=\"blog_telegram_webhooksettings_EN\" class=\"w-image-h\"><img decoding=\"async\" width=\"1080\" height=\"719\" src=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN.png\" class=\"attachment-full size-full\" alt=\"In the Webhook settings, configure the forwarding of the SMS to Telegram\" loading=\"lazy\" srcset=\"https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN.png 1080w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-300x200.png 300w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-1024x682.png 1024w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-250x166.png 250w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-600x400.png 600w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-768x511.png 768w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-400x266.png 400w, https:\/\/www.seven.io\/wp-content\/uploads\/blog_telegram_webhooksettings_EN-200x133.png 200w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/div><\/div><\/div><\/div><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-separator size_small\"><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>Paste this URL: <code>https:\/\/api.telegram.org\/botMYTOKEN\/sendMessage?chat_id=MYCHATID&amp;text=SMS+from+:+{text}}<\/code> Instead of MYTOKEN use the token you received earlier, instead of MYCHATID put the determined chat ID. Under <strong>Event<\/strong> you select SMS_MO. Under <strong>Filter<\/strong> you can set whether you want to forward all incoming SMS or only those sent to a specific number. Make your selection and save.<\/p>\n<p>And that&#8217;s it! You are now able to forward SMS to Telegram.<\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>Do you also have an example of how you use our products? Do you have ideas that you have not yet been able to implement?<br \/>\nWe&#8217;d love to hear <a href=\"mailto:support@seven.io\">your story<\/a>!<\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-separator size_medium with_line width_default thick_1 style_solid color_border align_center with_text with_content\"><div class=\"w-separator-h\"><h6 class=\"w-separator-text\"><span>Best regards<\/span><\/h6><\/div><\/div><div class=\"w-image align_center\"><div class=\"w-image-h\"><img decoding=\"async\" width=\"289\" height=\"38\" src=\"https:\/\/www.seven.io\/wp-content\/uploads\/2017\/07\/unterschrift-1.png\" class=\"attachment-large size-large\" alt=\"Your sms77 team\" loading=\"lazy\" \/><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_small\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_flex valign_top type_default stacking_default\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p style=\"text-align: center;\"><em>Header: iStock.com\/tdhster<\/em><\/p>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"From the everyday life of our customers: Use the Telegram chatbot to receive text messages The beauty of working with an SMS gateway is that you can benefit from SMS as a strong medium, while the gateway&#8217;s capabilities give you a lot of flexibility. Especially the function to forward SMS is very popular with our...","protected":false},"author":1,"featured_media":25457,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[406],"tags":[5295,5254,5249,5294,5293],"class_list":["post-25524","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials-en","tag-chatbot-en","tag-forward-sms","tag-sms-weiterleiten-en","tag-telegram-en","tag-tutorials"],"_links":{"self":[{"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/posts\/25524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/comments?post=25524"}],"version-history":[{"count":19,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/posts\/25524\/revisions"}],"predecessor-version":[{"id":89947,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/posts\/25524\/revisions\/89947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/media\/25457"}],"wp:attachment":[{"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/media?parent=25524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/categories?post=25524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.seven.io\/en\/wp-json\/wp\/v2\/tags?post=25524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}