Send SMS in VB.Net Bulk SMS API Documentation

Send SMS in VB.Net

The following bulk SMS API sample can be used to send out text messages in Single, Bulk, Group and Excel Upload.

Through Excel Upload we allow 2 types of text messages to be sent, one is normal with mobile numbers and second one is Custom. In custom, you can upload custom parameters which will be explained in detail in this documentation.

This sample API is for VB.Net in GET method.

Execute VB.Net Sample Code - Live Demo

Application API URL:

Key Value Description
Login Credentials (Required Parameters)
Authenticate your API request using userId-password or apiKey. You should use either one to authenticate your login.
userId Your Registered Username The registered username parameter to be passed. You can use this if apiKey is not being used.
password Your password The password needs to be urlencoded if there are any special characters used in the password field. You can use this if apiKey is not being used.
apiKey Your unique apiKey apiKey needs to be sent as HTTP header when you are not using userId and password credentials. You can avail this from your user control panel and use instead of userId and password HTTP Request parameter. Please do not disclose this to anyone.
Required Parameters
sendMethod simpleMsg | groupMsg | excelMsg

simpleMsg: This value required for single or comma separated mobile numbers SMS.

groupMsg: This value required for Group SMS option.

excelMsg: This value required for Bulk Upload option.

senderId Approved Sender Name For Indian customers, sender name would be of 6 alpha characters. For International customers, sender name depends on country to country basis. senderId parameter is an optional for Promotional Gateway customers. You need not include this parameter if you have opted for promotional gateway.
msgType text|unicode|flash This is to define simple or UNICODE message. For simple English, you can give value as text or for non-English messages, give value as unicode.

For flash message, message content maximum 160 characters allowed.
msg Your text message This is the message content which you want to send to your clients.

View Cost/Count
Default Parameters (Optional)
format plain|json|xml Value for response format.

System default is plain. If you need responses in JSON or XML then you have to give value as JSON or XML.
duplicateCheck true|false Checks and removes Duplicate mobile numbers.

System default is true. You can turn off duplicate checking of mobile numbers by giving value as false, duplicate numbers wont be removed.
scheduleTime datetime format (YYYY-MM-DD HH:MM:SS) Value for Scheduling.

System default is null. If you want to enable then use this parameter and give value as YYYY-MM-DD HH:MM:SS.
Simple Message - Single or Bulk (Required for simpleMsg)
mobile 10 or 12 Digits mobile number. Mobile number format can be 10 to 12 digits prefix with 0 or 91. Preferred mobile format is prefix with country code 91. You can include single number or comma separated numbers. Maximum comma separated mobile numbers allowed are 1000.

While sending Simple message, sendMethod parameter needs to be simpleMsg
Group Message - Single or Multiple Groups (Required for groupMsg)
group Group IDs / Group Names.

1123,1321 OR

mygroup, othergroup OR

Sending SMS to your saved Contacts grouped by Group Name or Group ID.

You can send to single group or multiple groups at once separated by comma. Valid Group IDs or Group names should be mentioned in this parameter. For multiple groups, please separate by comma.

While sending Group SMS message, sendMethod parameter needs to be groupMsg
Bulk Upload (Required for excelMsg)
file file path File path to be given of the file.

While sending Bulk Upload message, sendMethod parameter needs to be excelMsg
fileType csv | xls | xlsx | zip | txt We allow 5 extensions in bulk upload.

Maximum File Size Allowed: 15MB

Link Tracking
trackLink true | false System default is false. Set this to true if you want to enable advanced link tracking. The last URL from your message will be converted to short URL. If you do not use this parameter, the value of this parameter will be false.
appendHttp true | false System default is true. Set this to false if you do not want to include HTTPS protocol to save additional 8 characters i.e. https:// will be excluded from the short URL. If you do not use this parameter, the value of this parameter will be true and this parameter only works only when trackLink is set to true.
testMessage true | false System default is false. Set this to true if you want to test our API. Messages wont be delivered and SMS balance wont be deducted. If you do not use this parameter, the value of this parameter will be false.

Save this Page on your Favorite Social Media

Sample Request Code


Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text.RegularExpressions
Imports System.Web
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Resources

Namespace Rextester
    Public Module Program
        Public Sub Main(args() As string)
            Dim userId = "YourUsername"
            Dim password = "YourPassword"
            Dim sendMethod = "simpleMsg"
            Dim msgType = "text"
            Dim msg = "Hello World"
            Dim mobile = "919999999999"
            Dim senderId = "SGCSMS"
            Dim url As String = ""
            Dim strGet As String

            strGet = url + "userId=" + userId _
            + "&password=" + password _
            + "&sendMethod=" + sendMethod _
            + "&msgType=" + msgType _
            + "&mobile=" + mobile _
            + "&msg=" + WebUtility.UrlEncode(msg) _
            + "&senderId=" + senderId

            Dim webClient As New System.Net.WebClient
            Dim result As String = webClient.DownloadString(strGet)

        End Sub
    End Module
End Namespace


Imports System
Imports System.Collections.Specialized
Imports System.IO
Imports System.Net

Namespace SimpleMsg
    Public NotInheritable Class ImportUtilities
        Public Shared Sub HttpUploadFile(ByVal url As String, ByVal file As String, ByVal paramName As String, ByVal contentType As String, ByVal nvc As NameValueCollection)
            Console.WriteLine(String.Format("Uploading {0} to {1}", file, url))
            Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString("x")
            Dim boundarybytes As Byte() = System.Text.Encoding.ASCII.GetBytes(vbCrLf & "--" & boundary & vbCrLf)
            Dim wr As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
            wr.ContentType = "multipart/form-data; boundary=" & boundary
            wr.Method = "POST"
            wr.KeepAlive = True
            wr.Credentials = System.Net.CredentialCache.DefaultCredentials
            Dim rs As Stream = wr.GetRequestStream()
            Dim formdataTemplate As String = "Content-Disposition: form-data; name=""{0}""" & vbCrLf & vbCrLf & "{1}"

            For Each key As String In nvc.Keys
                rs.Write(boundarybytes, 0, boundarybytes.Length)
                Dim formitem As String = String.Format(formdataTemplate, key, nvc(key))
                Dim formitembytes As Byte() = System.Text.Encoding.UTF8.GetBytes(formitem)
                rs.Write(formitembytes, 0, formitembytes.Length)

            rs.Write(boundarybytes, 0, boundarybytes.Length)
            Dim headerTemplate As String = "Content-Disposition: form-data; name=""{0}""; filename=""{1}""" & vbCrLf & "Content-Type: {2}" & vbCrLf & vbCrLf
            Dim header As String = String.Format(headerTemplate, paramName, file, contentType)
            Dim headerbytes As Byte() = System.Text.Encoding.UTF8.GetBytes(header)
            rs.Write(headerbytes, 0, headerbytes.Length)
            Dim fileStream As FileStream = New FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite)
            Dim buffer As Byte() = New Byte(4095) {}
            Dim bytesRead As Integer = 0

            While (CSharpImpl.__Assign(bytesRead, fileStream.Read(buffer, 0, buffer.Length))) <> 0
                rs.Write(buffer, 0, bytesRead)
            End While

            Dim trailer As Byte() = System.Text.Encoding.ASCII.GetBytes(vbCrLf & "--" & boundary & "--" & vbCrLf)
            rs.Write(trailer, 0, trailer.Length)
            rs = Nothing
            Dim wresp As WebResponse = Nothing

                wresp = wr.GetResponse()
                Dim stream2 As Stream = wresp.GetResponseStream()
                Dim reader2 As StreamReader = New StreamReader(stream2)
                Dim target As String = String.Empty
                target = reader2.ReadToEnd()
            Catch ex As Exception
                Console.WriteLine("Error uploading file:" & file)
                Throw ex

                If wresp IsNot Nothing Then
                    wresp = Nothing
                End If

                wr = Nothing
            End Try
        End Sub

        Private Shared Sub Main(ByVal args As String())
            Dim nvc As NameValueCollection = New NameValueCollection()
            nvc.Add("userId", "XXXX")
            nvc.Add("password", "XXXX")
            nvc.Add("msg", "This is test message using bulkupload")
            nvc.Add("msgType", "text")
            nvc.Add("fileType", "csv")
            nvc.Add("senderId", "SGCSMS")
            nvc.Add("sendMethod", "excelMsg")
            nvc.Add("format", "JSON")
            HttpUploadFile("", "Hello.csv", "file", "application/CSV", nvc)
        End Sub

        Private Class CSharpImpl
            <Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
            Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
                target = value
                Return value
            End Function
        End Class
    End Class
End Namespace


    "status": "success",
    "mobile": "919999999999, 919999999998",
    "invalidMobile": "",
    "transactionId": "595748da-bab8-4da7-ae9e-5a97007ae49b",
    "statusCode": "900",
    "reason": "success"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <mobile>919999999999, 919999999998</mobile>
status=success | mobile=919999999999, 919999999998 | invalidMobile= | transactionId=b4c7a895-773e-4cff-b4cb-5df2d6fa4139 | errorCode=900 | reason=success