Send multiple using Nexmo

How to send multiple numbers using nexmo with python

import nexmo


client = nexmo.Client(key='exxxxx', secret='Qxxxxxx')
client.send_message({
    'from': 'Nexmo',
    'to': '639354758282',
    'text': 'Hello from Nexmo',
})

Upvotes: 0

Views: 228

Answers (1)

Vivek Bhat
Vivek Bhat

Reputation: 38

Does this loop help to send SMS for multiple numbers? Or, you are looking for something else?

#!/usr/local/bin/python

import nexmo

client = nexmo.Client(key='*******', secret='*********')
phones = ['Number 1', 'Number 2', 'Number 2']

for phone in phones:
 msg = 'Hello ' + phone + ' from Nexmo'
 response = client.send_message({
    'from': 'Nexmo',
    'to': phone,
    'text': msg,
 })
 print(response)

Upvotes: 2

Related Questions