C# client library implementing all Flowmailer API methods
API documentation: https://flowmailer.com/apidoc/flowmailer-api
Nuget: https://www.nuget.org/packages/RonSijm.Flowmailer/
Usage in library:
var client = new FlowMailerClient(httpFactory, "ClientId", "ClientSecret", "AccountId");
var result = await client.GetEventFlows();
Usage in ASP Core:
Create a config session in your appsettings.json:
"FlowMailer": {
"ClientId": "ClientId",
"ClientSecret": "ClientSecret",
"AccountId": "1337"
}
Wire it up in your Program.cs:
var flowMailerConfig = builder.Configuration.GetSection("FlowMailer").Get<FlowMailerOptions>();
builder.Services.AddScoped<IFlowMailerClient>(serviceProvider => new FlowMailerClient(serviceProvider.GetService<IHttpClientFactory>(), flowMailerConfig));
Implemented methods:
- Get flow rule list for all event flows
- Url: https://api.flowmailer.net/{account_id}/event_flow_rules
- Endpoint: Task GetEventFlowRules(CancellationToken cancellationToken = default)
- Get flow rule list for all event flows
- Url: https://api.flowmailer.net/{account_id}/event_flow_rules/hierarchy
- Endpoint: Task GetHierarchyFlowEventFlowRules(CancellationToken cancellationToken = default)
- List flows per account
- Url: https://api.flowmailer.net/{account_id}/event_flows
- Endpoint: Task<List> ListEventFlows(CancellationToken cancellationToken = default)
- Create a new flow
- Url: https://api.flowmailer.net/{account_id}/event_flows
- Endpoint: Task CreateEventFlows(EventFlow request, CancellationToken cancellationToken = default)
- Delete flow by id
- Url: https://api.flowmailer.net/{account_id}/event_flows/{eventFlowId}
- Endpoint: Task DeleteEventByEventFlowId(string eventFlowId, CancellationToken cancellationToken = default)
- Get flow by id
- Url: https://api.flowmailer.net/{account_id}/event_flows/{eventFlowId}
- Endpoint: Task GetEventByEventFlowId(string eventFlowId, CancellationToken cancellationToken = default)
- Save flow
- Url: https://api.flowmailer.net/{account_id}/event_flows/{eventFlowId}
- Endpoint: Task SaveEventByEventFlowId(EventFlow request, string eventFlowId, CancellationToken cancellationToken = default)
- Get flow conditions for a flow
- Url: https://api.flowmailer.net/{account_id}/event_flows/{eventFlowId}/rule
- Endpoint: Task GetRuleForAEventByEventFlowId(string eventFlowId, CancellationToken cancellationToken = default)
- Set conditions for a flow
- Url: https://api.flowmailer.net/{account_id}/event_flows/{eventFlowId}/rule
- Endpoint: Task SetRuleForAEventByEventFlowId(EventFlowRuleSimple request, string eventFlowId, CancellationToken cancellationToken = default)
- List filters per account
- Url: https://api.flowmailer.net/{account_id}/filters
- Endpoint: Task<List> ListFilters(ref_range range, date_range daterange = default, string sortorder = default, CancellationToken cancellationToken = default)
- Delete a recipient from the filter
- Url: https://api.flowmailer.net/{account_id}/filters/{filterId}
- Endpoint: Task DeleteFilter(string filterId, CancellationToken cancellationToken = default)
- Get flow rule list for all flows
- Url: https://api.flowmailer.net/{account_id}/flow_rules
- Endpoint: Task GetFlowRules(CancellationToken cancellationToken = default)
- List flow templates per account
- Url: https://api.flowmailer.net/{account_id}/flow_templates
- Endpoint: Task<List> ListFlowTemplates(CancellationToken cancellationToken = default)
- List flows per account
- Url: https://api.flowmailer.net/{account_id}/flows
- Endpoint: Task<List> ListFlows(bool statistics = default, CancellationToken cancellationToken = default)
- Create a new flow
- Url: https://api.flowmailer.net/{account_id}/flows
- Endpoint: Task CreateFlow(Flow request, CancellationToken cancellationToken = default)
- Delete flow by id
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}
- Endpoint: Task DeleteFlow(string flowId, CancellationToken cancellationToken = default)
- Get flow by id
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}
- Endpoint: Task GetFlow(string flowId, CancellationToken cancellationToken = default)
- Save flow
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}
- Endpoint: Task SaveFlow(Flow request, string flowId, CancellationToken cancellationToken = default)
- List messages per flow
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}/messages
- Endpoint: Task<List> ListMessagesPerFlow(date_range daterange, string flowId, items_range range, bool addheaders = default, bool addonlinelink = default, bool addtags = default, CancellationToken cancellationToken = default)
- Get flow conditions for a flow
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}/rule
- Endpoint: Task GetRuleForAFlowConditions(string flowId, CancellationToken cancellationToken = default)
- Set conditions for a flow
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}/rule
- Endpoint: Task SetRuleForAFlow(FlowRuleSimple request, string flowId, CancellationToken cancellationToken = default)
- Get time based message statistics for a message flow
- Url: https://api.flowmailer.net/{account_id}/flows/{flowId}/stats
- Endpoint: Task GetStatisticsForAFlow(date_range daterange, string flowId, int interval = default, CancellationToken cancellationToken = default)
- List message events
- Url: https://api.flowmailer.net/{account_id}/message_events
- Endpoint: Task<List> ListMessageEvents(ref_range range, bool addmessagetags = default, date_range daterange = default, List flowIds = default, date_range receivedrange = default, string sortorder = default, List sourceIds = default, CancellationToken cancellationToken = default)
- List messages which could not be processed
- Url: https://api.flowmailer.net/{account_id}/message_hold
- Endpoint: Task<List> ListMessageHold(items_range range, date_range daterange = default, CancellationToken cancellationToken = default)
- Get a held message by its id
- Url: https://api.flowmailer.net/{account_id}/message_hold/{messageId}
- Endpoint: Task GetMessageHold(string messageId, CancellationToken cancellationToken = default)
- List messages
- Url: https://api.flowmailer.net/{account_id}/messages
- Endpoint: Task<List> ListMessages(ref_range range, bool addevents = default, bool addheaders = default, bool addonlinelink = default, bool addtags = default, date_range daterange = default, List flowIds = default, string sortfield = default, string sortorder = default, CancellationToken cancellationToken = default)
- Simulate an email or sms message
- Url: https://api.flowmailer.net/{account_id}/messages/simulate
- Endpoint: Task SimulateMessage(SimulateMessage request, CancellationToken cancellationToken = default)
- Send an email or sms message
- Url: https://api.flowmailer.net/{account_id}/messages/submit
- Endpoint: Task SubmitMessage(SubmitMessage request, CancellationToken cancellationToken = default)
- Get message by id
- Url: https://api.flowmailer.net/{account_id}/messages/{messageId}
- Endpoint: Task GetMessage(string messageId, bool addtags = default, CancellationToken cancellationToken = default)
- List the message as archived by one or more flow steps
- Url: https://api.flowmailer.net/{account_id}/messages/{messageId}/archive
- Endpoint: Task<List> ListArchivedAsMessage(string messageId, bool addattachments = default, bool adddata = default, CancellationToken cancellationToken = default)
- Fetch an attachment including data for an archived message
- Url: https://api.flowmailer.net/{account_id}/messages/{messageId}/archive/{flowStepId}/attachment/{contentId}
- Endpoint: Task FetchAttachmentForAnArchivedMessageByFlowStepIdAndContentId(string contentId, string flowStepId, string messageId, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/messages/{messageId}/error_archive
- Endpoint: Task GetErrorArchiveByMessages(string messageId, bool addattachments = default, bool adddata = default, CancellationToken cancellationToken = default)
- Resend message by id
- Url: https://api.flowmailer.net/{account_id}/messages/{messageId}/resend
- Endpoint: Task ResendMessage(ResendMessage request, string messageId, CancellationToken cancellationToken = default)
- Get time based message statistics for whole account
- Url: https://api.flowmailer.net/{account_id}/messagestats
- Endpoint: Task GetMessageStats(date_range daterange, List flowIds = default, int interval = default, CancellationToken cancellationToken = default)
- Get information about a recipient
- Url: https://api.flowmailer.net/{account_id}/recipient/{recipient}
- Endpoint: Task GetRecipient(string recipient, date_range daterange = default, CancellationToken cancellationToken = default)
- List messages per recipient
- Url: https://api.flowmailer.net/{account_id}/recipient/{recipient}/messages
- Endpoint: Task<List> ListMessagesPerRecipient(ref_range range, string recipient, bool addheaders = default, bool addonlinelink = default, bool addtags = default, date_range daterange = default, string sortorder = default, CancellationToken cancellationToken = default)
- List messages per sender
- Url: https://api.flowmailer.net/{account_id}/sender/{sender}/messages
- Endpoint: Task<List> ListMessagesPerSender(ref_range range, string sender, bool addheaders = default, bool addonlinelink = default, bool addtags = default, date_range daterange = default, string sortorder = default, CancellationToken cancellationToken = default)
- List sender domains by account
- Url: https://api.flowmailer.net/{account_id}/sender_domains
- Endpoint: Task<List> ListSenderDomains(CancellationToken cancellationToken = default)
- Create sender domain
- Url: https://api.flowmailer.net/{account_id}/sender_domains
- Endpoint: Task CreateSenderDomains(SenderDomain request, CancellationToken cancellationToken = default)
- Get sender domain by domain name
- Url: https://api.flowmailer.net/{account_id}/sender_domains/by_domain/{domain}
- Endpoint: Task GetByBySenderDomains(string domain, bool validate = default, CancellationToken cancellationToken = default)
- Validates but does not save a sender domain.
- Url: https://api.flowmailer.net/{account_id}/sender_domains/validate
- Endpoint: Task ValidatesSenderDomains(SenderDomain request, CancellationToken cancellationToken = default)
- Delete sender domain
- Url: https://api.flowmailer.net/{account_id}/sender_domains/{domainId}
- Endpoint: Task DeleteSenderDomains(string domainId, CancellationToken cancellationToken = default)
- Get sender domain by id
- Url: https://api.flowmailer.net/{account_id}/sender_domains/{domainId}
- Endpoint: Task GetSenderDomains(string domainId, bool validate = default, CancellationToken cancellationToken = default)
- Save sender domain
- Url: https://api.flowmailer.net/{account_id}/sender_domains/{domainId}
- Endpoint: Task SaveSenderDomains(SenderDomain request, string domainId, CancellationToken cancellationToken = default)
- List sender identities by account
- Url: https://api.flowmailer.net/{account_id}/sender_identities
- Endpoint: Task<List> ListSenderIdentities(CancellationToken cancellationToken = default)
- Create sender identity
- Url: https://api.flowmailer.net/{account_id}/sender_identities
- Endpoint: Task CreateSenderIdentities(SenderIdentity request, CancellationToken cancellationToken = default)
- Delete sender identity
- Url: https://api.flowmailer.net/{account_id}/sender_identities/{identityId}
- Endpoint: Task DeleteSenderIdentitiesByIdentityId(string identityId, CancellationToken cancellationToken = default)
- Get sender identity by id
- Url: https://api.flowmailer.net/{account_id}/sender_identities/{identityId}
- Endpoint: Task GetSenderIdentitiesByIdentityId(string identityId, CancellationToken cancellationToken = default)
- Save sender identity
- Url: https://api.flowmailer.net/{account_id}/sender_identities/{identityId}
- Endpoint: Task SaveSenderIdentitiesByIdentityId(SenderIdentity request, string identityId, CancellationToken cancellationToken = default)
- List source systems per account
- Url: https://api.flowmailer.net/{account_id}/sources
- Endpoint: Task<List
- Url: https://api.flowmailer.net/{account_id}/sources
- Endpoint: Task PostSources(Source request, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}
- Endpoint: Task DeleteSources(string sourceId, CancellationToken cancellationToken = default)
- Get a source by id
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}
- Endpoint: Task
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}
- Endpoint: Task UpdateSources(Source request, string sourceId, CancellationToken cancellationToken = default)
- List messages per source
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/messages
- Endpoint: Task<List> ListMessagesPerSource(date_range daterange, items_range range, string sourceId, bool addheaders = default, bool addonlinelink = default, bool addtags = default, CancellationToken cancellationToken = default)
- Get time based message statistics for a message source
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/stats
- Endpoint: Task GetStatisticsForASource(date_range daterange, string sourceId, int interval = default, CancellationToken cancellationToken = default)
- List credentials per source system
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/users
- Endpoint: Task<List> ListUsersPerSourceSystem(string sourceId, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/users
- Endpoint: Task PostUsersBySources(Credentials request, string sourceId, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/users/{userId}
- Endpoint: Task DeleteUsersBySources(string sourceId, string userId, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/users/{userId}
- Endpoint: Task GetUsersBySources(string sourceId, string userId, CancellationToken cancellationToken = default)
- Url: https://api.flowmailer.net/{account_id}/sources/{sourceId}/users/{userId}
- Endpoint: Task UpdateUsersBySources(Credentials request, string sourceId, string userId, CancellationToken cancellationToken = default)
- List messages per tag
- Url: https://api.flowmailer.net/{account_id}/tag/{tag}/messages
- Endpoint: Task<List> ListMessagesPerTag(ref_range range, string tag, bool addheaders = default, bool addonlinelink = default, bool addtags = default, date_range daterange = default, string sortorder = default, CancellationToken cancellationToken = default)
- List templates by account
- Url: https://api.flowmailer.net/{account_id}/templates
- Endpoint: Task<List> ListTemplates(CancellationToken cancellationToken = default)
- Create template
- Url: https://api.flowmailer.net/{account_id}/templates
- Endpoint: Task CreateTemplate(Template request, CancellationToken cancellationToken = default)
- Delete template by id
- Url: https://api.flowmailer.net/{account_id}/templates/{templateId}
- Endpoint: Task DeleteTemplate(string templateId, CancellationToken cancellationToken = default)
- Get template by id
- Url: https://api.flowmailer.net/{account_id}/templates/{templateId}
- Endpoint: Task GetTemplate(string templateId, CancellationToken cancellationToken = default)
- Save template
- Url: https://api.flowmailer.net/{account_id}/templates/{templateId}
- Endpoint: Task SaveTemplate(Template request, string templateId, CancellationToken cancellationToken = default)
- List undeliverable messages
- Url: https://api.flowmailer.net/{account_id}/undeliveredmessages
- Endpoint: Task<List> ListUndeliveredMessages(ref_range range, bool addevents = default, bool addheaders = default, bool addonlinelink = default, bool addtags = default, date_range daterange = default, date_range receivedrange = default, string sortorder = default, CancellationToken cancellationToken = default)