Skip to content

Get Notification Data

When sending notifications with ReturnMode as RESUME, the response will be a RequestID that you can use to get the notification data.

This service will return information about the number of notifications sent, processed and processing.

POST variables

  • HASH: Hash of the company where the template is registered
  • ANNAEXEC: The generated IV, which will be used to encrypt the values of other variables
  • SentId: The generated ID when sending notifications in ReturnMode = RESUME

Response

  • The response is an encrypted string with the following structure:
    • EncryptedData + IV + NewEncryptedIV
  • The decrypted structure will be the following:
    {
    "RequestId": 1,
    "RequestDate": "2023-06-05T16:00:00",
    "RequestStatus": "PROCESSED",
    "TotalNumberReceived": 4,
    "TotalNumberValid": 4,
    "TotalNumberSuccess": 4,
    "TotalNumberError": 0,
    "TotalNumberWaiting": 0,
    "TotalNumberCanceled": 0,
    "RequestResult": [
    {
    "RequestSeq": 1,
    "RequestPhoneNumber":"111111111",
    "RequestStatus":"sent",
    "RequestMessage":"OK",
    "RequestSentDatetime": "2024-08-05T16:00:00",
    "RequestDeliveryDatetime": "2024-08-05T16:00:00",
    "RequestReadDatetime": "2024-08-05T16:00:00",
    "RequestHasButton": true,
    "RequestUserAnswered": true,
    "RequestUserAnswer": "Sim",
    "SentKeys": [
    {
    "Description": "NOME",
    "Value": "Giuliano"
    }
    ],
    "SentParms": [
    {
    "Cod": "CPF",
    "Value": "11111111111"
    },
    {
    "Cod": "RG",
    "Value": "11111111-1"
    },
    ]
    },
    {
    "RequestSeq": 1,
    "RequestPhoneNumber": "222222222",
    "RequestStatus": "sent",
    "RequestMessage": "OK",
    "RequestSentDatetime": "2024-08-05T16:00:00",
    "RequestDeliveryDatetime": "2024-08-05T16:00:00",
    "RequestReadDatetime": "2024-08-05T16:00:00",
    "RequestHasButton": true,
    "RequestUserAnswered": true,
    "RequestUserAnswer": "Sim",
    "SentKeys": [
    {
    "Description": "NOME",
    "Value": "Giuliano"
    }
    ],
    "SentParms": [
    {
    "Cod": "CPF",
    "Value": "11111111111"
    },
    {
    "Cod": "RG",
    "Value": "11111111-1"
    },
    ]
    },
    {
    "RequestSeq": 2,
    "RequestPhoneNumber": "333333333",
    "RequestStatus": "sent",
    "RequestMessage": "OK",
    "RequestSentDatetime": "2024-08-05T16:00:00",
    "RequestDeliveryDatetime": "2024-08-05T16:00:00",
    "RequestReadDatetime": "2024-08-05T16:00:00",
    "RequestHasButton": true,
    "RequestUserAnswered": true,
    "RequestUserAnswer": "Sim",
    "SentKeys": [
    {
    "Description": "NOME",
    "Value": "Giuliano"
    }
    ],
    "SentParms": [
    {
    "Cod": "CPF",
    "Value": "11111111111"
    },
    {
    "Cod": "RG",
    "Value": "11111111-1"
    },
    ]
    },
    {
    "RequestSeq": 2,
    "RequestPhoneNumber": "444444444",
    "RequestStatus":"sent",
    "RequestMessage":"OK",
    "RequestSentDatetime": "2024-08-05T16:00:00",
    "RequestDeliveryDatetime": "2024-08-05T16:00:00",
    "RequestReadDatetime": "2024-08-05T16:00:00",
    "RequestHasButton": true,
    "RequestUserAnswered": true,
    "RequestUserAnswer": "Sim",
    "SentKeys": [
    {
    "Description": "NOME",
    "Value": "Giuliano"
    }
    ],
    "SentParms": [
    {
    "Cod": "CPF",
    "Value": "11111111111"
    },
    {
    "Cod": "RG",
    "Value": "11111111-1"
    },
    ]
    }
    ]
    }
  • Possible values for base RequestStatus:
    • CANCELED
    • QUEUED
    • PROCESSED
    • PROCESSING
  • Possible values for RequestResult Status:
    • canceled
    • waiting
    • sent
    • delivered
    • failed

Examples

public static string Execute_WebService()
{
string DecKey = "DECRYPTION_KEY";
string EncKey = "ENCRYPTION_KEY";
string Hash = "COMPANY_HASH";
// Generate new IV
TripleDESCryptoServiceProvider auxTdes = new TripleDESCryptoServiceProvider();
auxTdes.GenerateIV();
byte[] IVArray = auxTdes.IV;
string IV = Convert.ToBase64String(IVArray);
string sentId = "NOTIFICATION_ID";
string sentIdEncriptado = Encrypt3DES(sentId, EncKey, IV);
string dadosPost = "HASH=" + Uri.EscapeDataString(Hash);
dadosPost += "&ANNAEXEC=" + Uri.EscapeDataString(IV);
dadosPost += "&sentId=" + Uri.EscapeDataString(sentIdEncriptado);
byte[] dados = Encoding.UTF8.GetBytes(dadosPost);
string url = "https://YOUR_ANNA_URL/aannagetnotificationdata.aspx";
WebRequest requisicaoWeb = WebRequest.Create(url);
requisicaoWeb.Method = "POST";
requisicaoWeb.ContentType = "application/x-www-form-urlencoded";
requisicaoWeb.ContentLength = dados.Length;
Stream dataStream = requisicaoWeb.GetRequestStream();
dataStream.Write(dados, 0, dados.Length);
dataStream.Close();
WebResponse response = requisicaoWeb.GetResponse();
using (dataStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
if (responseFromServer.Contains(IV))
{
string novoIVEncriptado = responseFromServer.Substring(responseFromServer.IndexOf(IV));
novoIVEncriptado = novoIVEncriptado.Replace(IV, "");
string retornoEncriptado = responseFromServer.Substring(0, responseFromServer.IndexOf(IV));
string novoIV = Decrypt3DES(novoIVEncriptado, EncKey, IV);
string retorno = Decrypt3DES(retornoEncriptado, DecKey, novoIV);
response.Close();
return retorno;
}
else
{
response.Close();
return responseFromServer;
}
}
}