Skip to content

sendx/sendx-go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SendX Go SDK

Introduction

SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.

The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request.

Installation

Install the following dependencies:

go get github.com/sendx/sendx-go-sdk

Examples

package main

import (
	"context"
	"fmt"
	"os"
	
	sendx "github.com/sendx/sendx-go-sdk"
)

func main() {
	ctx := context.WithValue(
		context.Background(),
		sendx.ContextAPIKeys,
		map[string]sendx.APIKey{
			"apiKeyAuth": {Key: "YOUR_API_KEY"},
		},
	)

	contactRequest := *sendx.NewContactRequest() // ContactRequest |
	contactRequest.Email = sendx.PtrString("jane@doe.com")
	contactRequest.FirstName = sendx.PtrString("Jane")
	contactRequest.LastName = sendx.PtrString("Doe")
	contactRequest.Company = sendx.PtrString("Tech Solutions Inc.")
	contactRequest.LastTrackedIp = sendx.PtrString("34.94.159.140")
	contactRequest.CustomFields = &map[string]string{"K2mxBVReqBhbwx9e0ItSea": "VIP", "7o3Tl1aY2yKp2X1aflRjOL": "Special Offer Subscriber"}
	contactRequest.Lists = []string{"1244"}
	contactRequest.Tags = []string{"MKdhTovsTJDetCyrJmRySL"}

	configuration := sendx.NewConfiguration()
	apiClient := sendx.NewAPIClient(configuration)
	resp, r, err := apiClient.ContactAPI.CreateContact(ctx).ContactRequest(contactRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ContactAPI.CreateContact``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreateContact`: Response
	fmt.Fprintf(os.Stdout, "Response from `ContactAPI.CreateContact`: %v\n", resp)

}

Note, enum values are always validated and all unused variables are silently ignored.

Documentation for API Endpoints

All URIs are relative to https://api.sendx.io/api/v1/rest

Class Method HTTP request Description
CampaignAPI CreateCampaign Post /campaign Create Campaign
CampaignAPI DeleteCampaign Delete /campaign/{campaignId} Delete Campaign
CampaignAPI EditCampaign Put /campaign/{campaignId} Edit Campaign
CampaignAPI GetAllCampaigns Get /campaign Get All Campaigns
CampaignAPI GetCampaignById Get /campaign/{campaignId} Get Campaign By Id
ContactAPI CreateContact Post /contact Create a contact
ContactAPI DeleteContact Delete /contact/{identifier} Delete Contact
ContactAPI GetAllContacts Get /contact Get All Contacts
ContactAPI GetContactById Get /contact/{identifier} Get Contact by Identifier
ContactAPI UnsubscribeContact Post /contact/unsubscribe/{identifier} Unsubscribe Contact
ContactAPI UpdateContact Put /contact/{identifier} Update Contact
EventAPI CreateRevenueEvent Post /events/revenue Record a revenue event for a specific contact
EventAPI PushCustomEvent Post /events/custom Push a custom event associated with a contact
GettingStartedAPI IdentifyContact Post /contact/identify Identify contact
GettingStartedAPI TrackingContact Post /contact/track Add Tracking info
ListAPI CreateList Post /list Create List
ListAPI DeleteList Delete /list/{listId} Delete List
ListAPI GetAllLists Get /list Get All Lists
ListAPI GetListById Get /list/{listId} Get List
ListAPI UpdateList Put /list/{listId} Update List
ReportsAPI GetCampaignReport Get /report/campaign/{campaignId} Get CampaignReport Data
SenderAPI CreateSender Post /sender Create Sender
SenderAPI GetAllSenders Get /sender Get All Senders
TagsAPI CreateTag Post /tag Create a Tag
TagsAPI DeleteTag Delete /tag/{tagId} Delete a Tag
TagsAPI GetAllTags Get /tag Get All Tags
TagsAPI GetTagById Get /tag/{tagId} Get a Tag by ID
TagsAPI UpdateTag Put /tag/{tagId} Update a Tag

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

apiKeyAuth

  • Type: API key
  • API key parameter name: X-Team-ApiKey
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is the team api key you get via SendX dashboard and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		sendx.ContextAPIKeys,
		map[string]sendx.APIKey{
			"apiKeyAuth": {Key: "Your API Key"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

support@sendx.io

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages