How I connected the official WhatsApp business API via Twilio

As you know, WhatsApp has recently begun to provide access to its official business API, which is so necessary for creating chat bots for this messenger using "white" methods.



But most companies still cannot do this directly, but only through large partners of Facebook, who in this case act as intermediaries.



One of these available partners is the American company Twilio. Their main advantage, in my opinion, is the low cost of using the WhatsApp Business API.



I connected the official WhatsApp business API through Twilio and now I'll tell you in detail how to do this.



Whatsapp messenger



The main condition for Facebook is the presence of a registered legal entity, for example LLC or individual entrepreneur, access to an individual cannot be obtained.



So, let's start moving in steps.



1. Creating an account in Facebook Business Manager



Log in to your personal Facebook account and create a Business Manager account, for which we follow the link business.facebook.com/overview and press the CREATE ACCOUNT button, a window for entering company data will open.



Creating a Business Manager Facebook account



According to the prompts above the fields, enter the company name, first and last name, e-mail and click the "Send" button.



In the next window, enter information about the company and press the "Send" button.



Adding company information when creating an account in Facebook Business Manager



After sending, a message will appear that the account has been created and you need to confirm your email address.



         Facebook Business Manager



Let's go to the mail and click on the "Confirm" button from the letter.



        Facebook Business Manager



2. Registering an account with Twilio



Let's register a Twilio account at twilio.com/try-twilio . It is not at all difficult to do this, registration is free and does not require bank card details, you just need to enter your first name, last name, e-mail and come up with a password.



   Twilio



We confirm the e-mail.



 e-mail     Twilio.



We confirm the phone number.



      Twilio



3. Request to Twilio to activate the ability to add WhatsApp senders



Let's prepare and send a request to Twilio to activate the ability to add WhatsApp senders, for which we go to the "WhatsApp Senders" section at the link www.twilio.com/console/sms/whatsapp/senders and click the "Sign Up to Receive Updates" button.



       WhatsApp   Twilio



A request form will open to activate the ability to add WhatsApp senders to Twilio. We fill in the form fields with the data indicated above when creating an account in Facebook Business Manager:



First Name - Name (in Latin);



Last Name - Surname (Latin);



Phone Number - Company phone number (specified in Facebook Business Manager);



Email Address - Company email address (specified in Facebook Business Manager);



Company Name- Company name (in Latin, indicated in Facebook Business Manager);



Company Website - Company website (listed in Facebook Business Manager);



Company HQ Country - Country of incorporation of the company (specified in Facebook Business Manager);



Twilio Account SID - Copy the Twilio Account ID from the ACCOUNT SID field at www.twilio.com/console;



Twilio Account SID



Facebook Business Manager ID - Copy the identifier of the created Facebook Business Manager account from the " Business Manager ID :" field on the business.facebook.com/settings/info page (Facebook Business Manager -> Company Settings -> Company Information);



Facebook Business Manager ID



I've completed Facebook Business Verification- put "No" if Facebook Business Manager -> Company Settings -> Company Information -> Company Confirmation Status -> "Not Confirmed" or "Yes" if "Confirmed" is indicated;



Company Vertical - choose the direction of the company from the list;



What is your use case? - choose from the list what WhatsApp will be used for: Notifications, Customer Support, 2FA or User Verification (Two-factor authentication or user verification);



Which regions are you sending messages to? - In which regions the messages will be sent (select from the Global list) ;



How many messages are you sending per month during the first year?- How many messages will be sent per month during the first year (select the desired range from the list);



I wish to provision this account with a third party vendor - whether this account will be provided to a third-party vendor (select "No") ;



Assign approval to alternate Account SID (Optional) - Assign approval to an alternate SID of the account (optional) (do not enter anything, leave the field blank) ;



I understand Twilio can modify my SMS / Voice URL and that approval is only for the brand submitted. - I understand that Twilio may change my SMS / Voicemail URL and this approval is for the sent brand only (agree and select "Yes")...



        WhatsApp   Twilio



To send a request, click the "Request Now" button. After successful submission, a corresponding notification will appear: “Thank you for your interest. We will keep you updated as access becomes available. "



         WhatsApp   Twilio



We receive the following letter in the mail: We



  Twilio        WhatsApp   Twilio



translate the message into Russian:



     Twilio        WhatsApp   Twilio.



Now we are waiting 3-4 weeks for a response from Twilio, as indicated in the letter.



After 4 weeks, we receive a response from Twilio that now you can add a WhatsApp sender and continue the registration process: We



  Twilio       WhatsApp   Twilio



translate the message into Russian:



     Twilio       WhatsApp   Twilio



4. Upgrade your Twilio account



To continue, you must definitely transfer the Twilio project from Trial to Upgrade, for which you will need to replenish your balance. The trial Twilio account will not be able to register the sender's WhatsApp. The minimum top-up amount is $ 20 (twenty dollars). Then this money can be spent on renting phone numbers for WhatsApp senders and paying for incoming and outgoing messages in WhatsApp. Renting a phone number starts at $ 1 (one dollar) per month. Incoming and outgoing messages in WhatsApp - 0.005 $ (half a cent) for 1 message.



To upgrade your account, follow the link www.twilio.com/console/billing/upgrade .



Fill in the fields in the "Add Company Address" section with Latin letters.



  Twilio:



Press the "Validate Address" button to confirm the address. In the window that opens, click the "Use This Address" button.



  Twilio:



Similarly, fill in the fields in the "Add Billing Address" section with the same data.



  Twilio:



And we will also confirm the address.



  Twilio:



In the "Add Payment Information and Funds" section, enter the bank card details and press the "Upgrade Account" button to complete the payment.



  Twilio:



After successful payment, we will see a corresponding notification.



     Twilio



5. Buying a phone number in Twilio to create a WhatsApp sender



Unfortunately, there are no Russian numbers in Twilio, but in practice it turned out to be not that important. Often, users don't even look at the number when they write on WhatsApp.



To buy a Twilio phone number, follow the link www.twilio.com/console/phone-numbers/search , select a country in the “COUNTRY” field, if you wish, you can set other additional search parameters, and press the “Search” button.



    Twilio



    Twilio



Select the desired phone number and press the "Buy" button.



In the next window, we will confirm the purchase.



    Twilio



6. Registering WhatsApp Sender with Twilio



To register a WhatsApp sender with Twilio, go to the "WhatsApp Senders" section at www.twilio.com/console/sms/whatsapp/senders and click the "plus" icon.



  WhatsApp  Twilio



For now, we will create a WhatsApp sender only for replies to user messages, that is, we will not write first ourselves. The creation of templates for the ability to write to the user first will be considered in the following publications.



Fill in the form that



opens : Select a Number (Required) - Select the phone number that we bought in Twilio above.



Business Display Name (Required) - The display name that must be related to your company as required by Facebook... You can simply specify the company name that we entered when registering an account with Facebook Business Manager.



Company Address (Optional) - Company address (optional ).



Company Email (Optional) - Company email address (optional ).



Website (Optional) - Company website (optional ).



Link to Logo (Optional) - Link to the company logo (you can omit it). The minimum image size is 640x640 px in PNG or JPG formats (JPG is recommended), the background should not be transparent.



Check if profile is for a client. I've read the third party guidelines - Do not check this box.



  WhatsApp   Twilio



To send, click the "Submit Request" button, which will become active after filling in the required form fields.



An entry with the status "Waiting for Approval from WhatsApp" will appear in the list of senders, which means that now you need to wait for confirmation from WhatsApp.



 WhatsApp  Waiting for Approval from WhatsApp  Twilio



And we receive an email from Twilio that they are considering our request and will contact us shortly.



  Twilio     WhatsApp



Looking forward to hearing from Twilio.



7. Company confirmation in Facebook Business Manager



About an hour and a half later, we receive another email from Twilio that Facebook Business Manager needs to accept a request from Twilio in order to grant them permission to create a WhatsApp Business account. To do this, follow the link business.facebook.com/settings/requests/received_requests (Facebook Business Manager -> Company Settings -> Requests -> Received) and click the "Approve" button.



   Twilio  Facebook Business Manager



After accepting the request from Twilio, you need to verify the company in Facebook Business Manager. To do this, follow the link business.facebook.com/settings/security (Facebook Business Manager -> Company Settings -> Security Center) and in the Company Confirmation section click the Start Confirmation button, which will become active after accepting the request from Twilio.



    Facebook Business Manager



The official information from Facebook about the confirmation of the company can be found at the link: www.facebook.com/business/help/2058515294227817?id=180505742745347 .



At the first step of confirmation, we will enter the data of our company:



Legal name of the company - the name of the company, as indicated in the documents for registration of the company.



Country - the country where the company is registered.



Address (street, house no.) - street and house number of the legal address of the company, as indicated in the documents for the registration of the company.



Address 2 / Settlement - enter, if available.



City - the city of the legal address of the company, as indicated in the documents for the registration of the company.



State / Province / Region- the region of the legal address of the company, as indicated in the documents for the registration of the company.



Postal Code - The postal code of the registered office of the company as indicated in the company registration documents.



Company phone number - the phone number that belongs to this legal entity (there must be supporting documents: agreement, invoices for payment for the phone, etc.).



Site - the address of the company's website (the website domain must match the domain of the company's email address).



   Facebook Business Manager.  1 -   .



The second step of confirming the company is to confirm the legal name of the company.



To do this, you need to download documents from the list:



  • Business license (if any);
  • Registration certificates or articles of association (OGRN or articles of association);
  • Taxpayer Registration Certificate (TIN).


I have uploaded scans of OGRN and TIN of the company.



   Facebook Business Manager.  2 -    .



In the third step of confirming the company, you must confirm the legal address and phone number of the company.



To do this, you need to download documents from the list:



  • Utility bill, such as electricity or telephone;
  • Certificate from the bank, which contains the address;
  • Business license with company address or telephone number (if applicable).


I have uploaded scans of: a contract for the lease of office space at a legal address, an information letter about registration in the Statistical Register of Rosstat, an invoice for payment for a telephone number from a telecom operator.



   Facebook Business Manager.  3 -       .



In the fourth step, you need to get and enter a confirmation code.



To do this, select a phone number in the "Choose how to contact you" section and click the "Call me" button. Leave the field "My work email address" blank. The robot will call and dictate the numbers to be entered in the confirmation code entry field.



Enter the numbers of the confirmation code and press the "Send" button.



We are waiting for confirmation from Facebook, as they write to us in the letter from Twilio, this may take 4-7 business days.



We received company confirmation from Facebook within 1 business day.



  Facebook  ,    .



  Facebook Business Manager,    .



      Facebook Business Manager,   .



A green checkmark in the Company Information in Facebook Business Manager that the company is verified.



We are waiting for the completion of registration of WhatsApp sender from Twilio.



8. Finish registering WhatsApp sender with Twilio



After 4 hours, we receive an email from Twilio that they have checked our business profile on WhatsApp and submitted our display name for review. The display name verification timeline is typically 24 to 48 hours.



An email from Twilio that they have verified our WhatsApp business profile.



We translate the message into Russian:



Translation into Russian letters from Twilio that they checked our business profile in WhatsApp.



We are waiting for a response from Twilio 24-48 hours, as indicated in the letter.



After about 30 hours, we receive an email from Twilio that our WhatsApp sender profile with the selected phone number has been successfully registered.



An email from Twilio that the WhatsApp sender profile with the selected phone number has been successfully registered.



We translate the message into Russian:



Translation into Russian of a letter from Twilio that the WhatsApp sender profile with the selected phone number has been successfully registered.



Log into your Twilio account, go to the WhatsApp Senders section at www.twilio.com/console/sms/whatsapp/senders and see that the record has changed its status to “Approved”.



WhatsApp sender is approved by Twilio and ready to go.



Outcome



This completes the connection of the official WhatsApp business API through Twilio. In time, with all expectations, it took me about one month. Now it can be used to integrate with various services for communicating with users and for creating chat bots.



All Articles