简体   繁体   中英

How to make link of String in Sms verification in Node.js

I want to verify account through sms code,sms code sent by best sms library in node.js. i want to make code copyable or selectable but can't do this just getting code in simple string.please help me.Thanks in advance

"use strict";

var request = require('request');
const Promise = require('bluebird')
const config = require('config')

const sendMessageToNumber = (toNumber, code) => {
return new Promise(function (resolve, reject) {
    request({
        method: 'GET',
        uri: config.bestsms.endpoint,
        qs: {
            user: encodeURI(process.env.BESTSMS_USERNAME),
            pass: encodeURI(process.env.BESTSMS_PASSWORD),
            from: encodeURI(config.bestsms.from),
            to: encodeURI(toNumber),
            text: encodeURI(config.bestsms.message + code.bold())
        }
    },
    function (error, response, body) {
        console.log("Status of sending SMS: "+ body)
        if (body) {
            resolve(body);
        }
        reject(error)
    });
});
}
 module.exports = {
sendMessageToNumber
}

As far as I know - you can't, not with SMS.

SMS are simple text only.

Android and iOS can decide how to format parts of the message like URLs and numbers. So you can test several options with different devices to find your perfect formatting.

You can maybe try with MMS, like this answer

It's not them, it's your messages app. Try to send the same message to yourself and the result will be the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM