Pular para o conteúdo

Buscar informações do envio

Quando o envio de notificações é feito com ReturnMode em RESUME, a resposta será um RequestID que poderá ser utilizado para buscar os dados das notificações

Esse serviço irá retornar informações sobre o número de notificações enviadas, processadas e que ainda estão processando

JSON Body

{
"hash": "COMPANY_HASH",
"sentId": 00
}
  • hash: Hash da empresa onde o template está registrado
  • sentId: O ID que foi retornado ao enviar as notificações com ReturnMode = RESUME

Resposta

  • A resposta é uma string encriptada da seguinte forma:
    • DadosEncriptados + IV + NovoIvEncriptado
  • A estrutura desencriptada será a seguinte:
    {
    "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"
    }
    ]
    }
    ]
    }
  • Valores para o RequestStatus base:
    • CANCELED
    • QUEUED
    • PROCESSED
    • PROCESSING
  • Valores para o status de RequestResult:
    • canceled
    • waiting
    • sent
    • delivered
    • failed

Exemplos

var httpClient = new HttpClient
{
BaseAddress = new Uri("YOUR_ANNA_URL")
};
var result = await httpClient.PostAsJsonAsync("REST/Credentials/GetToken", new
{
hash = "COMPANY_HASH",
user = "USER",
pass = "PASSWORD"
});
var tokenResponse = await result.Content.ReadFromJsonAsync<GetTokenResponse>();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenResponse?.Data.Token);
var getDataResult = await httpClient.PostAsJsonAsync("REST/Notifications/GetData", new
{
hash = "COMPANY_HASH",
sentId = 00
});
var getDataContent = await getDataResult.Content.ReadAsStringAsync();
return getDataContent;
public class GetTokenResponse
{
[JsonPropertyName("success")]
public bool Success { get; set; }
[JsonPropertyName("message")]
public string Message { get; set; } = string.Empty;
[JsonPropertyName("data")]
public TokenData Data { get; set; } = new();
}
public class TokenData
{
[JsonPropertyName("Token")]
public string Token { get; set; } = string.Empty;
[JsonPropertyName("ExpiresIn")]
public string ExpiresIn { get; set; } = string.Empty;
}