manygo

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 5 Imported by: 0

README

ManyChat API SDK for Golang

SDK based on the ManyChat public API. Supporting account, subscribers and sending.

To get entire information about endpoints, please read the official ManyChat documentation.

ManyChat API Swagger

Please keep in your mind that ManyChat API has rate limits on each endpoint. You can find current limits in rate_limits.go and control requests sending.

Features
  • Page (info, tags, bot fields, custom fields, flows, growth tools, OTN topics)
  • Subscriber (search, create and update subscribers, control custom fields, system fields, tags)
  • Sending (send content, nodes and flows)
  • Ready builders to construct messages
Installation
> go get github.com/antondzhukov/manygo
package main

import (
	"fmt"
	"github.com/antondzhukov/manygo"
	"net/http"
)
Client initialization and create first request
client := manygo.NewClient(http.DefaultClient, "YOUR_API_KEY")

page, httpResponse, err := client.Page.GetInfo()

Sending

Send a Message
message := client.DynamicBlock.Messages.BuildTextMessage("Hello world!")
dynamicBlock := client.DynamicBlock.BuildDynamicBlock()
dynamicBlock.AddMessage(message)

sendContentRequest := manygo.SendingSendContentRequest{
    SubscriberId: 12345,
    Data: dynamicBlock,
    MessageTag: manygo.MessageTagAccountUpdate,
}

ok, httpResponse, err := client.Sending.SendContent(sendContentRequest)
Send several Messages
dynamicBlock := client.DynamicBlock.BuildDynamicBlock()

messageOne := client.DynamicBlock.Messages.BuildTextMessage("Hello world one!")
messageTwo := client.DynamicBlock.Messages.BuildTextMessage("Hello world two!")

dynamicBlock.AddMessage(messageOne)
dynamicBlock.AddMessage(messageTwo)

// OR

messages := make([]*Message, 0)
messages = append(messages, messageOne)
messages = append(messages, messagetwo)

dynamicBlock.AddMessages(messages)

sendContentRequest := manygo.SendingSendContentRequest{
    SubscriberId: 12345,
    Data: dynamicBlock,
    MessageTag: manygo.MessageTagAccountUpdate,
}

ok, httpResponse, err := client.Sending.SendContent(sendContentRequest)

Build Messages

// Text
message := client.DynamicBlock.Messages.BuildTextMessage("Hello world!")

// Image
message := client.DynamicBlock.Messages.BuildImageMessage("https://domain.com/image.png")

// Video
message := client.DynamicBlock.Messages.BuildVideoMessage("https://domain.com/video.mov")

// Audio
message := client.DynamicBlock.Messages.BuildAudioMessage("https://domain.com/video.wav")

// File
message := client.DynamicBlock.Messages.BuildVideoMessage("https://domain.com/doc.doc")

// Gallery
gallery := client.DynamicBlock.Gallery.NewGallery()
gallery.SetImageAspectRation(ImageAspectRationSquare) // default: ImageAspectRatioHorizontal
gallery.AddGalleryCard(
    "Title",
    "subtitle",
    "https://domain.com/image.jpg",
    "https://domain.com/actionPage", // use empty string ("") if you don't need an action
    make([]Button, 0), // add buttons if you want, or use an empty slice
)

message := client.DynamicBlock.Messages.BuildGalleryMessage(gallery)
Add Buttons to a Message
button := client.DynamicBlock.Buttons.BuildUrlButton("Click", "https://domain.com", WebViewSizeFull)
message.AddButton(button)

see how to create other Buttons

Add Actions to a DynamicBlock
action := client.DynamicBlock.Actions.BuildAddTagAction("My Tag")
dynamicBlock.AddAction(action)

see how to create other Actions

Add QuickReplies to a DynamicBlock
quickReply := client.DynamicBlock.QuickReply.BuildFlowQuickReply("reply quickly", "ns_123abc...")
dynamicBlock.AddQuickReply(quickReply)

see how to create other QuickReplies

Documentation

Index

Constants

View Source
const (
	ActionAddTag          string = "add_tag"
	ActionRemoveTag       string = "remove_tag"
	ActionSetFieldValue   string = "set_field_value"
	ActionUnsetFieldValue string = "unset_field_value"
)
View Source
const (
	ButtonTypeCall                 string = "call"
	ButtonTypeUrl                  string = "url"
	ButtonTypeFlow                 string = "flow"
	ButtonTypeNode                 string = "node"
	ButtonTypeBuy                  string = "buy"
	ButtonTypeDynamicBlockCallback string = "dynamic_block_callback"
)
View Source
const (
	WebViewSizeFull    string = "full"
	WebViewSizeMedium  string = "medium"
	WebViewSizeCompact string = "compact"
)
View Source
const (
	ImageAspectRatioHorizontal string = "horizontal"
	ImageAspectRationSquare    string = "square"
)
View Source
const (
	MessageTypeText  string = "text"
	MessageTypeImage string = "image"
	MessageTypeVideo string = "video"
	MessageTypeAudio string = "audio"
	MessageTypeFile  string = "file"
	MessageTypeCards string = "cards"
)
View Source
const (
	QuickReplyTypeNode                 string = "node"
	QuickReplyTypeFlow                 string = "flow"
	QuickReplyTypeDynamicBlockCallback string = "dynamic_block_callback"
)
View Source
const (
	MessageTagConfirmedEventUpdate string = "CONFIRMED_EVENT_UPDATE"
	MessageTagPostPurchaseUpdate   string = "POST_PURCHASE_UPDATE"
	MessageTagAccountUpdate        string = "ACCOUNT_UPDATE"
	MessageTagHumanAgent           string = "HUMAN_AGENT"
	MessageTagCustomerFeedback     string = "CUSTOMER_FEEDBACK"
)

Variables

This section is empty.

Functions

func DoBoolPostRequest added in v1.0.4

func DoBoolPostRequest(sling *sling.Sling, path string, requestParams interface{}) (bool, *http.Response, error)

func MatchFirstError added in v1.0.4

func MatchFirstError(httpError error, errorResponse *ErrorResponse) error

Types

type Action added in v1.0.4

type Action struct {
	Action    string      `json:"action"`
	TagName   string      `json:"tag_name,omitempty"`
	FieldName string      `json:"field_name,omitempty"`
	Value     interface{} `json:"value,omitempty"`
}

type ActionBuilder added in v1.0.4

type ActionBuilder struct{}

func (*ActionBuilder) BuildAddTagAction added in v1.0.4

func (builder *ActionBuilder) BuildAddTagAction(tagName string) *Action

func (*ActionBuilder) BuildRemoveTagAction added in v1.0.4

func (builder *ActionBuilder) BuildRemoveTagAction(tagName string) *Action

func (*ActionBuilder) BuildSetFieldValueAction added in v1.0.4

func (builder *ActionBuilder) BuildSetFieldValueAction(fieldName string, value interface{}) *Action

func (*ActionBuilder) BuildUnsetFieldValueAction added in v1.0.4

func (builder *ActionBuilder) BuildUnsetFieldValueAction(fieldName string) *Action

type AddSubscriberTagByNameRequest added in v1.0.4

type AddSubscriberTagByNameRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	TagName      string `json:"tag_name"`
}

type AddSubscriberTagRequest added in v1.0.4

type AddSubscriberTagRequest struct {
	SubscriberId int64 `json:"subscriber_id"`
	TagId        int64 `json:"tag_id"`
}

type BoolSuccessResponse added in v1.0.4

type BoolSuccessResponse struct {
	Status string `json:"status"`
}

type BotField added in v1.0.4

type BotField struct {
	Id          int64        `json:"id"`
	Name        string       `json:"name"`
	Type        BotFieldType `json:"type"`
	Description string       `json:"description"`
	Value       interface{}  `json:"value"`
}

type BotFieldService added in v1.0.4

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

func (*BotFieldService) CreateBotField added in v1.0.4

func (s *BotFieldService) CreateBotField(request CreateBotFieldRequest) (*BotField, *http.Response, error)

func (*BotFieldService) GetBotFields added in v1.0.4

func (s *BotFieldService) GetBotFields() (*[]BotField, *http.Response, error)

func (*BotFieldService) SetBotField added in v1.0.4

func (s *BotFieldService) SetBotField(request SetBotFieldRequest) (bool, *http.Response, error)

func (*BotFieldService) SetBotFieldByName added in v1.0.4

func (s *BotFieldService) SetBotFieldByName(request SetBotFieldByNameRequest) (bool, *http.Response, error)

func (*BotFieldService) SetBotFields added in v1.0.4

func (s *BotFieldService) SetBotFields(request SetBotFieldsRequest) (bool, *http.Response, error)

type BotFieldType added in v1.0.4

type BotFieldType DataType

type Button added in v1.0.4

type Button struct {
	Type          string      `json:"type"`
	Caption       string      `json:"caption"`
	Phone         string      `json:"phone,omitempty"`
	Url           string      `json:"url,omitempty"`
	Method        string      `json:"method,omitempty"`
	WebViewSize   string      `json:"web_view_size,omitempty"`
	Target        string      `json:"target,omitempty"`
	Customer      Customer    `json:"customer,omitempty"`
	Product       Product     `json:"product,omitempty"`
	SuccessTarget string      `json:"success_target,omitempty"`
	Headers       interface{} `json:"headers,omitempty"`
	Payload       interface{} `json:"payload,omitempty"`
}

type ButtonsBuilder added in v1.0.4

type ButtonsBuilder struct{}

func (*ButtonsBuilder) BuildBuyButton added in v1.0.4

func (builder *ButtonsBuilder) BuildBuyButton(caption string, customer Customer, product Product, successTarget string) *Button

func (*ButtonsBuilder) BuildCallButton added in v1.0.4

func (builder *ButtonsBuilder) BuildCallButton(caption string, phone string) *Button

func (*ButtonsBuilder) BuildCallbackButton added in v1.0.4

func (builder *ButtonsBuilder) BuildCallbackButton(caption string, url string, method string, headers interface{}, payload interface{}) *Button

func (*ButtonsBuilder) BuildFlowButton added in v1.0.4

func (builder *ButtonsBuilder) BuildFlowButton(caption string, target string) *Button

func (*ButtonsBuilder) BuildNodeButton added in v1.0.4

func (builder *ButtonsBuilder) BuildNodeButton(caption string, target string) *Button

func (*ButtonsBuilder) BuildUrlButton added in v1.0.4

func (builder *ButtonsBuilder) BuildUrlButton(caption string, url string, webViewSize string) *Button

type Client

type Client struct {
	Page         *PageService
	Subscribers  *SubscriberService
	Sending      *SendingService
	DynamicBlock *DynamicBlockBuilder
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, bearer string) *Client

func (*Client) SetApiUrl

func (client *Client) SetApiUrl(url string)

func (*Client) SetBearer

func (client *Client) SetBearer(bearer string)

type CreateBotFieldRequest added in v1.0.4

type CreateBotFieldRequest struct {
	Name        string      `json:"name"`
	Type        DataType    `json:"type"`
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
}

type CreateSubscriberRequest added in v1.0.4

type CreateSubscriberRequest struct {
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Phone         string `json:"phone"`
	WhatsAppPhone string `json:"whatsapp_phone,omitempty"`
	Email         string `json:"email"`
	Gender        string `json:"gender"`
	HasOptInSMS   bool   `json:"has_opt_in_sms"`
	HasOptInEmail bool   `json:"has_opt_in_email"`
	ConsentPhrase string `json:"consent_phrase"`
}

type CreateTagRequest added in v1.0.4

type CreateTagRequest struct {
	Name string `json:"name,omitempty"`
}

type CustomField added in v1.0.4

type CustomField struct {
	Id          int64    `json:"id"`
	Name        string   `json:"name"`
	Type        DataType `json:"type"`
	Description string   `json:"description"`
}

type CustomFieldService added in v1.0.4

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

func (*CustomFieldService) CreateCustomField added in v1.0.4

func (s *CustomFieldService) CreateCustomField(request СreateCustomFieldRequest) (*CustomField, *http.Response, error)

func (*CustomFieldService) GetCustomFields added in v1.0.4

func (s *CustomFieldService) GetCustomFields() (*[]CustomField, *http.Response, error)

type Customer added in v1.0.4

type Customer struct {
	ShippingAddress bool `json:"shipping_address"`
	ContactName     bool `json:"contact_name"`
	ContactPhone    bool `json:"contact_phone"`
	ContactEmail    bool `json:"contact_email"`
}

type DataType added in v1.0.4

type DataType string
const (
	BotFieldTypeUndefined DataType = DataTypeUndefined
	BotFieldTypeText      DataType = DataTypeText
	BotFieldTypeNumber    DataType = DataTypeNumber
	BotFieldTypeDate      DataType = DataTypeDate
	BotFieldTypeDateTime  DataType = DataTypeDateTime
	BotFieldTypeBoolean   DataType = DataTypeBoolean
)
const (
	CustomFieldTypeUndefined DataType = DataTypeUndefined
	CustomFieldTypeText      DataType = DataTypeText
	CustomFieldTypeNumber    DataType = DataTypeNumber
	CustomFieldTypeDate      DataType = DataTypeDate
	CustomFieldTypeDateTime  DataType = DataTypeDateTime
	CustomFieldTypeBoolean   DataType = DataTypeBoolean
)
const (
	DataTypeUndefined DataType = ""
	DataTypeText      DataType = "text"
	DataTypeNumber    DataType = "number"
	DataTypeDate      DataType = "date"
	DataTypeDateTime  DataType = "datetime"
	DataTypeBoolean   DataType = "boolean"
)

type DynamicBlock added in v1.0.4

type DynamicBlock struct {
	Version string `json:"version"`
	Content struct {
		Messages     []*Message    `json:"messages"`
		Actions      []*Action     `json:"actions,omitempty"`
		QuickReplies []*QuickReply `json:"quick_replies,omitempty"`
	} `json:"content"`
}

func (*DynamicBlock) AddAction added in v1.0.4

func (dynamicBlock *DynamicBlock) AddAction(action *Action)

func (*DynamicBlock) AddActions added in v1.0.4

func (dynamicBlock *DynamicBlock) AddActions(actions []*Action)

func (*DynamicBlock) AddMessage added in v1.0.4

func (dynamicBlock *DynamicBlock) AddMessage(message *Message)

func (*DynamicBlock) AddMessages added in v1.0.4

func (dynamicBlock *DynamicBlock) AddMessages(messages []*Message)

func (*DynamicBlock) AddQuickReplies added in v1.0.4

func (dynamicBlock *DynamicBlock) AddQuickReplies(quickReplies []*QuickReply)

func (*DynamicBlock) AddQuickReply added in v1.0.4

func (dynamicBlock *DynamicBlock) AddQuickReply(quickReply *QuickReply)

type DynamicBlockBuilder added in v1.0.4

type DynamicBlockBuilder struct {
	Messages        *MessageBuilder
	Buttons         *ButtonsBuilder
	Actions         *ActionBuilder
	QuickReply      *QuickReplyBuilder
	Gallery         *GalleryBuilder
	ExternalMessage *ExternalMessageBuilder
}

func NewDynamicBlockBuilder added in v1.0.4

func NewDynamicBlockBuilder() *DynamicBlockBuilder

func (*DynamicBlockBuilder) BuildDynamicBlock added in v1.0.4

func (builder *DynamicBlockBuilder) BuildDynamicBlock() *DynamicBlock

type ErrorResponse added in v1.0.4

type ErrorResponse struct {
	Status    string      `json:"status"`
	Message   string      `json:"message"`
	Details   interface{} `json:"details,omitempty"`
	ErrorCode int         `json:"error_code,omitempty"`
}

type ExternalMessage added in v1.0.4

type ExternalMessage struct {
	Url     string      `json:"url"`
	Method  string      `json:"method"`
	Headers interface{} `json:"headers,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
	Timeout int64       `json:"timeout,omitempty"`
}

type ExternalMessageBuilder added in v1.0.4

type ExternalMessageBuilder struct{}

func (*ExternalMessageBuilder) BuildExternalMessage added in v1.0.4

func (builder *ExternalMessageBuilder) BuildExternalMessage(url string, method string, headers interface{}, payload interface{}, timeout int64) *ExternalMessage

type FindSubscriberByCustomFieldRequest added in v1.0.4

type FindSubscriberByCustomFieldRequest struct {
	FieldId    int64       `url:"field_id"`
	FieldValue interface{} `url:"field_value"`
}

type FindSubscriberByEmailRequest added in v1.0.4

type FindSubscriberByEmailRequest struct {
	Email string `url:"email"`
}

type FindSubscriberByNameRequest added in v1.0.4

type FindSubscriberByNameRequest struct {
	Name string `url:"name"`
}

type FindSubscriberByPhoneRequest added in v1.0.4

type FindSubscriberByPhoneRequest struct {
	Phone string `url:"phone"`
}

type Flow added in v1.0.4

type Flow struct {
	NS       string `json:"ns"`
	Name     string `json:"name"`
	FolderId int64  `json:"folder_id"`
}

type FlowService added in v1.0.4

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

func (*FlowService) GetFlows added in v1.0.4

func (s *FlowService) GetFlows() (*Flows, *http.Response, error)

type Flows added in v1.0.4

type Flows struct {
	Flows   []Flow   `json:"flows"`
	Folders []Folder `json:"folders"`
}

type Folder added in v1.0.4

type Folder struct {
	Id       int64  `json:"id"`
	Name     string `json:"name"`
	ParentId int64  `json:"parent_id"`
}
type Gallery struct {
	Elements []*GalleryCard `json:"elements"`
	// contains filtered or unexported fields
}

func (*Gallery) AddGalleryCard added in v1.0.4

func (gallery *Gallery) AddGalleryCard(title string, subtitle string, imageUrl string, actionUrl string, buttons []Button)

func (*Gallery) GetImageAspectRation added in v1.0.4

func (gallery *Gallery) GetImageAspectRation() string

func (*Gallery) SetImageAspectRation added in v1.0.4

func (gallery *Gallery) SetImageAspectRation(imageAspectRatio string)

type GalleryBuilder added in v1.0.4

type GalleryBuilder struct{}

func (*GalleryBuilder) NewGallery added in v1.0.4

func (builder *GalleryBuilder) NewGallery() *Gallery

type GalleryCard added in v1.0.4

type GalleryCard struct {
	Title     string   `json:"title"`
	SubTitle  string   `json:"subtitle"`
	ImageUrl  string   `json:"image_url"`
	ActionUrl string   `json:"action_url,omitempty"`
	Buttons   []Button `json:"buttons,omitempty"`
}

type GetSubscriberInfoByUserRefRequest added in v1.0.4

type GetSubscriberInfoByUserRefRequest struct {
	UserRef int64 `url:"user_ref"`
}

type GetSubscriberInfoRequest added in v1.0.4

type GetSubscriberInfoRequest struct {
	SubscriberId int64 `url:"subscriber_id"`
}

type GrowthTool added in v1.0.4

type GrowthTool struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type GrowthToolsService added in v1.0.4

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

func (*GrowthToolsService) GetGrowthTools added in v1.0.4

func (s *GrowthToolsService) GetGrowthTools() (*[]GrowthTool, *http.Response, error)

type Message added in v1.0.4

type Message struct {
	Type             string         `json:"type"`
	Text             string         `json:"text,omitempty"`
	Url              string         `json:"url,omitempty"`
	Buttons          []*Button      `json:"buttons,omitempty"`
	Elements         []*GalleryCard `json:"elements,omitempty"`
	ImageAspectRatio string         `json:"image_aspect_ratio"`
}

func (*Message) AddButton added in v1.0.4

func (message *Message) AddButton(button *Button)

func (*Message) AddButtons added in v1.0.4

func (message *Message) AddButtons(buttons []*Button)

type MessageBuilder added in v1.0.4

type MessageBuilder struct{}

func (*MessageBuilder) BuildAudioMessage added in v1.0.4

func (builder *MessageBuilder) BuildAudioMessage(url string) *Message

func (*MessageBuilder) BuildFileMessage added in v1.0.4

func (builder *MessageBuilder) BuildFileMessage(url string) *Message

func (*MessageBuilder) BuildGalleryMessage added in v1.0.4

func (builder *MessageBuilder) BuildGalleryMessage(gallery *Gallery) *Message

func (*MessageBuilder) BuildImageMessage added in v1.0.4

func (builder *MessageBuilder) BuildImageMessage(url string) *Message

func (*MessageBuilder) BuildTextMessage added in v1.0.4

func (builder *MessageBuilder) BuildTextMessage(text string) *Message

func (*MessageBuilder) BuildVideoMessage added in v1.0.4

func (builder *MessageBuilder) BuildVideoMessage(url string) *Message

type OtnTopic added in v1.0.4

type OtnTopic struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type OtnTopicService added in v1.0.4

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

func (*OtnTopicService) GetOtnTopics added in v1.0.4

func (s *OtnTopicService) GetOtnTopics() (*[]OtnTopic, *http.Response, error)

type Page added in v1.0.4

type Page struct {
	Id          int64  `json:"id"`
	Name        string `json:"name"`
	Category    string `json:"category"`
	AvatarLink  string `json:"avatar_link"`
	Username    string `json:"username"`
	About       string `json:"about"`
	Description string `json:"description"`
	IsPro       bool   `json:"is_pro"`
	Timezone    string `json:"timezone"`
}

type PageService added in v1.0.4

type PageService struct {
	Tags         *TagService
	GrowthTools  *GrowthToolsService
	Flows        *FlowService
	OtnTopics    *OtnTopicService
	CustomFields *CustomFieldService
	BotFields    *BotFieldService
	// contains filtered or unexported fields
}

func NewPageService added in v1.0.4

func NewPageService(sling *sling.Sling) *PageService

func (*PageService) GetInfo added in v1.0.4

func (s *PageService) GetInfo() (*Page, *http.Response, error)

type Product added in v1.0.4

type Product struct {
	Label string `json:"label"`
	Cost  int64  `json:"cost"`
}

type QuickReply added in v1.0.4

type QuickReply struct {
	Type    string      `json:"type"`
	Caption string      `json:"caption"`
	Target  string      `json:"target,omitempty"`
	Url     string      `json:"url,omitempty"`
	Method  string      `json:"method,omitempty"`
	Headers interface{} `json:"headers,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
}

type QuickReplyBuilder added in v1.0.4

type QuickReplyBuilder struct{}

func (*QuickReplyBuilder) BuildDynamicBlockCallbackQuickReply added in v1.0.4

func (builder *QuickReplyBuilder) BuildDynamicBlockCallbackQuickReply(caption string, url string, method string, headers interface{}, payload interface{}) *QuickReply

func (*QuickReplyBuilder) BuildFlowQuickReply added in v1.0.4

func (builder *QuickReplyBuilder) BuildFlowQuickReply(caption string, target string) *QuickReply

func (*QuickReplyBuilder) BuildNodeQuickReply added in v1.0.4

func (builder *QuickReplyBuilder) BuildNodeQuickReply(caption string, target string) *QuickReply

type RateLimit added in v1.0.4

type RateLimit uint16
const (
	RateLimitPageGetInfo           RateLimit = 100
	RateLimitPageCreateTag         RateLimit = 10
	RateLimitPageGetTags           RateLimit = 100
	RateLimitPageRemoveTag         RateLimit = 10
	RateLimitPageRemoveTageByName  RateLimit = 10
	RateLimitPageCreateCustomField RateLimit = 10
	RateLimitPageGetGrowthTools    RateLimit = 100
	RateLimitPageGetFlows          RateLimit = 10
	RateLimitPageGetCustomFields   RateLimit = 100
	RateLimitPageGetOtnTopics      RateLimit = 100
	RateLimitPageGetBotFields      RateLimit = 100
	RateLimitPageCreateBotField    RateLimit = 10
	RateLimitPageSetBotField       RateLimit = 10
	RateLimitPageSetBotFieldByName RateLimit = 10
	RateLimitPageSetBotFields      RateLimit = 10

	RateLimitSubscriberGetInfo               RateLimit = 10
	RateLimitSubscriberFindByName            RateLimit = 100
	RateLimitSubscriberGetInfoByUserRef      RateLimit = 1000
	RateLimitSubscriberFindByCustomField     RateLimit = 100
	RateLimitSubscriberFindBySystemField     RateLimit = 100
	RateLimitSubscriberAddTag                RateLimit = 10
	RateLimitSubscriberAddTagByName          RateLimit = 10
	RateLimitSubscriberRemoveTag             RateLimit = 10
	RateLimitSubscriberRemoveTagByName       RateLimit = 10
	RateLimitSubscriberSetCustomField        RateLimit = 10
	RateLimitSubscriberSetCustomFields       RateLimit = 10
	RateLimitSubscriberSetCustomFieldByName  RateLimit = 10
	RateLimitSubscriberVerifyBySignedRequest RateLimit = 10
	RateLimitSubscriberCreateSubscriber      RateLimit = 10
	RateLimitSubscriberUpdateSubscriber      RateLimit = 10

	RateLimitSendingSendContent          RateLimit = 25
	RateLimitSendingSendContentByUserRef RateLimit = 25
	RateLimitSendingSendFlow             RateLimit = 25
)

type RemoveSubscriberTagByNameRequest added in v1.0.4

type RemoveSubscriberTagByNameRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	TagName      string `json:"tag_name"`
}

type RemoveSubscriberTagRequest added in v1.0.4

type RemoveSubscriberTagRequest struct {
	SubscriberId int64 `json:"subscriber_id"`
	TagId        int64 `json:"tag_id"`
}

type RemoveTagByNameRequest added in v1.0.4

type RemoveTagByNameRequest struct {
	Name string `json:"tag_name,omitempty"`
}

type RemoveTagRequest added in v1.0.4

type RemoveTagRequest struct {
	Id int64 `json:"tag_id,omitempty"`
}

type SendingSendContentByUserRefRequest added in v1.0.4

type SendingSendContentByUserRefRequest struct {
	UserRef int64        `json:"user_ref"`
	Data    DynamicBlock `json:"data"`
}

type SendingSendContentRequest added in v1.0.4

type SendingSendContentRequest struct {
	SubscriberId int64         `json:"subscriber_id"`
	Data         *DynamicBlock `json:"data"`
	MessageTag   string        `json:"message_tag"`
	OtnTopicName string        `json:"otn_topic_name,omitempty"`
}

type SendingSendFlowRequest added in v1.0.4

type SendingSendFlowRequest struct {
	SubscriberId int64  `json:"subscriber_id"`
	FlowNS       string `json:"flow_ns"`
}

type SendingService added in v1.0.4

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

func NewSendingService added in v1.0.4

func NewSendingService(sling *sling.Sling) *SendingService

func (*SendingService) SendContent added in v1.0.4

func (s *SendingService) SendContent(request SendingSendContentRequest) (bool, *http.Response, error)

func (*SendingService) SendContentByUserRef added in v1.0.4

func (s *SendingService) SendContentByUserRef(request SendingSendContentByUserRefRequest) (bool, *http.Response, error)

func (*SendingService) SendFlow added in v1.0.4

func (s *SendingService) SendFlow(request SendingSendFlowRequest) (bool, *http.Response, error)

type SetBotFieldByNameRequest added in v1.0.4

type SetBotFieldByNameRequest struct {
	FieldName  string      `json:"field_name"`
	FieldValue interface{} `json:"field_value"`
}

type SetBotFieldRequest added in v1.0.4

type SetBotFieldRequest struct {
	FieldId    int64       `json:"field_id"`
	FieldValue interface{} `json:"field_value"`
}

type SetBotFieldsItem added in v1.0.4

type SetBotFieldsItem struct {
	Id    int64       `json:"field_id,omitempty"`
	Name  string      `json:"field_name,omitempty"`
	Value interface{} `json:"field_value"`
}

type SetBotFieldsRequest added in v1.0.4

type SetBotFieldsRequest struct {
	Items []SetBotFieldsItem `json:"fields"`
}

type SetCustomFieldsItem added in v1.0.4

type SetCustomFieldsItem struct {
	Id    int64       `json:"field_id,omitempty"`
	Name  string      `json:"field_name,omitempty"`
	Value interface{} `json:"field_value"`
}

type SetCustomFieldsRequest added in v1.0.4

type SetCustomFieldsRequest struct {
	SubscriberId int64                 `json:"subscriber_id"`
	Items        []SetCustomFieldsItem `json:"fields"`
}

type SetSubscriberCustomFieldByNameRequest added in v1.0.4

type SetSubscriberCustomFieldByNameRequest struct {
	SubscriberId int64       `json:"subscriber_id"`
	FieldName    string      `json:"field_name"`
	FieldValue   interface{} `json:"field_value"`
}

type SetSubscriberCustomFieldRequest added in v1.0.4

type SetSubscriberCustomFieldRequest struct {
	SubscriberId int64       `json:"subscriber_id"`
	FieldId      int64       `json:"field_id"`
	FieldValue   interface{} `json:"field_value"`
}

type Subscriber added in v1.0.4

type Subscriber struct {
	Id                string                   `json:"id"`
	PageId            string                   `json:"page_id"`
	UserRefs          []SubscriberRefField     `json:"user_refs,omitempty"`
	FirstName         string                   `json:"first_name"`
	LastName          string                   `json:"last_name"`
	Name              string                   `json:"name"`
	Gender            string                   `json:"gender"`
	ProfilePic        string                   `json:"profile_pic"`
	Locale            string                   `json:"locale"`
	Language          string                   `json:"language"`
	TimeZone          string                   `json:"time_zone"`
	LiveChatUrl       string                   `json:"live_chat_url"`
	LastInputText     string                   `json:"last_input_text"`
	OptInPhone        bool                     `json:"optin_phone"`
	Phone             string                   `json:"phone"`
	OptInEmail        bool                     `json:"optin_email"`
	Email             string                   `json:"email"`
	Subscribed        string                   `json:"subscribed"`
	LastInteraction   string                   `json:"last_interaction"`
	LastSeen          string                   `json:"last_seen"`
	IsFollowupEnabled bool                     `json:"is_followup_enabled"`
	IgUsername        string                   `json:"ig_username"`
	IgId              int64                    `json:"ig_id"`
	WhatsAppPhone     string                   `json:"whatsapp_phone"`
	OptInWhatsApp     bool                     `json:"optin_whatsapp"`
	CustomFields      []SubscriberCustomField  `json:"custom_fields"`
	ShopifyFields     []SubscriberShopifyField `json:"shopify_fields,omitempty"`
	Tags              []Tag                    `json:"tags,omitempty"`
}

type SubscriberCustomField added in v1.0.4

type SubscriberCustomField struct {
	Id          int64       `json:"id"`
	Name        string      `json:"name"`
	Type        DataType    `json:"type"`
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
}

type SubscriberRefField added in v1.0.4

type SubscriberRefField struct {
	UserRef string `json:"user_ref"`
	OptedIn string `json:"opted_in"`
}

type SubscriberService added in v1.0.4

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

func NewSubscriberService added in v1.0.4

func NewSubscriberService(sling *sling.Sling) *SubscriberService

func (*SubscriberService) AddTag added in v1.0.4

func (*SubscriberService) AddTagByName added in v1.0.4

func (s *SubscriberService) AddTagByName(request AddSubscriberTagRequest) (bool, *http.Response, error)

func (*SubscriberService) CreateSubscriber added in v1.0.4

func (s *SubscriberService) CreateSubscriber(request CreateSubscriberRequest) (*Subscriber, *http.Response, error)

func (*SubscriberService) FindByCustomField added in v1.0.4

func (s *SubscriberService) FindByCustomField(request FindSubscriberByCustomFieldRequest) (*[]Subscriber, *http.Response, error)

func (*SubscriberService) FindByEmail added in v1.0.4

func (*SubscriberService) FindByName added in v1.0.4

func (*SubscriberService) FindByPhone added in v1.0.4

func (*SubscriberService) GetInfo added in v1.0.4

func (*SubscriberService) GetInfoByUserRef added in v1.0.4

func (*SubscriberService) RemoveTag added in v1.0.4

func (*SubscriberService) RemoveTagByName added in v1.0.4

func (s *SubscriberService) RemoveTagByName(request RemoveSubscriberTagByNameRequest) (bool, *http.Response, error)

func (*SubscriberService) SetCustomField added in v1.0.4

func (s *SubscriberService) SetCustomField(request SetSubscriberCustomFieldRequest) (bool, *http.Response, error)

func (*SubscriberService) SetCustomFieldByName added in v1.0.4

func (s *SubscriberService) SetCustomFieldByName(request SetSubscriberCustomFieldByNameRequest) (bool, *http.Response, error)

func (*SubscriberService) SetCustomFields added in v1.0.8

func (s *SubscriberService) SetCustomFields(request SetCustomFieldsRequest) (bool, *http.Response, error)

func (*SubscriberService) UpdateSubscriber added in v1.0.4

func (s *SubscriberService) UpdateSubscriber(request UpdateSubscriberRequest) (*Subscriber, *http.Response, error)

func (*SubscriberService) VerifyBySignedRequest added in v1.0.4

func (s *SubscriberService) VerifyBySignedRequest(request SubscriberVerifyBySignedRequestRequest) (bool, *http.Response, error)

type SubscriberShopifyField added in v1.0.4

type SubscriberShopifyField struct {
	Id                    int64    `json:"id"`
	State                 string   `json:"state"`
	Currency              string   `json:"currency"`
	TotalSpent            string   `json:"total_spent"`
	OrdersCount           int64    `json:"orders_count"`
	AcceptsMarketing      bool     `json:"accepts_marketing"`
	LastOrderId           int64    `json:"last_order_id"`
	LastOrderCreatedAt    string   `json:"last_order_created_at"`
	Tags                  []string `json:"tags"`
	LastCheckoutId        int64    `json:"last_checkout_id"`
	LastCheckoutPrice     string   `json:"last_checkout_price"`
	LastCheckoutCreatedAt string   `json:"last_checkout_created_at"`
}

type SubscriberVerifyBySignedRequestRequest added in v1.0.4

type SubscriberVerifyBySignedRequestRequest struct {
	SubscriberId  int64  `json:"subscriber_id"`
	SignedRequest string `json:"signed_request"`
}

type Tag added in v1.0.4

type Tag struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

type TagService added in v1.0.4

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

func (*TagService) CreateTag added in v1.0.4

func (s *TagService) CreateTag(request CreateTagRequest) (*Tag, *http.Response, error)

func (*TagService) GetTags added in v1.0.4

func (s *TagService) GetTags() (*[]Tag, *http.Response, error)

func (*TagService) RemoveTag added in v1.0.4

func (s *TagService) RemoveTag(request RemoveTagRequest) (bool, *http.Response, error)

func (*TagService) RemoveTagByName added in v1.0.4

func (s *TagService) RemoveTagByName(request RemoveTagByNameRequest) (bool, *http.Response, error)

type UpdateSubscriberRequest added in v1.0.4

type UpdateSubscriberRequest struct {
	SubscriberId  int64  `json:"subscriber_id"`
	FirstName     string `json:"first_name"`
	LastName      string `json:"last_name"`
	Phone         string `json:"phone"`
	WhatsAppPhone string `json:"whatsapp_phone,omitempty"`
	Email         string `json:"email"`
	Gender        string `json:"gender"`
	HasOptInSMS   bool   `json:"has_opt_in_sms"`
	HasOptInEmail bool   `json:"has_opt_in_email"`
	ConsentPhrase string `json:"consent_phrase"`
}

type СreateCustomFieldRequest added in v1.0.4

type СreateCustomFieldRequest struct {
	Caption     string   `json:"caption"`
	Type        DataType `json:"type"`
	Description string   `json:"description"`
}

Directories

Path Synopsis
api module

Jump to

Keyboard shortcuts

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