instantly

package module
v0.0.0-...-9cecd66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: 0BSD Imports: 9 Imported by: 0

README

instantly-go

Instantly-Go is a Go library for accessing the Instantly.ai API, making it easier for you to manage campaigns, leads, accounts, and other resources. The library provides easy-to-use interfaces for interacting with the Instantly service, allowing you to focus on building your applications.

Features

  • Manage campaigns: create, list, modify, and delete campaigns
  • Manage leads: add, update, and delete leads from campaigns
  • Manage accounts: list, check vitals, and manage warmup status
  • Flexible configuration: set custom host, API version, rate limit, and HTTP client

Installation

go get github.com/bjornpagen/instantly-go

Usage

Import the package:

import instantly "github.com/bjornpagen/instantly-go"

Create a new client with your API key:

client := instantly.New("your_api_key")

Examples

List Campaigns

campaigns, err := client.ListCampaigns()
if err != nil {
    log.Fatal(err)
}
fmt.Println(campaigns)

Add Leads to Campaign

leads := []instantly.Lead{
    {Email: "email@example.com", FirstName: "John", LastName: "Doe"},
    {Email: "another-email@example.com", FirstName: "Jane", LastName: "Smith"},
}

resp, err := client.AddLeadsToCampaign("campaign_id", leads)
if err != nil {
    log.Fatal(err)
}
fmt.Println(resp)

Documentation

For detailed documentation and available methods, please refer to the Godoc.

Contributing

Please feel free to open an issue or submit a pull request if you'd like to contribute to the project. All contributions are welcome!

License

instantly-go is released under the Zero-Clause BSD License.

Documentation

Index

Constants

View Source
const (
	LeadStatusActive          = "Active"
	LeadStatusCompleted       = "Completed"
	LeadStatusUnsubscribed    = "Unsubscribed"
	LeadStatusInterested      = "Interested"
	LeadStatusMeetingBooked   = "Meeting Booked"
	LeadStatusMeetingComplete = "Meeting Completed"
	LeadStatusClosed          = "Closed"
	LeadStatusOutOfOffice     = "Out of Office"
	LeadStatusNotInterested   = "Not Interested"
	LeadStatusWrongPerson     = "Wrong Person"
)

Variables

View Source
var (
	ErrMarshalFailed          = errors.New("failed to unmarshal object")
	ErrUnmarshalFailed        = errors.New("failed to unmarshal object")
	ErrRequestCreationFailed  = errors.New("failed to create request")
	ErrRequestExecutionFailed = errors.New("failed to execute request")
	ErrRequestBodyReadFailed  = errors.New("failed to to read request body")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Email            string
	TimestampCreated time.Time
	TimestampUpdated time.Time
	Payload          *Payload
}

type AccountVitals

type AccountVitals struct {
	Domain string
	Mx     bool
	Spf    bool
	Dkim   bool
	Dmarc  bool
}

type Campaign

type Campaign struct {
	Id   string
	Name string
}

type CampaignSchedule

type CampaignSchedule struct {
	Name     string
	Days     map[time.Weekday]bool
	Timezone *time.Location
	Timing   Timing
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(apiKey string, opts ...Option) (*Client, error)

func (*Client) AddEntriesToBlocklist

func (c *Client) AddEntriesToBlocklist(entries []string) (entriesAdded int, err error)

func (*Client) AddLeadsToCampaign

func (c *Client) AddLeadsToCampaign(campaignId string, leads []Lead) (response *addLeadsToCampaignResponse, err error)

func (*Client) AddSendingAccount

func (c *Client) AddSendingAccount(campaignId, email string) error

func (*Client) Authenticate

func (c *Client) Authenticate() (workspaceName string, err error)

func (*Client) CheckAccountVitals

func (c *Client) CheckAccountVitals(accounts []string) (successList, failureList []AccountVitals, err error)

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(email string) error

func (*Client) DeleteLeadVariables

func (c *Client) DeleteLeadVariables(campaignId, email string, variables []string) error

func (*Client) DeleteLeadsFromCampaign

func (c *Client) DeleteLeadsFromCampaign(campaignId string, deleteAllFromCompany bool, deleteList []string) error

func (*Client) EnableWarmup

func (c *Client) EnableWarmup(email string) error

func (*Client) GetCampaignAccounts

func (c *Client) GetCampaignAccounts(campaignId string) (accountEmails []string, err error)

func (*Client) GetCampaignCount

func (c *Client) GetCampaignCount(campaignId string, startDate time.Time, endDate *time.Time) (count *getCampaignCountResponse, err error)

func (*Client) GetCampaignName

func (c *Client) GetCampaignName(campaignId string) (campaignName string, err error)

func (*Client) GetCampaignSummary

func (c *Client) GetCampaignSummary(campaignId string) (summary *getCampaignSummaryResponse, err error)

func (*Client) GetLeadFromCampaign

func (c *Client) GetLeadFromCampaign(campaignId, email string) (lead internalLead, err error)

func (*Client) LaunchCampaign

func (c *Client) LaunchCampaign(campaignId string) error

func (*Client) ListAccounts

func (c *Client) ListAccounts(limit, skip int) ([]Account, error)

func (*Client) ListCampaigns

func (c *Client) ListCampaigns() ([]Campaign, error)

func (*Client) MarkAccountAsFixed

func (c *Client) MarkAccountAsFixed(email string) error

func (*Client) MarkAllAccountsAsFixed

func (c *Client) MarkAllAccountsAsFixed() error

func (*Client) PauseCampaign

func (c *Client) PauseCampaign(campaignId string) error

func (*Client) PauseWarmup

func (c *Client) PauseWarmup(email string) error

func (*Client) RemoveSendingAccount

func (c *Client) RemoveSendingAccount(campaignId, email string) error

func (*Client) SetCampaignAccounts

func (c *Client) SetCampaignAccounts(campaignId string, accountEmails []string) error

func (*Client) SetCampaignName

func (c *Client) SetCampaignName(campaignId, campaignName string) error

func (*Client) SetCampaignSchedule

func (c *Client) SetCampaignSchedule(campaignId string, startDate time.Time, endDate *time.Time, schedules []CampaignSchedule) error

func (*Client) SetLeadVariable

func (c *Client) SetLeadVariable(campaignId, email string, variables map[string]interface{}) error

func (*Client) UpdateLeadStatus

func (c *Client) UpdateLeadStatus(campaignId, email, status string) error

func (*Client) UpdateLeadVariable

func (c *Client) UpdateLeadVariable(campaignId, email string, variables map[string]interface{}) error

type Lead

type Lead struct {
	Email           string            `json:"email"`
	FirstName       string            `json:"first_name,omitempty"`
	LastName        string            `json:"last_name,omitempty"`
	CompanyName     string            `json:"company_name,omitempty"`
	Personalization string            `json:"personalization,omitempty"`
	Phone           string            `json:"phone,omitempty"`
	Website         string            `json:"website,omitempty"`
	CustomVariables map[string]string `json:"custom_variables,omitempty"`
}

type Option

type Option func(option *options) error

func WithApiVersion

func WithApiVersion(version int) Option

func WithHost

func WithHost(host string) Option

func WithHttpClient

func WithHttpClient(hc http.Client) Option

func WithRateLimit

func WithRateLimit(rl ratelimit.Limiter) Option

type Payload

type Payload struct {
	Name struct {
		Last  string `json:"last"`
		First string `json:"first"`
	} `json:"name"`
	Warmup struct {
		Limit    int `json:"limit"`
		Advanced struct {
			WarmCtd        bool `json:"warm_ctd"`
			OpenRate       int  `json:"open_rate"`
			WeekdayOnly    bool `json:"weekday_only"`
			ImportantRate  int  `json:"important_rate"`
			ReadEmulation  bool `json:"read_emulation"`
			SpamSaveRate   int  `json:"spam_save_rate"`
			RandomRangeMin int  `json:"random_range_min"`
			RandomRangeMax int  `json:"random_range_max"`
		} `json:"advanced"`
		Increment int `json:"increment"`
		ReplyRate int `json:"reply_rate"`
	} `json:"warmup"`
	ImapHost   string `json:"imap_host"`
	ImapPort   int    `json:"imap_port"`
	SmtpHost   string `json:"smtp_host"`
	SmtpPort   string `json:"smtp_port"`
	DailyLimit int    `json:"daily_limit"`
	SendingGap string `json:"sending_gap"`
}

type Timing

type Timing struct {
	From time.Time
	To   time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL