Follow-up to Notifications

After sending a notification, it goes through multiple states from when it is sent until it reaches the
recipient user and the user reads the notification.

With the aim of giving visibility to our clients of the trajectory of the messages, we created a service
that notifies the status of the notification that was sent to each user.

To meet this objective, we created a service that feeds a webhook created by our customers who
use our notification service. With this process, each time the notification sending process advances,
the Webhook will be receiving the corresponding update of the notification sent.

The services to configure the use of the indicated resource are described below.

For all of the endpoints listed below, the following field types will have the following properties:

Endpoints

Properties

channel

A short name corresponding to your implementation. This is provided by Yalo.

@yalo_id

Refers to the Yalo id identifier (ASCII) provided during the channel creation. This ID is provided by Yalo.

@authentication_token

Refers to the authentication token provided during the channel creation. This token is provided by Yalo.

@phone number

Is expected to be in the standard E.164 phone number formatting (similar documentation from Twilio ) of the format +.

@yalo whatsapp id

Is the “WhatsApp” id used by Yalo to communicate with the underlying WhatsApp API. This is the phone number with the leading ‘+’ truncated.

Healthcheck

This endpoint will be used to:

  • verify that the provided credentials are correct
  • set the webhook for incoming messages

URL

POST https://api-staging.yalochat.com/firehose/api/<channel>/bots/<yalo_id>/healthcheck

POST https://api-staging.yalochat.com/firehose/api/<channel>/bots/<yalo_id>/healthcheck

Headers

Authorization: Bearer <authentication_token>
Content-Type: application/json

Payload

{
"phone:" "+1234567890" ,
"webhook" : 'https://webhook.your_domain.com/yalochat/>'
}

🚧

Yalo needs to verify that the phone number provided matches the Yalo id specified in the URL.

The webhook property is optional. If specified, it is stored by Yalo and will be used as the webhook for incoming messages. Any later calls with the same credentials and phone number should be assumed to be an update if the webhook field is different.

Response

Anything other than HTTP 2XX OK indicates a failure in approving the credentials and/or updating the webhook value.

Error Cases

Error

Description

401

The token is invalid, contact Yalo to get a valid token

422

The token is correct, but some of the fields are incorrect: phone, YaloId, or webhook

404

Resource not found

500

Internal server error, contact to Yalo to get support

Deleting a Webhook

This endpoint will be used to unset the webhook from the channel.

URL

POST https://api-staging.yalochat.com/firehose/api/<channel>/bots/<yalo_id>/remove

POST https://api-staging.yalochat.com/firehose/api/<channel>/bots/<yalo_id>/remove

Headers

Authorization: Bearer <authentication_token>
Content-Type: application/json

Response

Anything other than HTTP 200 OK indicates a failure in removing the webhook


Calling /remove validates the account credentials (including phone number). On the Yalo side,
the /remove call should be authenticated in the same manner as /healthcheck. If successful, the
webhook should be unset or deleted.

Error Cases

Error

Description

200

webhook has been deleted

404

the bot doesn't have a webhook setted

422

information about phone or bot id is invalid

401

unauthorized

Tracking Information

When the webhook is correctly configured, the responses received on that channel will be as
follows:

{
        "version":"v1"
        "type":"notification-status"
        "status":"@STATUS [SEND, READ, SENDING, ERROR]"
        "notification:" {
                "id":""
        },
        "message": {
        "id":""
        "external_id":""
        },
        "from":"",
        "bot": {
                "phone": "+"
                "id":"@botid"
        }
}

Did this page help you?