1. Inicio
  2. Documentos
  3. NS BPe (English)
  4. BPe Issue Contingency API...
  5. WebHook

WebHook

What is webhook?

Webhook is a way to receive information, which is sent when an event happens. In this way, the webhook in practice is the way to receive information between two systems in a passive way.
Likewise, it provides data to other applications, which are very efficient for both the service provider and the consumer.

How does the NS contingency webhook work?

Every document that enters the “Offline Contingency” flow will be duly reprocessed within the established limits and will always generate a notification to the partner, so that he knows the result of that issue.
To conveniently deliver this notice, a Webhook feature has been developed which will be further described below.

How to configure

The partner who has the contracted “Offline Contingency” feature must provide the following data in the partner’s dashboard:

  • URL Notification;
  • Username and password for Auth Basic;

Notification URL
In this field, the partner will inform on which endpoint they want to receive the notification.

The URL must necessarily be available over a secure connection (https).

Example: https://dominio-do-parceiro.com.br/meu-app/notify

The notification will always be sent via the POST method and will have the body in the following pattern:

Authorized document:

{
  "status": 200,
  "motivo": "Consulta realizada com sucesso",
  "chBPe": "43221007364617000135630050000030302223853846",
  "cStat": "100",
  "xMotivo": "Autorizado o uso do BP-e",
  "nProt": "143220000303255",
  "dhRecbto": "2022-10-04T11:33:50-03:00"
}

Rejected document:

{
  "status": 200,
  "motivo": "Consulta realizada com sucesso",
  "chBPe": "43221007364617000135630050000030312988464429",
  "cStat": "417",
  "xMotivo": "Rejeição: Data de entrada em contingência posterior a data de emissão"
}

Username and Password for Auth Basic
The partner must provide a unique username and password to authenticate to this notification endpoint.

Example:
– user: nstechnology
– password: password!2#

According Authentication Basic specification, these credentials will be sent in the request header as per the standard.

Basic authentication
In basic authentication the credentials look like this:

  • The username and password combined with a colon (nstechnology:password!2#).
  • The resulting string is a base64 (en-US) encoding (bnN0ZWNub2xvZ2lhOnNlbmhhITIj).

Examples
Authorization: Basic bnN0ZWNub2xvZ2lhOnNlbmhhITIj

Como podemos ajudar?