How to create a Blacklist in nowsms

How to create a Blacklist in nowsms SearchSearch

SMS & MMS Technical Forum » NowSMS Support - SMS Issues (Product Support Only) » How to create a Blacklist in nowsms « Previous || Next »
Author Message
Michael Loh
New member
Username: Ahthers

Post Number: 1
Registered: 04-2020
Posted on Wednesday, April 15, 2020 - 05:57 am:   

Hi, I have a list of numbers and would like to block the gateway from sending out those numbers, how could i do that?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6124
Registered: 08-2008
Posted on Wednesday, April 15, 2020 - 03:28 pm:   

Hi,

The blacklist is implemented through a text file BLACKLIST.TXT in the DLISTS directory under NowSMS. This is a simple text file with one number entry per line.

It is also possible to use HTTP APIs to add/remove entries, where it is accessed via the DLIST API using a DlistName of BLACKLIST (see https://www.nowsms.com/editing-distribution-lists-and-address-books-in-nowsms)

There are also some old PHP scripts described at https://www.nowsms.com/sms-distribution-lists-with-php which may be helpful. However, these scripts are HTTP only and need modification to support HTTPS.

The blacklist is also accessible via the web interface by logging in with a user account that has admin access.

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 3
Registered: 04-2020
Posted on Wednesday, April 15, 2020 - 03:35 pm:   

Thanks Michael for the question. Did not know this feature exists. Just tried it, it does not work for me Des.

The one number per line I tried both international format +country code as well as non country code.

Is there any other setting needed on ini file or the configuration for this to work?
James Wattana
New member
Username: James_watt

Post Number: 7
Registered: 04-2020
Posted on Thursday, April 16, 2020 - 02:42 pm:   

This one still not working, any help? I would like to do some blacklist broadcasting as well.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6127
Registered: 08-2008
Posted on Thursday, April 16, 2020 - 03:21 pm:   

It was added in 2017 versions. A lot of these types of features are documented only in the readme / changes.txt: https://www.nowsms.com/download/changes.txt

It blocks on a string match, so if both international and national format are in use, both would need to be added.

Wildcards are supported: ? to match exactly 1 character, or * to match 0 or more characters. But the web interface won't let wildcards be added, so it is recommended they be added by directly editing DLISTS/BLACKLIST.TXT. This can be useful for blocking invalid number formats ... there is interesting discussion of this here: https://support.nowsms.com/discus/messages/1/74299.html

Note that this blacklist only blocks submission to the blacklisted number. It will not effect messages that are already queued.

SMPP submission attempts will receive an error: Invalid Dest Addr - ESME_RINVDSTADR. HTTP submissions will receive an error, unless the submission is to multiple numbers, in which case any unblocked numbers will be allowed.

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 8
Registered: 04-2020
Posted on Thursday, April 16, 2020 - 03:24 pm:   

Its strange. Have tried added both international and local format, each line with exact number. It is still sending to the number. Any other settings needed under .ini flle?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6129
Registered: 08-2008
Posted on Thursday, April 16, 2020 - 03:35 pm:   

No, it is automatic if the DLISTS\BLACKLIST.TXT file exists. Any changes may take 1-2 minutes to take effect after updating this file.

Logging in to the web interface using an SMS user account with admin access should show this list under Admin/Blocked Numbers. Do you see your list there?

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 10
Registered: 04-2020
Posted on Thursday, April 16, 2020 - 03:40 pm:   

Other lists are showing number.

This one a bit weird!

BLACKLIST
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6131
Registered: 08-2008
Posted on Thursday, April 16, 2020 - 03:51 pm:   

What text editor is being used?

It does't appear to be saving the contents in a text format.

Use notepad
James Wattana
New member
Username: James_watt

Post Number: 12
Registered: 04-2020
Posted on Thursday, April 16, 2020 - 04:10 pm:   

Am using notepad, not sure why. But I have deleted the file and re-create from Web Interface, now the name/number is showing correctly.

But sending the SMS still receive even though it is on the blacklist.

Another question is we want to have "master blacklist" regardless which user account it sending from. Do we put it on the root directory of DLISTS? If so how we access the blacklist from web interface since we need login to the web interface which will be a user account (hence a folder and the BLACKLIST file).
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6132
Registered: 08-2008
Posted on Thursday, April 16, 2020 - 04:16 pm:   

Maybe Notepad was defaulting to a Unicode format when creating the text file. NowSMS expects ANSI or UTF-8 text encoding.

There is only a master blacklist, and it must be in the root of DLISTS...if you're trying to create it under a user account, that is why it is not working.

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 13
Registered: 04-2020
Posted on Thursday, April 16, 2020 - 04:25 pm:   

Awesome, works now, thanks a lot!
James Wattana
New member
Username: James_watt

Post Number: 18
Registered: 04-2020
Posted on Thursday, April 23, 2020 - 09:15 am:   

hi des, is there a way to use email to add number to blacklist?

if email not possible, how about http post?

thanks.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6137
Registered: 08-2008
Posted on Thursday, April 23, 2020 - 02:44 pm:   

Hi James,

It is also possible to use HTTP APIs to add/remove entries, where it is accessed via the DLIST API using a DlistName of BLACKLIST (see https://www.nowsms.com/editing-distribution-lists-and-address-books-in-nowsms)

There are also some old PHP scripts described at https://www.nowsms.com/sms-distribution-lists-with-php which may be helpful.

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 19
Registered: 04-2020
Posted on Thursday, April 23, 2020 - 03:31 pm:   

Thank you. Not working well here. I guess is authentication. Just wondering what is the username/pwd to use since if we create a user it will be under its own folder but BLACKLIST is on the root directory.

parameter is correct?

http://IP:port/dlists?User=test&Password=1234&DListName=BLACKLIST&DListMemberAct ion=Add&DListMember=1234&DListMemberName=Me

thanks.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6138
Registered: 08-2008
Posted on Friday, April 24, 2020 - 05:13 am:   

Sorry, yes, you are correct.

This is a system level list, so the DListName used in the API is actually #BLACKLIST

It is also important to note that the # character needs to be URL escaped, which the PHP script will do, but if you are manually building the URL, it would be &DListName=%23BLACKLIST

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 20
Registered: 04-2020
Posted on Friday, April 24, 2020 - 07:12 am:   

Upon execute this http://IP:port/dlists?User=test&Password=1234&DListName=%23BLACKLIST&DListMemberAct ion=Add&DListMember=1234&DListMemberName=SMSReply

it shows this screen and does not seem like adding the "1234" blacklist number automatically to BLACKLIST file. Any clue?


Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6139
Registered: 08-2008
Posted on Monday, April 27, 2020 - 03:07 pm:   

The HTTP response is confused, but it works in all my tests. (Originally this "API" was developed to support an interactive web interface, so the response is HTML, which is something we should change.)

Make sure that the user account in "SMS Users" has admin access.

And actually, as I look at that response you included, I think it is working...1234 was added to the list.

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 22
Registered: 04-2020
Posted on Thursday, April 30, 2020 - 01:01 am:   

"Make sure that the user account in "SMS Users" has admin access." this you refer to?

Upon execute this http://IP:port/dlists?User=test&Password=1234&DListName=%23BLACKLIST&DListMember Act ion=Add&DListMember=1234&DListMemberName=SMSReply and we check the BLACKLIST the 1234 is not added.

Any other idea what we missed out?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6145
Registered: 08-2008
Posted on Friday, May 01, 2020 - 07:59 pm:   

Admin access is an "SMS User" account attribute:

James Wattana
New member
Username: James_watt

Post Number: 23
Registered: 04-2020
Posted on Saturday, May 02, 2020 - 03:57 am:   

hi des, we have enabled that "Admin Access" with for example, user1.

to confirm again, this is correct parameter?
http://127.0.0.1:8800/dlists?User=user1&Password=1234&DListName=%23BLACKLIST&DListMemberAction=Add&DListMember=12345678&DListMemberName=Unsubscribe where 12345678 is the contact to block.

QUESTIONS
1) How do we http post so it will add to /dlists/BLACKLIST.txt instead of /dlists/user1/blacklist.txt.

2) Whenever we http post, it shows the address book interface. Isn't that http post should direct write to the blacklist.txt file or it is just show us the interface and we have to manual to add the contact?




thank you.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6146
Registered: 08-2008
Posted on Monday, May 04, 2020 - 06:32 pm:   

Hi James,

I have no idea why this isn't working for you. What is the NowSMS version?

Are you sending the request from a web browser? This may be adding a layer of confusion...make sure you are NOT already logged in, otherwise there may be some confusion about which user is making the request (the user logged in, or the one in the URL).

In my tests, I've been mostly using CURL from the command line.

What web browser are you using?

I did do some more investigation, and found that there is also a DlistPublic=Yes parameter that can be used. If you use this, change DlistName=%23BLACKLIST to DListName=BLACKLIST&DListPublic=Yes

Also note that DListMemberName is optional...and I would recommend against using it, as it has no function or relevance to this list. (If you use it, and there is an entry with a matching name, that entry will be replaced.)

--
Des
NowSMS Support
James Wattana
New member
Username: James_watt

Post Number: 24
Registered: 04-2020
Posted on Tuesday, May 05, 2020 - 02:32 am:   

finally it works. But weird if http://127.0.0.1 local IP http post it works correctly. If public IP it keeps popping up the contacts UI no matter which browser in use.

Add Your Message Here, or click here to create a new discussion topic.
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image
Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Click here to create an account.
Username:
Password:
Options: Automatically activate URLs in message
Action:

Login Login / Register Logout Logout Search Last 30 Days Topics Topics