Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bulk sms in vfp9 1

Status
Not open for further replies.

PARMARTH CHAUHAN

Programmer
Oct 5, 2022
3
IN
Hello, I am making a bulk sms sending application which will send sms thru WEB API, I already made a excel import template which works perfectly but i am not able to adjust the list of mobile nos in api
demo api : msg= Hello
in this api with every following mobile no a ','is to be inserted.
i am successful in importing the excel into cursor but not able to replace the data in api in the required format.

Please Help...... :)


Thanks in Advance
 
Get Excel data in a dbf and use scan endscan loop and then call api for individual no. Say for ex.

Code:
Select MyContacts
Scan 
pcMobile = Mobileno
*----Call url here with executeurl or other api call
[indent][/indent]*[URL unfurl="true"]http://aaa.aaa.in/app/smsapi/index.php?key=+;[/URL]
[indent][/indent]<key>&campaign=<nos>&routeid=<nos>&type=text&contacts=<MobileNo>&senderid=<id>&msg='Hello'
Endscan
 
You can read excel into a cursor and then not output a comma separated list?

Well, well.

Code:
create cursor numbers (mobileno char(9))
insert into numbers values ('123456789')
insert into numbers values ('123454321')
insert into numbers values ('987654321')

Local lcNumbers = ""
scan
   lcNumbers = lcNumbers+alltrim(mobileno)+","
endscan

? lcNumbers

I leave the homework for you to remove the last comma in the final lcNumbers value.

Chriss
 
I leave the homework for you to remove the last comma in the final lcNumbers value
.

HINT:
PADR() can be a very handy function.

EDIT: The above is rubbish. I should have said RTRIM(), not PADR(). Sorry.

See also thread184-1819568.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It will help to see if you got the idea, if you post your code after including my solution for building up a comma separated values string.

One more hint is: You do this scan loop to build up this list and finally the URL that you want to "execute". The execution is the last step and after the loop, you only execute the URL with a list of phone numbers once, instead of what Sng1 suggested to do for every single phone number. It would also work, but would cost more API calls and the number of them may be limited by your API account. Which is why sending the same SMS to a batch of numbers is better. As long as the SMS text is the same for all of them, and should not be individualized.

That's what you have to think through in detail. If you're already not knowing how to create 1,2,3 from having three records 1 and 2 and 3, then it's hard to believe you'll make it even with that piece of the whole puzzle.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top