Saving contact name from WhatsApp Broadcast March 20, 2024 20:57 Updated Index: How to save contact name in block? How to create a script in block? The configuration must be done before the Broadcast is triggered in the chosen block for the user to reach your stream.A Define Contact must be inserted in the block in the output actions. With this action, it will be possible to save the names of the clients in the contact base.By default, the user arriving via the WhatsApp channel has the user's name and phone number. To save the name, we will use the variable contact.name. To save the phone, we have this example documented here Saving the WhatsApp contact phone. How to save contact name in block? 1. Example saving the contact's name in the Outbound Actions of the chosen block using the sending of active messages Plugin Broadcast: 2. Example Saving the contact's name using the data filled in by sending a spreadsheet in the Broadcast plugin,as directed below: When entering the name of the contact in the Broadcast sending spreadsheet, it is possible to use the information and save the name. When we trigger, the name field is saved in the extras of the contact. Sheet name field: In the block of your flow chosen for the user to arrive after sending the Broadcast, we will use the variable {{contact.extras.name}} and define the contact in the block's output actions: After defining the contact, the username is saved in the Blip contacts. 3) Example to save updated contact name from WhatsApp Broadcast If this user returns again via Broadcast, the name of the phone contact can be different and when sending an active Broadcast message, the user keeps the previous name already saved. In the example below, we have a procedure to update this contact name. How to create a script in block? In the block where the user arrives in the flow, the following settings will need to be made: In the output actions of the block, it will be necessary to create a script that will receive the contact.identity as an input variable and in the output variable create a variable called telAdjusted. As shown in the image below.: The script will be as follows: function run(identifier) {var phoneUser = identifier.split("@")[0];return phoneUser;} After this step, we're going to create an HTTP request, using the following parameters: Method: Post URL : https://msging.net/commands Headers Authorization with value equal to Bot's Key (If it has a router, must use its key) Content-Type with value equal to application/json The body of the request should look like: {"id": "{{$guid}}","to": "postmaster@wa.gw.msging.net","method": "get","uri": "lime://wa.gw.msging.net/accounts/{{telAdjusted}}"} Note: If the script output is done in a variable other than telAdjusted, also change the body of the request. Save the request body in a variable called return, as shown in the image below: Once this is done, just create an action to define contact, where the value {{return@resource.fullName}} will be passed in the name field, as shown in the image: ATTENTION: Customer telephone numbers in international format must follow the following pattern: "+ DDI PHONE DDD". Therefore, it is mandatory to add the "+" (plus) sign before the DDI. For more information, visit the discussion on the subject in our community or the videos on our channel. 😃 Related articles How to Save Contact Information How to save a contact's WhatsApp number Audience file configuration - Bulk notification sending Sending WhatsApp Active Messages on Blip Desk Active Messages - Error Codes