Web Sockets
When writing integration tests, you want those tests to run as fast as possible. To help with this, we provide a Web Socket end point which you can connect to so that you can be notified as soon as your test emails are captured by Imitate Email.
To connect to our websocket open a request to https://imitate.email/notify-ws
In order to start listening for emails the first thing you must do is authenticate with the credentials for the mailbox that you want to be notified about.
To do that, once connected, send a string containing a Basic authentication string. For your personal mailbox, find your credentials at Settings → My Mailbox.
For example, if your username is 123
and password is 456
you must concatenate them with a :
, so 123:456
, base 64 encode that string and then send the following on the web socket:
Basic <base64encodedstring>
Once that authenticates (the connection will be closed if you do not - check the close reason for help), keep listening for messages.
When an email is delivered to your mailbox we'll send a JSON encoded string containing the email details to you.
When coupled with IMAP this will open up possibilities for end to end testing of email based workflows.