layotto
layotto copied to clipboard
Develop a new component for sms API; 为"短信 API" 开发新的组件
What would you like to be added:
Develop a new component for sms API.
Choose an open source component or cloud service you like to implement this API.
For example, you can choose any one in the list below:
- [ ] Cloud service provided by Alibaba cloud
- [ ] Cloud service provided by AWS
- [ ] Cloud service provided by Azure
- [ ] Cloud service provided by Google cloud
- [ ] Cloud service provided by tencent cloud
- [ ] Cloud service provided by qiniu cloud
- [ ] anything else
Reference:
API quickstart doc: https://mosn.io/layotto/#/zh/start/sms/start
API definition(the .proto
file): https://github.com/mosn/layotto/blob/main/spec/proto/extension/v1/sms/sms.proto
API reference: https://mosn.io/layotto/api/v1/sms.html
API design discussion : https://github.com/mosn/layotto/issues/716
chinese: 选择一个你喜欢的开源组件或云服务实现sms API, 参考资料见上。
Why is this needed:
We need more components to make this API useful
I have some questions: https://docs.qq.com/doc/DTXVSTVRXT0lzWHBW
@azhsmesos Hi, I don't have permission to open your doc
@azhsmesos Hi, I don't have permission to open your doc
sorry,【腾讯文档】layotto https://docs.qq.com/doc/DTXVSTVRXT0lzWHBW
@azhsmesos Hi, I don't have permission to open your doc
sorry,【腾讯文档】layotto docs.qq.com/doc/DTXVSTVRXT0lzWHBW
@azhsmesos Hi, I answered your questions in your doc
@azhsmesos Hi, I don't have permission to open your doc
sorry,【腾讯文档】layotto docs.qq.com/doc/DTXVSTVRXT0lzWHBW
@azhsmesos Hi, I answered your questions in your doc
ok
@azhsmesos Hi, I don't have permission to open your doc
sorry,【腾讯文档】layotto docs.qq.com/doc/DTXVSTVRXT0lzWHBW
@azhsmesos Hi, I answered your questions in your doc
Please look at my development ideas again in docs,I'm not sure I'm on the right track,so you can comment directly in the document
Alibaba cloud SMS docs looks too chaos, its sdk repository has two different smsapi version. One is 20170525/v3, another is 20180501/v2, but the latest docs only has 20170525/v2. If really need to develop new component for alibaba cloud sms, it is hard to choose right version.
please assign this task to me, develop a new component for tencent cloud sms, and I working on it now.
I found a problem in Tencent cloud sms api, when we set template parameters to a sms request, it need slice of string, not key-value pair that defined in sms.proto
file. I checked Alibaba cloud sms docs, it indeed use key-value pair, but Tencent cloud sms not.
I have a idea, we can add a string to metadata in SendSmsWithTemplateRequest
to represent the order of keys, like
var keysOrder = "code,msg,other"
var templateParams = map[string]string{
"msg": "okgogogo",
"code": "7890",
"other": "a...",
}
// result = {"7890", "okgogogo", "a..."}
use commas to separate every key. Not all cloud sms have to use this solution, but Tencent cloud sms can.
Can this solution accept?
@alilestera For Tencent Cloud, you can use map<string, string> template_params
to simulate a string array, for example:
{
"0":"xxx",
"1":"yyy",
}
There is no need to use the metadata field.
@alilestera For Tencent Cloud, you can use
map<string, string> template_params
to simulate a string array, for example:{ "0":"xxx", "1":"yyy", }
There is no need to use the metadata field.
You are right. I will follow your idea.
@seeflood I found another problem. Alibaba cloud sms SendSms
API's response is an object like:
{
"Code": "OK",
"Message": "OK",
"BizId": "9006197469364984****",
"RequestId": "F655A8D5-B967-440B-8683-DAD6FF8DE990"
}
Send short message to different phone numbers at once, the response still have only one "Code"
, one "Message"
and one "RequestId"
. So the sms API can adapt to it.
But Tencent cloud sms is different. if send short message to different phone numbers at once, the response have one "RequestId"
and a set of "SendStatus"
. Every "SendStatus"
has own "Code"
, "Message"
and other information.
So how to solve this to let the sms API adapt Tencent cloud sms API?
@alilestera 可以参考下之前的设计:https://github.com/mosn/layotto/issues/716 看是否能兼容
Sorry, I've been a bit busy this past time and I've been planning to finish it up recently.