public static String phoneVerification(String phone,String OTP){ HttpRequest request = new HttpRequest(); HttpResponse response = new HttpResponse(); Http http = new Http(); Blob beforeblob = Blob.valueOf('B76-954-84B073909FBE:bsLZCUHJWWqYEniMHEVvph8A+dKxa+K7zLooag=='); string paramvalue = EncodingUtil.base64Encode(beforeblob); request.setEndpoint('https://rest-api.telesign.com/v1/messaging'); request.setHeader('Authorization','Basic '+paramvalue); request.setHeader('Content-Type','application/x-www-form-urlencoded'); request.setMethod('POST'); String msg = 'message=test msg'; request.setBody(msg+'&message_type=OTP&phone_number='+phone); if(!Test.isRunningTest()){ response = http.send(request); } map<string,string> responseData = (Map<String, String>)JSON.deserialize(response.getBody(), Map<String, String>.class); system.debug(responseData.get('Status')); return response.getBody(); }
Comments
Post a Comment