Yalo notifications are predefined structured messages that Yalo customers use to provide information to their users. Notifications are very important because they give customers the ability to deliver information without needing a previously active conversation, and automate its delivery for their clients.

The Notifications API is a technical solution designed as an API REST service, with the objective of allowing developers to send notifications to their customers through WhatsApp.

📘

You can only send messages through HSM or WhatsApp Authorized Templates.

API requirements

Before you can use the Yalo's Notifications API and start sending messages, the Client must be approved to use the Facebook Enterprise API.

The process is the following:

  1. Send the ID of the Business Manager.
    a. Enter business.facebook.com
    b. Go to Business Setting
    c. Go to the Business Info Section.

  2. In the notification bell, confirm Yalo’s request.

  3. Verify the Business Manager by following this page: Verify Your Business

  4. The Client is approved to obtain a verified profile that allows users to know what they are talking about with the official company profile.

  5. Activation of the phone number with WhatsApp.

  6. You must have API Token provided by Yalo.

Notifications and WhatsApp messages

A notification is an entity that represents a request to deliver data to a final user. A notification is composed of one or more messages, these messages are Yalo entities that represent a WhatsApp message (a WhatsApp message is a bubble in the WhatsApp application), in which we can correlate our data with WhatsApp's data.

How are notifications handled by our infrastructure?

Notifications can be generated in 3 different ways:

  1. Directly by using the Yalo API

  2. From the WhatsAPP Console UI

  3. Through Yalo's Platform UI

Notification lifecycle

  1. The flow id information of the notification is queried (flow must exist in Yalo).

  2. The flow gets logged into WhatsApp using the information form the previous step. If this process fails, a login error throws a bot-invalid-credentials error.

  3. If a transition to state is required, Flow conversation service is called with the new state for the recipient user.

  4. For each message:

    1. Validate if the message was already sent.
    2. Store this message id as already processed.
    3. WhatsApp API is called using the message as request. If any error is thrown by the WhatsApp API it is stored inside the message.
    4. External message id for the message is retrieved from the API response.
    5. A request is created to update the message with the retrieved external_message_id and the new status.
    6. In case a rate limit in WhatsApp API is reached, the message is queued again in the messages to be send queue.
    7. Mark the message as successfully sent.
  5. Set the status for each message as SENT_TO_WA

  6. When we have confirmation from Meta about the delivery of the message, update the status to DELIVERED

  7. When (if) we have confirmation from Meta about the user read the message, update the status to READ