-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Batch Sending #32
Comments
+1 |
How about handling this in your code sending logic ? def send_sms(device_id, api_key, phone_numbers, message)
uri = URI.parse("https://api.textbee.dev/api/v1/gateway/devices/#{device_id}/send-sms")
header = {
'x-api-key': api_key,
'Content-Type': 'application/json'
}
phone_numbers.each do |number|
body = {
recipients: [number],
message: message
}.to_json
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = body
response = http.request(request)
puts "Sent SMS to #{number}: #{response.code} - #{response.message}"
# Add varying delay between 3 to 10 seconds
delay = rand(3..10)
puts "Waiting for #{delay} seconds before sending the next SMS..."
sleep(delay)
end
end
api_key = 'YOUR_API_KEY'
device_id = 'YOUR_DEVICE_ID'
phone_numbers = ['+XXXXXXX', '+XXXXXXX']
message = 'textbee is super cool'
send_sms(device_id, api_key, phone_numbers, message)
|
@flutter-painter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some mobile providers restrict the number of SMS messages that can be sent at a time. Could we add a batch amount and and interval timer as an option?
Default remains how the app currently operates, and a Custom option for SMS Batch Quantity and Interval (in seconds).
VBR,
The text was updated successfully, but these errors were encountered: