manychatgosdk

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 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/manychat-go-sdk
package main

import (
    "manychat-sdk/manychat/api"
    . "manychat-sdk/manychat/dynamic_block"
    "net/http"
)
Client initialization and create first request
client := api.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 := api.SendingSendContentRequest{
    SubscriberId: 12345,
    Data: dynamicBlock,
    MessageTag: api.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 := api.SendingSendContentRequest{
    SubscriberId: 12345,
    Data: dynamicBlock,
    MessageTag: api.MessageTagAccountUpdate,
}

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

Building 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)
Adding Buttons to a Message
button := client.DynamicBlock.Buttons.BuildUrlButton("Click", "https://domain.com", WebViewSizeFull)
message.AddButton(button)

see other Buttons

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

see other Actions

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

see 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

This section is empty.

Types

type Action

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

type ActionBuilder struct{}

func (*ActionBuilder) BuildAddTagAction

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

func (*ActionBuilder) BuildRemoveTagAction

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

func (*ActionBuilder) BuildSetFieldValueAction

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

func (*ActionBuilder) BuildUnsetFieldValueAction

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

type AddSubscriberTagByNameRequest

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

type AddSubscriberTagRequest

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

type BotField

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

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

func (*BotFieldService) CreateBotField

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

func (*BotFieldService) GetBotFields

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

func (*BotFieldService) SetBotField

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

func (*BotFieldService) SetBotFieldByName

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

func (*BotFieldService) SetBotFields

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

func (*BotFieldService) SetCustomFields

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

type BotFieldType

type BotFieldType DataType

type Button

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

type ButtonsBuilder struct{}

func (*ButtonsBuilder) BuildBuyButton

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

func (*ButtonsBuilder) BuildCallButton

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

func (*ButtonsBuilder) BuildCallbackButton

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

func (*ButtonsBuilder) BuildFlowButton

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

func (*ButtonsBuilder) BuildNodeButton

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

func (*ButtonsBuilder) BuildUrlButton

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

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

type CreateSubscriberRequest

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

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

type CustomField

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

type CustomFieldService

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

func (*CustomFieldService) CreateCustomField

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

func (*CustomFieldService) GetCustomFields

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

type Customer

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

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

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

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

func (*DynamicBlock) AddActions

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

func (*DynamicBlock) AddMessage

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

func (*DynamicBlock) AddMessages

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

func (*DynamicBlock) AddQuickReplies

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

func (*DynamicBlock) AddQuickReply

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

type DynamicBlockBuilder

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

func NewDynamicBlockBuilder

func NewDynamicBlockBuilder() *DynamicBlockBuilder

func (*DynamicBlockBuilder) BuildDynamicBlock

func (builder *DynamicBlockBuilder) BuildDynamicBlock() *DynamicBlock

type ExternalMessage

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

type ExternalMessageBuilder struct{}

func (*ExternalMessageBuilder) BuildExternalMessage

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

type FindSubscriberByCustomFieldRequest

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

type FindSubscriberByEmailRequest

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

type FindSubscriberByNameRequest

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

type FindSubscriberByPhoneRequest

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

type Flow

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

type FlowService

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

func (*FlowService) GetFlows

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

type Flows

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

type Folder

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

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

func (*Gallery) GetImageAspectRation

func (gallery *Gallery) GetImageAspectRation() string

func (*Gallery) SetImageAspectRation

func (gallery *Gallery) SetImageAspectRation(imageAspectRatio string)

type GalleryBuilder

type GalleryBuilder struct{}

func (*GalleryBuilder) NewGallery

func (builder *GalleryBuilder) NewGallery() *Gallery

type GalleryCard

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

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

type GetSubscriberInfoRequest

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

type GrowthTool

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

type GrowthToolsService

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

func (*GrowthToolsService) GetGrowthTools

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

type Message

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

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

func (*Message) AddButtons

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

type MessageBuilder

type MessageBuilder struct{}

func (*MessageBuilder) BuildAudioMessage

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

func (*MessageBuilder) BuildFileMessage

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

func (*MessageBuilder) BuildGalleryMessage

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

func (*MessageBuilder) BuildImageMessage

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

func (*MessageBuilder) BuildTextMessage

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

func (*MessageBuilder) BuildVideoMessage

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

type OtnTopic

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

type OtnTopicService

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

func (*OtnTopicService) GetOtnTopics

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

type Page

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

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

func (*PageService) GetInfo

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

type Product

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

type QuickReply

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

type QuickReplyBuilder struct{}

func (*QuickReplyBuilder) BuildDynamicBlockCallbackQuickReply

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

func (*QuickReplyBuilder) BuildFlowQuickReply

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

func (*QuickReplyBuilder) BuildNodeQuickReply

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

type RateLimit

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

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

type RemoveSubscriberTagRequest

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

type RemoveTagByNameRequest

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

type RemoveTagRequest

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

type SendingSendContentByUserRefRequest

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

type SendingSendContentRequest

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

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

type SendingService

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

func (*SendingService) SendContent

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

func (*SendingService) SendContentByUserRef

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

func (*SendingService) SendFlow

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

type SetBotFieldByNameRequest

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

type SetBotFieldRequest

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

type SetBotFieldsItem

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

type SetBotFieldsRequest

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

type SetCustomFieldsItem

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

type SetCustomFieldsRequest

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

type SetSubscriberCustomFieldByNameRequest

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

type SetSubscriberCustomFieldRequest

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

type Subscriber

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

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

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

type SubscriberService

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

func (*SubscriberService) AddTag

func (*SubscriberService) AddTagByName

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

func (*SubscriberService) CreateSubscriber

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

func (*SubscriberService) FindByCustomField

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

func (*SubscriberService) FindByEmail

func (*SubscriberService) FindByName

func (*SubscriberService) FindByPhone

func (*SubscriberService) GetInfo

func (*SubscriberService) GetInfoByUserRef

func (*SubscriberService) RemoveTag

func (*SubscriberService) RemoveTagByName

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

func (*SubscriberService) SetCustomField

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

func (*SubscriberService) SetCustomFieldByName

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

func (*SubscriberService) UpdateSubscriber

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

func (*SubscriberService) VerifyBySignedRequest

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

type SubscriberShopifyField

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

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

type Tag

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

type TagService

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

func (*TagService) CreateTag

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

func (*TagService) GetTags

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

func (*TagService) RemoveTag

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

func (*TagService) RemoveTagByName

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

type UpdateSubscriberRequest

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

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

Jump to

Keyboard shortcuts

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