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 a WhatsApp message. 021 * <p> 022 * You must have a WhatsApp Business Account configured to use the {@code from} field, which 023 * is now a requirement for WhatsApp workflows. 024 */ 025public final class WhatsappWorkflow extends AbstractWhatsappWorkflow { 026 027 WhatsappWorkflow(Builder builder) { 028 super(builder); 029 } 030 031 /** 032 * Constructs a new WhatsApp verification workflow. 033 * 034 * @param to The number to send the message to, in E.164 format. 035 * @deprecated This no longer works and will be removed in a future release. 036 */ 037 @Deprecated 038 public WhatsappWorkflow(String to) { 039 this(to, null); 040 } 041 042 /** 043 * Constructs a new WhatsApp verification workflow with a custom sender number. 044 * 045 * @param to The number to send the message to, in E.164 format. 046 * @param from The WhatsApp Business Account number to send the message from, in E.164 format. 047 */ 048 public WhatsappWorkflow(String to, String from) { 049 this(builder(to, from)); 050 } 051 052 static Builder builder(String to, String from) { 053 return new Builder(to, from); 054 } 055 056 static class Builder extends AbstractWhatsappWorkflow.Builder<WhatsappWorkflow, Builder> { 057 058 Builder(String to, String from) { 059 super(Channel.WHATSAPP, to, from); 060 } 061 062 @Override 063 public WhatsappWorkflow build() { 064 return new WhatsappWorkflow(this); 065 } 066 } 067}