How to forward incoming SMS messages with MikroTik to another phone number

Today, I will show you practically how to forward incoming SMS messages with MikroTik to another phone number if we don’t have physical access to a sim card.
The script retrieves incoming SMS messages, extracts essential information such as the sender, message content, and timestamp, and forwards message content to an additional phone number.

We will create a MikroTik script called “forward-incoming-sms” to handle incoming SMS messages. You can run this script on MikroTik Terminal. Here is the code for the script:

/system script
add name=forward-incoming-sms source={
  :local inboxData [/tool sms inbox print as-value]
  :put ("inboxData: " . $inboxData)

  :local messageCount ([:len $inboxData] - 1)
  :local index 0

  :put ("messageCount: " . $messageCount)

  :while ($index <= $messageCount) do={
    :global sender ([:pick $inboxData $index]->"phone")
    :global message ([:pick $inboxData $index]->"message")
    :global timestamp ([:pick $inboxData $index]->"timestamp")

    /tool sms send port=lte1 phone-number=YOUR_PHONE_NUMBER message=("$message") status-report-request=no
    /tool sms inbox remove $index

    :set index ($index + 1)
 /system script run forward-incoming-sms
 /system scheduler add name=forward-incoming-sms interval=10s on-event="/system script run forward-incoming-sms" start-time=startup

In this script, you need to change YOUR_PHONE_NUMBER in format +37061234567.

Removes the script and scheduler

If you wish to remove the “forward-incoming-sms” script and scheduler that we added by the previous code, you can use the following commands.

/system scheduler remove forward-incoming-sms
/system script remove forward-incoming-sms

The first command removed the script “forward-incoming-sms” from the MikroTik service, ensuring it is no longer available for execution.

The second command removed the scheduler called “forward-incoming-sms”, which was responsible for triggering the execution of the “forward-incoming-sms” script at the regular intervals.

By running these commands, you can effectively remove the script and scheduler components that were previously added.


By following today’s instructions, we created a small service that allows us to forward all incoming SMS messages to another phone number. In the next session, we will try to solve the issue with SMS messages longer than 160 characters because MikroTik cannot allow us to send SMS messages longer than 160 characters.