def sendmsg(self, **options): """ send an SMS message. Accepts all the variables as documented by Clickatell in the HTTP api. Since `to` and `from` are keywords for python they should be specified as 'sender' and 'recipients'. The recipients should be a list of MSISDNs. """ options.update(self.sendmsg_defaults.copy()) options = validator.validate(options) options.update({ 'to': validator.dispatch('to', options.pop('recipients')), 'text': validator.dispatch('text', options.pop('text')), 'session_id': self.session_id }) return self.client.http('sendmsg', options)
def sendmsg(self, context={}, **options): """ Sending messages existing batches. Note: The fields 1-N that you defined in the template are used to optionally personalise the message. """ batch_id = options.get('batch_id', self.batch_id) if not batch_id: raise ClickatellError, "No batch_id set" options = validator.validate(options) options.update(context) options.update({ 'session_id': self.clickatell.session_id, 'batch_id': batch_id, }) [resp] = self.clickatell.client.batch('senditem', options) return resp
def quicksend(self, **options): """ Where one has the requirement to send the same message to multiple recipients, you can use the quicksend command. This command offers low overhead and maximum throughput. It is essentially a reference to a predefined template and a string of destination addresses. Note: quicksend does not allow for templating """ if 'context' in options: raise ClickatellError, 'context not allowed for quicksend()' batch_id = options.get('batch_id', self.batch_id) if not batch_id: raise ClickatellError, 'No batch_id set' options = validator.validate(options) options.update({ 'session_id': self.clickatell.session_id, 'batch_id': batch_id, 'to': validator.dispatch('to', options.pop('recipients')) }) return self.clickatell.client.batch('quicksend', options)
def batch(self, **options): """ Return a Batch messaging instance """ options.update(self.sendmsg_defaults.copy()) return Batch(self, validator.validate(options))