How to write to Telegram if a client doesn’t have WhatsApp

If a Business Process (BP) could not send a message to a customer in WhatsApp because the number does not have the messenger – the BP can send a message in Telegram. To do this, configure the BP to send it when a 405 error arrives. How to do it:

1. Go to “Settings” → “Automation” → “CRM Settings”.

2. Click “Automation” → “Business Processes” on the left.

3. Select the entity with which the business process will work: lead, contact, deal, company, etc.

In our example, this is “Deal” → “➕ Add Template”.

4. Check the “When added” checkbox under “Autorun” → go to the “Variables” tab and click “Add Variable”.

5. Fill in the two lines in the expanded window: “Name” and “ID”. You can enter any values in Latin. Leave the variable type as String:

Click “OK” and then “Save”.

6. Click on the triangle between “Start” and “End” → “Application Actions” → “[WAZZUP] Automatic sending of template messages”:

7. Press the gear on the created action. The “Activity Parameters” window will open:

8. Customize the activity as instructed and add a message that will go to the user.

When a new deal is created, the Business Process will start. If the recipient does not have WhatsApp on the number, Wazzup will return an error 405 to Bitrix, there will be a note with its description in the Workflow log:

9. Click on the triangle between the Wazzup activity and the “End” → “Other” → “Set variables” button:

10. Click on the gear on the “Set Variables” action:

11. Make sure that the same variable you created is selected in the drop-down menu. Next to this line, click the three dot button:

12. Click the “Additional Results” link in the window that opens → “[WAZZUP] Automatic sending of template messages” → double-click “…Response code”:

13. The code in the line with the variable will appear:

Click “Save”.

14. Click the triangle below the “Set Variables” → “Flow Control” → “Condition” activity:

15. Click on any of the branches on the gear on “Condition”:

16. Select “Condition Type” — “Variable Value”, from the drop-down list “Property or Field” — your variable, “Condition” — “equals”, in the “Value” line type “405”. Save.

17. Tap on the triangle below the condition you have configured → “Application actions” and select your application to send SMS.

18. Press the gear on the created action.

19. Fill in the fields to send an SMS, enter the text of the message and tap “Save”.

20. Save the Business Process by clicking the “Save” button in the lower left corner.

Now when creating a deal, a WhatsApp message will be sent to the client, and if he doesn’t have WhatsApp on his number, an SMS will be sent.