add recepient
 recepient (Hash or String) options for recipient
 allowed options are:
   phone: phone number
   client_id: sms id in your system
   time_send: Time of sms sending
   validity_period: Date of
 if String is given than it means only phone
769788
def add_recipient(recepient = {})
      if recepient.is_a?(String)
        # convert string value to correct hash
        recepient = {phone: recepient}
      end
      recepient[:phone] = format_phone(recepient[:phone])
      @recepients.push(recepient)
      # time-send format: YYYY-MM-DD HH:MM
      # validity_period format: YYYY-MM-DD HH:MM
    end
112162
def send_request(subject_name, client_id, request, options, &callback)
      request_id = generate_request_id
      request["reply_to"] = "#{@inbox_name}.#{client_id}.#{request_id}"
      @lock.synchronize do
        @requests[request_id] = [callback, options]
      end

      sanitized_log_message = sanitize_log_message(request)
      request_body = JSON.generate(request)

      @logger.debug("SENT: #{subject_name} #{sanitized_log_message}") unless options['logging'] == false

      EM.schedule do
        subscribe_inbox
        if @handled_response
          nats.publish(subject_name, request_body)
        else
          nats.flush do
            nats.publish(subject_name, request_body)
          end
        end
      end
      request_id
    end
733426
private function prepareRecipients(Sms $sms): string
    {
        $recipients = $sms->getRecipients();

        if (! $sms->hasRecipientVariables()) {
            $recipients = array_map([$this, 'normalizePhoneNumber'], $recipients);

            return json_encode($recipients);
        }

        $recipientVariables = $sms->getRecipientVariables();

        return json_encode(array_map(function ($recipient) use ($recipientVariables) {
            $targetVariables = [];
            if (isset($recipientVariables[$recipient])) {
                $targetVariables = $recipientVariables[$recipient];
            }

            return array_merge(['recipient' => $this->normalizePhoneNumber($recipient)], $targetVariables);
        }, $recipients));
    }
529893
def send_sms(profile, body, to, from_):
    '''
    
    '''
    ret = {}
    ret['message'] = {}
    ret['message']['sid'] = None
    client = _get_twilio(profile)
    try:
        if TWILIO_5:
            message = client.sms.messages.create(body=body, to=to, from_=from_)
        else:
            message = client.messages.create(body=body, to=to, from_=from_)
    except TwilioRestException as exc:
        ret['_error'] = {}
        ret['_error']['code'] = exc.code
        ret['_error']['msg'] = exc.msg
        ret['_error']['status'] = exc.status
        log.debug('Could not send sms. Error: %s', ret)
        return ret
    ret['message'] = {}
    ret['message']['sid'] = message.sid
    ret['message']['price'] = message.price
    ret['message']['price_unit'] = message.price_unit
    ret['message']['status'] = message.status
    ret['message']['num_segments'] = message.num_segments
    ret['message']['body'] = message.body
    ret['message']['date_sent'] = six.text_type(message.date_sent)
    ret['message']['date_created'] = six.text_type(message.date_created)
    log.info(ret)
    return ret
40162
def parseArgsPy26():
    
    from gsmtermlib.posoptparse import PosOptionParser, Option
    parser = PosOptionParser(description='Simple script for sending SMS messages')
    parser.add_option('-i', '--port', metavar='PORT', help='port to which the GSM modem is connected; a number or a device name.')
    parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate')
    parser.add_option('-p', '--pin', metavar='PIN', default=None, help='SIM card PIN')
    parser.add_option('-d', '--deliver',  action='store_true', help='wait for SMS delivery report')
    parser.add_positional_argument(Option('--destination', metavar='DESTINATION', help='destination mobile number'))    
    options, args = parser.parse_args()
    if len(args) != 1:    
        parser.error('Incorrect number of arguments - please specify a DESTINATION to send to, e.g. {0} 012789456'.format(sys.argv[0]))
    else:
        options.destination = args[0]
        return options
1137682
def send_messages(self, sms_messages):
        
        if not sms_messages:
            return
        
        num_sent = 0
        for message in sms_messages:
            if self._send(message):
                num_sent += 1
        return num_sent
909798
function(messageContent) {
                /**
                 * + User                     {object}
                 *    - id                    {long}
                 *    - name                  {string}
                 *    - email                 {string}
                 *    - cellphoneNumber       {string}
                 *    - image                 {string}
                 *    - lastSeen              {long}
                 *    - sendEnable            {boolean}
                 *    - receiveEnable         {boolean}
                 */

                var user = {
                    id: messageContent.id,
                    name: messageContent.name,
                    email: messageContent.email,
                    cellphoneNumber: messageContent.cellphoneNumber,
                    image: messageContent.image,
                    lastSeen: messageContent.lastSeen,
                    sendEnable: messageContent.sendEnable,
                    receiveEnable: messageContent.receiveEnable
                };

                return user;
            }
882242
def token_reply_info(client, scope, user = nil, state = nil, refresh = false)
    interval = client[:access_token_validity] || 3600
    token_body = { jti: SecureRandom.uuid, aud: scope, scope: scope,
        client_id: client[:client_id], exp: interval + Time.now.to_i }
    if user
      token_body[:user_id] = user[:id]
      token_body[:email] = primary_email(user[:emails])
      token_body[:user_name] = user[:username]
    end
    info = { access_token: TokenCoder.encode(token_body, :algorithm => 'none'),
        token_type: 'bearer', expires_in: interval, scope: scope}
    info[:state] = state if state
    info[:refresh_token] = 'universal_refresh_token' if refresh
    inject_error(info)
    info
  end
274470
public void sendMessage(final SMSBroker sms) {
		
		final int smsId = sms.getId();
		final String smsRecipient = sms.getRecipient();
		final String smsMessage = sms.getMessage();
		
		logger.info("Send message to smsenvoi with parameter : ");
		logger.info("   - message id : " + smsId);
		logger.info("   - message recipient : " + smsRecipient);
		logger.info("   - message : " + smsMessage);
		
		try {
			
			// only send the message if required
			if (!simulateMessageSending) {
				save_message_id(sms, realSendMessage(sms));

				logger.info("message with : " + 
						  " - id : " + smsId + "successfully sent");
			} else {
				logger.warn("Message with id : " + smsId + " not sent because simlation mode is enable");
			}

			
		} catch (Throwable t) {
			logger.error("An error occurs sending SMS : " + 
				     " - id : " + smsId + 
				     " - recipient : " + smsRecipient + 
				     " - message : " + smsMessage, t);
		}		
	}
384766
def format_sms_payload(self, message, to, sender='elkme', options=[]):
        
        self.validate_number(to)

        if not isinstance(message, str):
            message = " ".join(message)

        message = message.rstrip()

        sms = {
            'from': sender,
            'to': to,
            'message': message
        }

        for option in options:
          if option not in ['dontlog', 'dryrun', 'flashsms']:
            raise ElksException('Option %s not supported' % option)
          sms[option] = 'yes'

        return sms
970868
public function send(Sms $sms): array
    {
        if (! $sms->hasRecipients()) {
            throw new NoRecipientsSpecifiedException();
        }

        $messages = [];

        $recipients = $sms->getRecipients();
        foreach (array_chunk($recipients, Recipients::MAX) as $chunk) {
            $message = clone $sms;
            $message
                ->setRecipients($chunk)
                ->clearRecipientVariables()
            ;

            foreach ($chunk as $recipient) {
                if (! isset($sms->getRecipientVariables()[$recipient])) {
                    continue;
                }

                foreach ($sms->getRecipientVariables()[$recipient] as $variable => $value) {
                    $message->addRecipientVariable($recipient, $variable, $value);
                }
            }

            $messages[] = $message;
        }

        $responses = [];
        foreach ($messages as $message) {
            $request = $this->prepareRequest($message);

            $responses[] = $this->executeRequest($request);
        }

        return $responses;
    }
624690
function Aliyun_Push(opts) {
  opts = opts || {};

  this.AccessKeyId = opts.AccessKeyId;
  this.AccessKeySecret = opts.AccessKeySecret;
  this.AccountName = opts.AccountName;
  this.dmHost = 'https://dm.aliyuncs.com/';
  this.smsHost = 'https://sms.aliyuncs.com/';

  this.publicParams = {
    Format: 'JSON',
    AccessKeyId: opts.AccessKeyId,
    SignatureMethod: 'HMAC-SHA1',
    Timestamp: '',
    SignatureVersion: '1.0',
    SignatureNonce: '',
  };
  this.singleOptions = {
    Action: 'SingleSendMail',
    AccountName: opts.AccountName,
    ReplyToAddress: true,
    AddressType: 1
  }
  this.batchOptions = {
    Action: 'BatchSendMail',
    AccountName: opts.AccountName,
    ReplyToAddress: true,
    AddressType: 1
  }
  this.smsOptions = {
    Action: 'SingleSendSms'
  }
}
579814
def send_text_message(self, user_id, content, kf_account=None):
        
        data = {
            "touser": user_id,
            "msgtype": "text",
            "text": {
                "content": content
            }
        }
        if kf_account is not None:
            data['customservice'] = {'kf_account': kf_account}
        return self.post(
            url="https://api.weixin.qq.com/cgi-bin/message/custom/send",
            data=data
        )
1245991
def __build_sms_data(self, message):
        """"""

        attributes = {}

        attributes_to_translate = {
            'to' : 'To',
            'message' : 'Content',
            'client_id' : 'ClientID',
            'concat' : 'Concat',
            'from_name': 'From',
            'invalid_char_option' : 'InvalidCharOption',
            'truncate' : 'Truncate',
            'wrapper_id' : 'WrapperId'
        }

        for attr in attributes_to_translate:
            val_to_use = None
            if hasattr(message, attr):
                val_to_use = getattr(message, attr)
            if val_to_use is None and hasattr(self, attr):
                val_to_use = getattr(self, attr)
            if val_to_use is not None:
                attributes[attributes_to_translate[attr]] = str(val_to_use)

        return attributes
635748
def send(message, options = {})
      message_format = options[:message_format] ? options[:message_format] : 'text'
      notify         = options[:notify]         ? options[:notify]         : false

      response = self.class.post(@api.send_config[:url],
                                 :query => { :auth_token => @token },
                                 :body => {
                                     :message => message,
                                     :message_format => message_format,
                                     :notify => notify
                                 }.send(@api.send_config[:body_format]),
                                 :headers => @api.headers
      )
      ErrorHandler.response_code_to_exception_for :user, user_id, response
      true
    end
1272661
public Hash requestSms(int userId, Map<String, String> options) throws AuthyException {
        MapToResponse opt = new MapToResponse(options);
        final Response response = this.get(SMS_PATH + Integer.toString(userId), opt);
        return instanceFromJson(response.getStatus(), response.getBody());
    }
131778
function sendTextMessage(recipientId, messageText) {
    var messageData = {
        recipient: {
            id: recipientId
        },
        message: {
            text: messageText
        }
    };
    callSendAPI(messageData);
}