Technology trends, insights, success
stories and other helpful resources.

Microsoft Dynamics NAV integration with Telegram

January 20th, 2017 Intech SystemNishit Patel Dynamics NAV, Microsoft Dynamics

As we all know that BOTs are the most buzz topic now-a-days and Telegram messaging application has a good hold on it as a platform. Recently we  received a couple of feedback from our customers to integrate some messaging application with Dynamics NAV because that’s where they work-in the whole day and they don’t like to switch the screen to connect with their co-workers. We had been searching a good BOT to integrate with our ERP until we ended up crafting it on Telegram. It’s very easy and fun work.

Easiest Steps to Integrate Telegram with Microsoft Dynamics NAV

  1. Connect to @BotFather account of Telegram by searching like this

      2. Create new bot by sending /newBot command

      3. It will ask for your Bot name that you want to create.

      4. Give Suitable name that ends with for Ex: NAV_bot.

5. Each bot is given a unique authentication token when it is created. The token looks something like             326076132:AAEufsce4s2sg5b6mdbmW_KLTcbmS-HeVXY.

  • To generate token, just go into botFather account.
  • Send /token
  • It will ask you that, for which bot you want to generate token.
  • Just Tap on our newly created bot name @Navision_bot.
  • That’s it, just copy this token for your reference.

      6. Now, I have created this bot to Integrate with NAVISION, so for that you require to               generate Chat IDs of users to send chat messages to any Telegram User.

  • First of all, users will have to send test message to the BOT that you created.
  • For that, search your bot account in Telegram starts with @ Sign followed by your Bot Name.
  • Just enter into your bot, and type /Start to send test message to generate your Chat ID.
  • Now, your Chat ID generated and you will get it by calling getUpdates method of Telegram API, for this you have to call getUpdates method in web browser as follows.
  • https://api.telegram.org/bot<Your Bot Name>/getUpdates
  • For Ex: https://api.telegram.org/324480200:AAGxuzqskveyV-ZBTM81P0CCI2qartfWPfo/getUpdates
  • You will see the response of telegram in JSON format as follows.
  • From here you can get the Chat IDs.

       7. All set, now you can send message to any user. And it will have sent from your newly             created

  • To Integrate Telegram with NAV, we have focused to send requests via CURL tool, that silently run HTTP requests from
  • For Ex:
  • Open CMD.
  • Go to the path where your CURL tool is there.
  • Run the command to send Http Post request like this: Curl -X POST “https://api.telegram.org/bot326076132:AAEufscs4s2sg5b6mEbmW_KLTcbmS-HeVXY/sendMessage” -d “chat_id=163898670&text=my sample text”

All Above Steps are to test sample message sending from HTTP request.
8. Now to Integrate Telegram with NAV, you will have to send HTTP requests from                      NAV code, For that, I have used CURL tool that run silently from your PC and sends              HTTP request.

   9. Create One Automation variable of ‘Windows Script Host Object Model’.WshShell                  to open CMD and run CURL command.

       10. Here are some sample commands to send messages and send attachments from                      NAV.

  • curl -X POST “https://api.telegram.org/bot326076132:AAEufccs4s2kg5b6mfbmW_KLTcbmS-HeVXY/sendMessage” -d “chat_id=-189801512&text=my sample text”
  • curl -F chat_id=”35065383″ -F document=@”//intechserver/Shared/FTP/Attachments/Temp.pdf” -F caption=”PFA” https://api.telegram.org/bot326076132:AAEufscs4s2sg5b6mEbmW_KLTcbmS-HeVXY/sendDocument
  • just run above commands from NAV with the use of Automation variable.

       11. Just create Two tables, one is for chat IDs for individual NAV users and another is                 to create telegram message queue.

  1. Chat IDs table will contain user ID and Chat ID fields.
  2. Message queue table will contain User ID of receiver, attachment, Message body fields.
  3. Now do code for send message Action with the use of above automation variable and CMD command as above.

       12. Final NAV will look like this,

This page contains Chat IDs of Individual Users in NAV.

This Page will send Message to particular User that was added in Chat IDs table.
Just place sendMessage code on this Send Message Action

You can keep Sent Message Entries by creating another page like this.

If you need any help, feel free to reach us.

About Intech

Intech Systems is a three-cloud Microsoft-certified partner that boasts deep expertise in providing digital transformation solutions for organizations by leveraging the Microsoft 365, Dynamics 365, and Azure solution stack. Intech is recognized as a top-tier Microsoft implementation partner globally and specializes in transformative technology solutions such as ERP (Enterprise Resource Planning), CRM (Customer Relationship Management), Business Process Automation, Business Intelligence, Cloud Infrastructure, Data Management, Productivity & Collaboration and Generative AI (Gen-AI) solutions. As a trusted Microsoft Solutions Partner, we are capable of doing complex technology implementations catered to an organization’s specific needs & also rapid solution implementation such as our Microsoft Dynamics 365 Business Central implementation packages. We pair our implementations with end-to-end customer support, offshore development & 3rd party integrations. With offices in India, USA (United States of America), and Singapore, we work with clients across globe to empower businesses with cutting-edge technology solutions. Our latest services aim at delivering business ready AI solutions to the customer, like our  Microsoft Copilot Consulting Services & Solutions for small, medium & large enterprises. Intech’s expertise lies in building software solutions for Manufacturing, Professional Services & Healthcare.  Our Dealer Management SystemSales and Service CRM for Manufacturing, Field Force Automation for Pharmaceuticals and Manufacturing Central are some of our leading industry solutions. Intech’s vision is to catalyze digital futures for operation-centric industries globally, we are at the forefront of innovation, helping organizations drive growth and innovation like never before. Contact Us to learn more.

Contact Us

How can we help? - Talk to Dynamics 365 experts for your concerns

What's New

Microsoft Dynamics 365 Voice Channel: Transforming Customer Service for the Digital Age
Dynamics 365 October 17th, 2024

Microsoft Dynamics 365 Voice Channel: Transforming Customer Service for the Digital Age

A Day in the Life of Customer Service: Sound Familiar? Picture this: It's 9:05 AM...

Business Central's Project Management Enhancements
Business Central May 4th, 2024

Business Central Project Management Enhancements: Power Up Your Projects

As businesses grow and projects multiply, managing invoices efficiently becomes crucial. In the 2024 release wave...

AI March 18th, 2024

Exploring Trends for AI in CRM and ERP Systems [2024]

Exploring Trends for AI in CRM and ERP Systems [2024] Did you know that a...