messages.get

Gets your messages from the API.

Messages are automatically sorted from newest to oldest

  • Params:

    • type- The type of the message (0 = received, 1 = sent, 2 = deleted)

    • amount - How many messages do you want to fetch

    Returns: Message

const { VulcanJwtRegister, Keypair, VulcanHebeCe } = require('hebece');
const apiap = '<html><body><input id='ap' type='hidden' value='{"Success":true,"Tokens":["Some.Jwt.Here", "Another.Jwt.here"],"Alias":"example@example.com","Email":"example@example.com","EmailCandidate":null,"GivenName":"Jacek","Surname":"Różycki","IsConsentAccepted":true,"CanAcceptConsent":true,"AccessToken":"1yearapiaptoken","ErrorMessage":null,"Capabilities":["EMAIL_CONFIRMATION"]}' /></body></html>'

(async () => {
    const keypair = await (new Keypair()).init();
    const jwt = await (new VulcanJwtRegister(keypair, apiap)).init();
    const hebe = new VulcanHebeCe(keypair);
    await hebe.connect();
    const type = 0; // received
    const amount = 5; // 5 messages
    const msg = await hebe.messages.get(type, amount);
    console.log(msg) // Returns Message
    
})()

Last updated