I'm working with the Consent API. My flow is as follows,
- Make a request to Opt In a customer phone number for SMS
- Use a GET request to confirm the Opt In has been registered.
Below is my code snippet
SmsOptRecord smsOptRecord = new SmsOptRecord(); smsOptRecord.from(RINGOUT_CALLER); smsOptRecord.to(RINGOUT_RECIPIENT); smsOptRecord.optStatus("OptIn"); smsOptRecord.source("Api"); Map<String, Object> body = new HashMap<>(); body.put("records", List.of(smsOptRecord)); var createConsent = rc.patch("/restapi/v2/accounts/~/sms/consents", body); System.out.println(createConsent.string()); Map<String, Object> getConsentsRequestBody = new HashMap<>(); getConsentsRequestBody.put("from", List.of(RINGOUT_CALLER)); getConsentsRequestBody.put("optStatus", List.of("OptIn"));// var getConsents = rc.get("restapi/v2/accounts/~/sms/consents"); var getConsents = rc.get("restapi/v2/accounts/~/sms/consents", getConsentsRequestBody); System.out.println(getConsents.string());
This code produces the following logs.
{"failedRecords":[]}
{"records":[],"paging":{"perPage":0}}
I am expecting the second log to have a record of my OptIn. Whenever I do the opposite and register an OptOut, I get the expected record in the second log message.
Why isn't my Opt In being registered and returned in my GET request?