|
@@ -52,8 +52,8 @@ func GetCamsAppId() (string, error) {
|
|
|
return *isvResponse.Body.AppId, nil
|
|
|
}
|
|
|
|
|
|
-// GetConversationalAutomation 获取号码欢迎消息、开场白和命令
|
|
|
-func GetConversationalAutomation(custSpaceId, phone string) (*cams20200606.GetConversationalAutomationResponse, error) {
|
|
|
+// GetAutomation 获取号码欢迎消息、开场白和命令
|
|
|
+func GetAutomation(custSpaceId, phone string) (*cams20200606.GetConversationalAutomationResponse, error) {
|
|
|
client, _err := CreateCamsClient()
|
|
|
if _err != nil {
|
|
|
return nil, _err
|
|
@@ -72,6 +72,31 @@ func GetConversationalAutomation(custSpaceId, phone string) (*cams20200606.GetCo
|
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
+// SetAutomation 设置号码欢迎消息、开场白和命令
|
|
|
+func SetAutomation(custSpaceId, phone string, prompts []string) (*cams20200606.UpdateConversationalAutomationResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ tmpPrompts := make([]*string, 0)
|
|
|
+ for _, v := range prompts {
|
|
|
+ tmpPrompts = append(tmpPrompts, &v)
|
|
|
+ }
|
|
|
+ request := &cams20200606.UpdateConversationalAutomationRequest{
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ Prompts: tmpPrompts,
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.UpdateConversationalAutomation(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
// AddCamsPhoneNumber 添加WhatsApp号码
|
|
|
func AddCamsPhoneNumber(phone, cc, custSpaceId, verifiedName string) (*cams20200606.AddChatappPhoneNumberResponse, error) {
|
|
|
client, _err := CreateCamsClient()
|
|
@@ -93,3 +118,132 @@ func AddCamsPhoneNumber(phone, cc, custSpaceId, verifiedName string) (*cams20200
|
|
|
|
|
|
return response, nil
|
|
|
}
|
|
|
+
|
|
|
+// SendCamsCode 发送验证码
|
|
|
+func SendCamsCode(phone, custSpaceId, method, locale string) (*cams20200606.GetChatappVerifyCodeResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.GetChatappVerifyCodeRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ Method: tea.String(method),
|
|
|
+ Locale: tea.String(locale),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.GetChatappVerifyCode(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// SubmitCamsCode 提交验证信息
|
|
|
+func SubmitCamsCode(phone, code, custSpaceId string) (*cams20200606.ChatappVerifyAndRegisterResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.ChatappVerifyAndRegisterRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ VerifyCode: tea.String(code),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.ChatappVerifyAndRegister(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetCamsQrcode 获取二维码列表
|
|
|
+func GetCamsQrcode(phone, custSpaceId string) (*cams20200606.ListPhoneMessageQrdlResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.ListPhoneMessageQrdlRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.ListPhoneMessageQrdl(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// CreateCamsQrcode 创建二维码
|
|
|
+func CreateCamsQrcode(phone, custSpaceId, generateQrImage, prefilledMessage string) (*cams20200606.CreatePhoneMessageQrdlResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.CreatePhoneMessageQrdlRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ GenerateQrImage: tea.String(generateQrImage),
|
|
|
+ PrefilledMessage: tea.String(prefilledMessage),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.CreatePhoneMessageQrdl(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateCamsQrcode 修改二维码
|
|
|
+func UpdateCamsQrcode(phone, custSpaceId, generateQrImage, prefilledMessag, qrdlCode string) (*cams20200606.UpdatePhoneMessageQrdlResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.UpdatePhoneMessageQrdlRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ GenerateQrImage: tea.String(generateQrImage),
|
|
|
+ PrefilledMessage: tea.String(prefilledMessag),
|
|
|
+ QrdlCode: tea.String(qrdlCode),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.UpdatePhoneMessageQrdl(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// RemoveCamsQrcode 删除二维码
|
|
|
+func RemoveCamsQrcode(phone, custSpaceId, qrdlCode string) (*cams20200606.DeletePhoneMessageQrdlResponse, error) {
|
|
|
+ client, _err := CreateCamsClient()
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ request := &cams20200606.DeletePhoneMessageQrdlRequest{
|
|
|
+ PhoneNumber: tea.String(phone),
|
|
|
+ CustSpaceId: tea.String(custSpaceId),
|
|
|
+ QrdlCode: tea.String(qrdlCode),
|
|
|
+ }
|
|
|
+
|
|
|
+ response, _err := client.DeletePhoneMessageQrdl(request)
|
|
|
+ if _err != nil {
|
|
|
+ return nil, _err
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|