001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.verify2; 017 018 019/** 020 * Defines properties for sending a verification code to a user over WhatsApp 021 * using an interaction prompt, where the user selects "Yes" or "No" to verify. See the 022 * <a href=https://developer.vonage.com/en/verify/verify-v2/guides/using-whatsapp-interactive> 023 * WhatsApp Interactive guide</a> for an overview of how this works. 024 * <p> 025 * You must have a WhatsApp Business Account configured to use the {@code from} field, which 026 * is now a requirement for WhatsApp workflows. 027 */ 028public final class WhatsappCodelessWorkflow extends AbstractWhatsappWorkflow { 029 030 WhatsappCodelessWorkflow(Builder builder) { 031 super(builder); 032 } 033 034 /** 035 * Constructs a new WhatsApp interactive verification workflow. 036 * 037 * @param to The number to send the verification prompt to, in E.164 format. 038 * @deprecated This no longer works and will be removed in a future release. 039 */ 040 @Deprecated 041 public WhatsappCodelessWorkflow(String to) { 042 this(to, null); 043 } 044 045 /** 046 * Constructs a new WhatsApp interactive verification workflow. 047 * 048 * @param to The number to send the verification prompt to, in E.164 format. 049 * @param from The WhatsApp Business Account number to send the message from, in E.164 format. 050 * @since 8.3.0 051 */ 052 public WhatsappCodelessWorkflow(String to, String from) { 053 this(builder(to, from)); 054 } 055 056 static Builder builder(String to, String from) { 057 return new Builder(to, from); 058 } 059 060 static class Builder extends AbstractWhatsappWorkflow.Builder<WhatsappCodelessWorkflow, Builder> { 061 062 private Builder(String to, String from) { 063 super(Channel.WHATSAPP_INTERACTIVE, to, from); 064 } 065 066 @Override 067 public WhatsappCodelessWorkflow build() { 068 return new WhatsappCodelessWorkflow(this); 069 } 070 } 071}