How to send mass sms from tinydb?

Hi, I am creating an app for women protection app. This is purely for college project. I’m having an issue on sending SMS to contacts from tinydb. Can anyone aid me on this issue? I have linked the screenshot to this post.

As far as I know, to send SMS to contacts stored in TinyDB, you’ll need to use the ‘SendTextMessage’ block from the ‘Texting’ component in Kodular. I’d suggest to make sure you retrieve the list of contacts from TinyDB, then loop through each contact and use the ‘SendTextMessage’ block to send the SMS.

If permissions or API limitations are an issue, consider using an external service API that allows sending SMS in bulk.

Hope this helps somehow

could you give me an example on how to go through? Im still new to this

Alright, no problem. First, ensure that you’ve correctly retrieved the list of contacts from TinyDB. Then, in Kodular, use a loop structure like ‘for each item in list’ to iterate over each contact.

Use a ‘for each item in list’ block, where the list is your contacts from TinyDB. Then, inside the loop, use the ‘SendTextMessage’ block from the ‘Texting’ component. Set the phone number to the current item in the loop (each contact’s number) and specify your message.

ALSO, if you hit any roadblocks, like permissions or the number of SMS you can send, an external SMS service API might be a good alternative. These services usually allow bulk SMS and handle permissions for you. Twilio is a popular choice, but there are many others out there.

That’s it. This is the way I’d do it

Wow, tnx for the help! Most appreciated. let me try it out and see if it works.

The app crashes when i try to implement this. is there a mistake?

here is my answer to a similar question

Taifun


The app still crashes and i followed on how the loop goes and someone aid me on this? Please i need this for my College project. I have also linked the project file here.
Test_Features2.aia (280.9 KB)

The only thing I can think about is that there might be an issue in the blocks you’ve assembled. Would you mind double-checking the part where you’re retrieving the contact numbers from TinyDB? Make sure that each number is correctly formatted and that the list isn’t empty.

Also, inspect your loop and the ‘SendTextMessage’ block for any mismatches in variable names or types.
Sometimes, the app might crash if it’s trying to send an SMS to an invalid number or if the loop encounters a non-number entry. If everything seems in order, could you check the logs to see what error is causing the crash?

it looks like you have overseen my previous answer…

this solution will overwhelm the texting component and your device…
but it will be a good learning experience to try it…
and after this, you then might want to use a clock component to avoid sending the sms all at exactly the same time, see also The ‘Do something’ example

Taifun

Noted on that. Let me go through on what I have done and will get back to you

Hi, im really lost on this,i have provided here my current update, i tried multiple things but the app still crashes. Can someone give an idea on why the app crashes. i know it’s the mass sms sending feature is the main cause but i need some idea on how to go through. Please, i started this like last week and trying to learn

DEMO23.aia (285.2 KB)

Are you using a clock as suggested?

If you are asking for help, I recommend you to make it as easy for others to be able to help you …
You probably will get more feedback then…

which means in your case post a screenshot of your relevant blocks…

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc… this takes time, and most people will not do that…
Thank you.

Taifun

I understand im sorry for bugging you all. let me take a screenshot and send here below. Please keep in mind that in database there is only one contact. It is not even send one message. I’m setting 3 max contacts to send sms. So i think the clock function wont be necessary. If it does can you show how to build the blocks overall?
image

Unfortunately you forgot to use the clock component
Rsad my previous answers

Taifun

could you show me the blocks on how to do the loop for clock component? I saw the text in other discussions but not clear for me

Here is the Do something example again

Remove the for each in list loop and start the clock instead
Inside the timer event check, if there are still items in your list
If yes, select the first phone number from the list, send the message and delete the first item from the list
If not, stop the clock

Taifun


image

The app crashes, i put a contengency if the phone number is not retrieving the base number should be a random but the app crashes instantly with no execution.Is there a mistake im making here?

the app functions fine if i remove the mass sms function so i know that this is the main issue here.

Unfortunately it looks like you do not understand the concept

This is your for each in list loop from your previous screenshot

The suggestion was to

There is no counter required, there is no max varíable required, you only need a list… and my assumption was your global variable contact_phone_number is a list, because you are using it in that loop…

Taifun

1 Like