{"id":41485505,"url":"https://github.com/sasaxie/qcloundsms-go","last_synced_at":"2026-01-23T17:50:59.691Z","repository":{"id":57503606,"uuid":"192308568","full_name":"sasaxie/qcloundsms-go","owner":"sasaxie","description":"腾讯云短信SDK","archived":false,"fork":false,"pushed_at":"2022-02-22T11:36:50.000Z","size":343,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T22:45:04.082Z","etag":null,"topics":["go","golang","sms","sms-sdk","tencent","tencent-cloud"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sasaxie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-17T08:42:34.000Z","updated_at":"2021-04-08T11:15:54.000Z","dependencies_parsed_at":"2022-08-28T02:00:31.512Z","dependency_job_id":null,"html_url":"https://github.com/sasaxie/qcloundsms-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sasaxie/qcloundsms-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasaxie%2Fqcloundsms-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasaxie%2Fqcloundsms-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasaxie%2Fqcloundsms-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasaxie%2Fqcloundsms-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sasaxie","download_url":"https://codeload.github.com/sasaxie/qcloundsms-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasaxie%2Fqcloundsms-go/sbom","scorecard":{"id":801034,"data":{"date":"2025-08-11","repo":{"name":"github.com/sasaxie/qcloundsms-go","commit":"028c0ff6d2565af335e917ac567a081cadeafb7e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/3 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T10:29:20.467Z","repository_id":57503606,"created_at":"2025-08-23T10:29:20.467Z","updated_at":"2025-08-23T10:29:20.467Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","sms","sms-sdk","tencent","tencent-cloud"],"created_at":"2026-01-23T17:50:58.932Z","updated_at":"2026-01-23T17:50:59.681Z","avatar_url":"https://github.com/sasaxie.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"腾讯云短信 Golang SDK\n===\n\n## 腾讯短信服务\n\n目前`腾讯云短信`为客户提供`国内短信`、`国内语音`和`海外短信`三大服务，腾讯云短信SDK支持以下操作：\n\n### 国内短信\n\n国内短信支持操作：\n\n- 单发短信\n- 指定模板单发短信\n- 群发短信\n- 指定模板群发短信\n- 拉取短信回执和短信回复状态\n\n\u003e `Note` 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387)开通权限，量大客户可以使用此功能批量拉取，其他客户不建议使用。\n\n### 海外短信\n\n海外短信支持操作：\n\n- 单发短信\n- 指定模板单发短信\n- 群发短信\n- 指定模板群发短信\n- 拉取短信回执和短信回复状态\n\n\u003e `Note` 海外短信和国内短信使用同一接口，只需替换相应的国家码与手机号码，每次请求群发接口手机号码需全部为国内或者海外手机号码。\n\n### 语音通知\n\n语音通知支持操作：\n\n- 发送语音验证码\n- 发送语音通知\n- 上传语音文件\n- 按语音文件fid发送语音通知\n- 指定模板发送语音通知类\n\n## 开发\n\n### 准备\n\n在开始开发云短信应用之前，需要准备如下信息:\n\n- [x] 获取SDK AppID和AppKey\n\n云短信应用SDK `AppID`和`AppKey`可在[短信控制台](https://console.cloud.tencent.com/sms)的应用信息里获取，如您尚未添加应用，请到[短信控制台](https://console.cloud.tencent.com/sms)中添加应用。\n\n- [x] 申请签名\n\n一个完整的短信由短信`签名`和短信正文内容两部分组成，短信`签名`须申请和审核，`签名`可在[短信控制台](https://console.cloud.tencent.com/sms)的相应服务模块`内容配置`中进行申请。\n\n- [x] 申请模板\n\n同样短信或语音正文内容`模板`须申请和审核，`模板`可在[短信控制台](https://console.cloud.tencent.com/sms)的相应服务模块`内容配置`中进行申请。\n\n### 安装\n\n```shell\ngo get github.com/sasaxie/qcloundsms-go\n```\n\n### 文档\n\n若您对接口存在疑问，可以查阅:\n\n* [API开发指南](https://cloud.tencent.com/document/product/382/13297)\n* [SDK文档](https://qcloudsms.github.io/qcloudsms_java/)\n* [错误码](https://cloud.tencent.com/document/product/382/3771)\n\n### 示例\n\n- **准备必要参数**\n\n```golang\n// 短信应用SDK AppID\nvar appid int = 1400009099 // 1400开头\n\n// 短信应用SDK AppKey\nappkey := \"9ff91d87c2cd7cd0ea762f141975d1df37481d48700d70ac37470aefc60f9bad\"\n\n// 需要发送短信的手机号码\nphoneNumbers := make([]string, 0)\nphoneNumbers = append(phoneNumbers, \"21212313123\")\nphoneNumbers = append(phoneNumbers, \"12345678902\")\nphoneNumbers = append(phoneNumbers, \"12345678903\")\n\n// 短信模板ID，需要在短信应用中申请\ntemplateId := 7839 // NOTE: 这里的模板ID`7839`只是一个示例，真实的模板ID需要在短信控制台中申请\n\n// 签名\nsmsSign := \"腾讯云\"; // NOTE: 这里的签名\"腾讯云\"只是一个示例，真实的签名需要在短信控制台中申请，另外签名参数使用的是`签名内容`，而不是`签名ID`\n```\n\n- **单发短信，已通过测试**\n\n```golang\nfunc TestSingleSender_Send(t *testing.T) {\n\tsingleSender := NewSingleSender(appID, appKey)\n\tresult, err := singleSender.Send(0, \"86\", phoneNumbers[0], \"【腾讯云】您的验证码是: 5678\", \"\", \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 如需发送海外短信，同样可以使用此接口，只需将国家码 `86` 改写成对应国家码号。\n\u003e `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过，才可能下发成功，否则返回失败。\n\n\n- **指定模板ID单发短信，已通过测试**\n\n```golang\nfunc TestSingleSender_SendWithParam(t *testing.T) {\n\t// 短信模版内容\n\tparams := make([]string, 0)\n\tparams = append(params, \"5789\")\n\n\t// 短信模版ID，需要在短信应用中申请\n\t// NOTE: 这里的模版`7839`只是一个示例，\n\t// 真实的模版ID需要在短信控制台中申请\n\ttemplateId := 7839\n\n\t// 签名\n\t// NOTE: 这里的签名\"腾讯云\"只是一个示例，\n\t// 真实的签名需要在短信控制台中申请，另外\n\t// 签名参数使用的示`签名内容`，而不是`签名ID`\n\tsmsSign := \"腾讯云\"\n\n\tsingleSender := NewSingleSender(appID, appKey)\n\n\tresult, err := singleSender.SendWithParam(\"86\", phoneNumbers[0], templateId, params, smsSign, \"\", \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过，才可能下发成功，否则返回失败。\n\n- **群发，已通过测试**\n\n```golang\nfunc TestMultiSender_Send(t *testing.T) {\n\tmultiSender := NewMultiSender(appID, appKey)\n\n\tresult, err := multiSender.Send(0, \"86\", phoneNumbers, \"【腾讯云】您的验证码是: 5678\", \"\", \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过，才可能下发成功，否则返回失败。\n\n- **指定模板ID群发，已通过测试**\n\n```golang\nfunc TestMultiSender_SendWithParam(t *testing.T) {\n\t// 短信模版内容\n\tparams := make([]string, 0)\n\tparams = append(params, \"5789\")\n\n\t// 短信模版ID，需要在短信应用中申请\n\t// NOTE: 这里的模版`7839`只是一个示例，\n\t// 真实的模版ID需要在短信控制台中申请\n\ttemplateId := 7839\n\n\t// 签名\n\t// NOTE: 这里的签名\"腾讯云\"只是一个示例，\n\t// 真实的签名需要在短信控制台中申请，另外\n\t// 签名参数使用的示`签名内容`，而不是`签名ID`\n\tsmsSign := \"腾讯云\"\n\n\tmultiSender := NewMultiSender(appID, appKey)\n\n\tresult, err := multiSender.SendWithParam(\"86\", phoneNumbers, templateId, params, smsSign, \"\", \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 群发一次请求最多支持200个号码，如有对号码数量有特殊需求请联系腾讯云短信技术支持(QQ:3012203387)。\n\u003e `Note` 无论单发/群发短信还是指定模板ID单发/群发短信都需要从控制台中申请模板并且模板已经审核通过，才可能下发成功，否则返回失败。\n\n- **发送语音验证码，已通过测试**\n\n```golang\nfunc TestVoiceVerifySender_Send(t *testing.T) {\n\tsender := NewVoiceVerifyCodeSender(appID, appKey)\n\tresult, err := sender.Send(\"86\", phoneNumbers[0], \"5678\", 2, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 语音验证码发送只需提供验证码数字，例如当msg=“5678”时，您收到的语音通知为“您的语音验证码是5678”，如需自定义内容，可以使用语音通知。\n\n- **发送语音通知，已通过测试**\n\n```golang\nfunc TestVoicePromptSender_Send(t *testing.T) {\n\tsender := NewVoicePromptSender(appID, appKey)\n\tresult, err := sender.Send(\"86\", \"12345678902\", 2, 2, \"5678\", \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n- **拉取短信回执以及回复，已通过测试**\n\n```golang\nfunc TestStatusPuller(t *testing.T) {\n\t// Note: 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387)开通权限\n\tmaxNum := 10 // 单次拉取最大量\n\t\n\tpuller := NewStatusPuller(appID, appKey)\n\tresult, err := puller.PullCallback(maxNum)\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n\t\n    result, err = puller.PullReply(maxNum)\n    if err != nil {\n        t.Error(err)\n    } else {\n        t.Log(result)\n    }\n}\n```\n\n\u003e `Note` 短信拉取功能需要联系腾讯云短信技术支持(QQ:3012203387)开通权限，量大客户可以使用此功能批量拉取，其他客户不建议使用。\n\n- **拉取单个手机短信状态，已通过测试**\n\n```golang\nfunc TestMobileStatusPuller(t *testing.T) {\n\tbeginTime := time.Now().Unix() - 3600   // 开始时间(unix timestamp)\n\tendTime := time.Now().Unix()            // 结束时间(unix timestamp)\n\tmaxNum := 10                            // 单次拉取最大量\n\tpuller := NewMobileStatusPuller(appID, appKey)\n\tresult, err := puller.PullCallback(\"86\", \"12345678902\", beginTime, endTime, maxNum)\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n\t\n\tresult, err = puller.PullReply(\"86\", \"12345678902\", beginTime, endTime, maxNum)\n    if err != nil {\n        t.Error(err)\n    } else {\n        t.Log(result)\n    }\n}\n```\n\n- **发送国际短信**\n\n海外短信与国内短信发送类似, 发送海外短信只需替换相应国家码。\n\n\n- **上传语音文件，未通过测试，POST Body数据有问题，Golang生成的参数已通过Postman测试**\n\n```golang\nfunc TestVoiceFileUploader_Upload(t *testing.T) {\n\t// Note: 语音文件大小上传限制400K字节\n\tfilename := \"../resource/example.mp3\"\n\tfileContent, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tuploader := NewVoiceFileUploader(appID, appKey)\n\tresult, err := uploader.Upload(fileContent, MP3)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` '语音文件上传'功能需要联系腾讯云短信技术支持(QQ:3012203387)才能开通\n\n- **查询语音文件审核状态，已通过测试**\n\n```golang\nfunc TestStatusVoiceFile_Get(t *testing.T) {\n\t// Note: 这里fid来自`上传语音文件`接口返回的响应，要按语音\n\t// 文件fid发送语音通知，需要先上传语音文件获取fid\n\tfid := \"2d86ecd5cee47fbe8fb06b358e334facef44bf77.mp3\"\n\n\tfile := NewStatusVoiceFile(appID, appKey)\n\t\n\t// result里会带有语音文件审核状态status, {0: 待审核, 1: 通过, 2: 拒绝, 3: 语音文件不存在}\n\tresult, err := file.Get(fid)\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` '查询语音文件审核状态'功能需要联系腾讯云短信技术支持(QQ:3012203387)才能开通\n\n\n- **按语音文件fid发送语音通知，已通过测试**\n\n```golang\nfunc TestFileVoiceSender_Send(t *testing.T) {\n\t// Note: 这里fid来自`上传语音文件`接口返回的响应，要按语音\n\t// 文件fid发送语音通知，需要先上传语音文件获取fid\n\tfid := \"2d86ecd5cee47fbe8fb06b358e334facef44bf77.mp3\"\n\n\tsender := NewFileVoiceSender(appID, appKey)\n\n\tresult, err := sender.Send(\"86\", phoneNumbers[0], fid, 2, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 按'语音文件fid发送语音通知'功能需要联系腾讯云短信技术支持(QQ:3012203387)才能开通\n\n\n- **指定模板发送语音通知，已通过测试**\n\n```golang\nfunc TestTtsVoiceSender_Send(t *testing.T) {\n\t// 短信模版内容\n\tparams := make([]string, 0)\n\tparams = append(params, \"5789\")\n\n\t// 需要发送短信的手机号码\n\tphoneNumber := \"12345678902\"\n\n\t// 短信模版ID，需要在短信应用中申请\n\t// NOTE: 这里的模版`7839`只是一个示例，\n\t// 真实的模版ID需要在短信控制台中申请\n\ttemplateId := 7839\n\n\t// 播放次数\n\t// NOTE: 可选，最多3次，默认2次\n\tplayTimes := 1\n\n\tttsVoiceSender := NewTtsVoiceSender(appID, appKey)\n\n\tresult, err := ttsVoiceSender.Send(\"86\", phoneNumber, templateId, params, playTimes, \"\")\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(result)\n\t}\n}\n```\n\n\u003e `Note` 注意上面的这个示例代码均已通过实际测试，可以直接编译和运行，但是AppID、AppKey、手机号等参数需要作相应修改。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasaxie%2Fqcloundsms-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasaxie%2Fqcloundsms-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasaxie%2Fqcloundsms-go/lists"}