conversation

package
v0.0.0-...-421306c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package conversation provides an interface to the Conversations API. The API's docs are located here: https://developers.messagebird.com/docs/conversations. The api.go file contains the structs returned by the API, and the other files provide the functionality needed to send requests, as well as any structs required for that - e.g. request data or pagination options.

Index

Constants

View Source
const (
	WebhookEventConversationCreated WebhookEvent = "conversation.created"
	WebhookEventConversationUpdated WebhookEvent = "conversation.updated"
	WebhookEventMessageCreated      WebhookEvent = "message.created"
	WebhookEventMessageUpdated      WebhookEvent = "message.updated"
	// WebhookStatusEnabled indictates that the webhook is enabled.
	WebhookStatusEnabled WebhookStatus = "enabled"
	// WebhookStatusDisabled indictates that the webhook is disabled.
	WebhookStatusDisabled WebhookStatus = "disabled"
)

Variables

This section is empty.

Functions

func DeleteWebhook

func DeleteWebhook(c messagebird.Client, id string) error

DeleteWebhook ensures an existing webhook is deleted and no longer triggered. If the error is nil, the deletion was successful.

Types

type Audio

type Audio Media

type Channel

type Channel struct {
	ID              string
	Name            string
	PlatformID      string
	Status          string
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
}

type Contact

type Contact struct {
	ID              string
	Href            string
	MSISDN          string
	FirstName       string
	LastName        string
	CustomDetails   map[string]interface{}
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
}

func (*Contact) UnmarshalJSON

func (c *Contact) UnmarshalJSON(data []byte) error

UnmarshalJSON is used to unmarshal the MSISDN to a string rather than an int64. The API returns integers, but this client always uses strings. Exposing a json.Number doesn't seem nice.

type Conversation

type Conversation struct {
	ID                   string
	ContactID            string
	Contact              *Contact
	Channels             []*Channel
	Status               Status
	CreatedDatetime      time.Time
	UpdatedDatetime      *time.Time
	LastReceivedDatetime *time.Time
	LastUsedChannelID    string

	Messages *MessagesCount
	// contains filtered or unexported fields
}

func Read

func Read(c messagebird.Client, id string) (*Conversation, error)

Read fetches a single Conversation based on its ID.

func Start

Start creates a conversation by sending an initial message. If an active conversation exists for the recipient, it is resumed.

func Update

func Update(c messagebird.Client, id string, req *UpdateRequest) (*Conversation, error)

Update changes the conversation's status, so this can be used to (un)archive conversations.

type Conversations

type Conversations struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Items      []*Conversation
}

func List

func List(c messagebird.Client, options *ListRequest) (*Conversations, error)

List gets a collection of Conversations. Pagination can be set in options.

type ConversationsByContact

type ConversationsByContact struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Items      []*string // array of conversation IDs
}

func ListByContact

func ListByContact(c messagebird.Client, contactId string, options *messagebird.PaginationRequest) (*ConversationsByContact, error)

ListByContact fetches a collection of Conversations of a specific MessageBird contact ID.

type Email

type Email struct {
	Id                   string              `json:"id"`
	To                   []*EmailRecipient   `json:"to"`
	From                 *EmailRecipient     `json:"from"`
	Subject              string              `json:"subject"`
	Content              *EmailContent       `json:"content"`
	ReplyTo              string              `json:"replyTo,omitempty"`
	ReturnPath           string              `json:"returnPath,omitempty"`
	Headers              interface{}         `json:"headers,omitempty"`
	Tracking             *EmailTracking      `json:"tracking,omitempty"`
	ReportUrl            string              `json:"reportUrl,omitempty"`
	PerformSubstitutions bool                `json:"performSubstitutions,omitempty"`
	Attachments          []*EmailAttachment  `json:"attachments,omitempty"`
	InlineImages         []*EmailInlineImage `json:"inlineImages,omitempty"`
}

Email https://developers.messagebird.com/api/conversations/#email-object

type EmailAttachment

type EmailAttachment struct {
	Id     string `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	Type   string `json:"type,omitempty"`
	URL    string `json:"URL,omitempty"`
	Length int    `json:"length,omitempty"`
}

EmailAttachment The Attachment object represents a file attached to a particular message. The maximum attachment size is 20 MB. https://developers.messagebird.com/api/conversations/#emailattachment-object

type EmailContent

type EmailContent struct {
	Html string `json:"html,omitempty"`
	Text string `json:"text,omitempty"`
}

EmailContent https://developers.messagebird.com/api/conversations/#emailcontent-object

type EmailInlineImage

type EmailInlineImage struct {
	Id        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	Type      string `json:"type,omitempty"`
	URL       string `json:"URL,omitempty"`
	Length    int    `json:"length,omitempty"`
	ContentId string `json:"contentId,omitempty"`
}

EmailInlineImage https://developers.messagebird.com/api/conversations/#emailinlineimage-object

type EmailRecipient

type EmailRecipient struct {
	Address   string                   `json:"address"`
	Name      string                   `json:"name,omitempty"`
	Variables *EmailRecipientVariables `json:"variables,omitempty"`
}

EmailRecipient https://developers.messagebird.com/api/conversations/#emailrecipient-object

type EmailRecipientVariables

type EmailRecipientVariables struct {
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
}

type EmailTracking

type EmailTracking struct {
	Open  bool `json:"open"`
	Click bool `json:"click"`
}

EmailTracking https://developers.messagebird.com/api/conversations/#emailtracking-object

type FacebookAttachment

type FacebookAttachment struct {
	Type    FacebookAttachmentType     `json:"type"`
	Payload *FacebookAttachmentPayload `json:"payload"`
}

FacebookAttachment https://developers.messagebird.com/api/conversations/#facebookattachment-object

type FacebookAttachmentPayload

type FacebookAttachmentPayload struct {
	Url              string                    `json:"url,omitempty"`
	IsReusable       bool                      `json:"is_reusable"`
	AttachmentId     string                    `json:"attachment_id,omitempty"`
	TemplateType     FacebookTemplateType      `json:"template_type,omitempty"`
	Elements         []*FacebookElement        `json:"elements,omitempty"`
	ImageAspectRatio *FacebookImageAspectRatio `json:"image_aspect_ratio,omitempty"`
}

FacebookAttachmentPayload https://developers.messagebird.com/api/conversations/#facebookattachmentpayload-object

type FacebookAttachmentType

type FacebookAttachmentType string
const (
	FBAttachmentTypeImage    FacebookAttachmentType = "image"
	FBAttachmentTypeAudio    FacebookAttachmentType = "audio"
	FBAttachmentTypeVideo    FacebookAttachmentType = "video"
	FBAttachmentTypeFile     FacebookAttachmentType = "file"
	FBAttachmentTypeLocation FacebookAttachmentType = "location"
	FBAttachmentTypeFallback FacebookAttachmentType = "fallback"
	FBAttachmentTypeTemplate FacebookAttachmentType = "template"
)

type FacebookButton

type FacebookButton struct {
	Type    FacebookButtonType `json:"type"`
	Url     string             `json:"url"`
	Title   string             `json:"title"`
	Payload string             `json:"payload"`
}

FacebookButton https://developers.messagebird.com/api/conversations/#facebookbutton-object

type FacebookButtonType

type FacebookButtonType string
const (
	FBButtonTypeWebUrl      FacebookButtonType = "web_url"
	FBButtonTypePhoneNumber FacebookButtonType = "phone_number"
	FBButtonTypePostback    FacebookButtonType = "postback"
)

type FacebookElement

type FacebookElement struct {
	MediaType     FacebookElementMediaType `json:"media_type"`
	AttachmentId  string                   `json:"attachment_id,omitempty"`
	MediaUrl      string                   `json:"media_url,omitempty"`
	Buttons       []*FacebookButton        `json:"buttons,omitempty"`
	Title         string                   `json:"title,omitempty"`
	Subtitle      string                   `json:"subtitle,omitempty"`
	DefaultAction *FacebookButton          `json:"default_action,omitempty"`
	ImageUrl      string                   `json:"image_url,omitempty"`
}

FacebookElement https://developers.messagebird.com/api/conversations/#facebookelement-object

type FacebookElementMediaType

type FacebookElementMediaType string
const (
	FBElementMediaTypeVideo FacebookElementMediaType = "video"
	FBElementMediaTypeImage FacebookElementMediaType = "image"
)

type FacebookImageAspectRatio

type FacebookImageAspectRatio string

FacebookImageAspectRatio https://developers.messagebird.com/api/conversations/#facebookimageaspectratio-object

const (
	FBImageAspectRatioHorizontal FacebookImageAspectRatio = "horizontal"
	FBImageAspectRatioSquare     FacebookImageAspectRatio = "square"
)

type FacebookMessage

type FacebookMessage struct {
	Text         string                `json:"text,omitempty"`
	Attachment   *FacebookAttachment   `json:"attachment,omitempty"`
	QuickReplies []*FacebookQuickReply `json:"quick_replies,omitempty"`
}

FacebookMessage https://developers.messagebird.com/api/conversations/#facebookmessage-object

type FacebookQuickReply

type FacebookQuickReply struct {
	ContentType FacebookQuickReplyContentType `json:"content_type"`
	Title       string                        `json:"title"`
	Payload     string                        `json:"payload"`
	ImageUrl    string                        `json:"image_url"`
}

FacebookQuickReply https://developers.messagebird.com/api/conversations/#facebookquickreply-object

type FacebookQuickReplyContentType

type FacebookQuickReplyContentType string

FacebookQuickReplyContentType https://developers.messagebird.com/api/conversations/#facebookquickreplycontenttype-object

const (
	FBQuickReplyContentTypeText            FacebookQuickReplyContentType = "text"
	FBQuickReplyContentTypeUserPhoneNumber FacebookQuickReplyContentType = "user_phone_number"
	FBQuickReplyContentTypeUserEmail       FacebookQuickReplyContentType = "user_email"
)

type FacebookTemplateType

type FacebookTemplateType string
const (
	FBTemplateTypeMedia   FacebookTemplateType = "media"
	FBTemplateTypeGeneric FacebookTemplateType = "generic"
)

type Fallback

type Fallback struct {
	From  string `json:"from"`
	After string `json:"after"`
}

type File

type File Media

type HSM

type HSM struct {
	Namespace             string                     `json:"namespace"`
	TemplateName          string                     `json:"templateName"`
	Language              *HSMLanguage               `json:"language"`
	LocalizableParameters []*HSMLocalizableParameter `json:"params"`
}

HSM is a pre-approved, reusable message template required when messaging over WhatsApp. It allows you to just send the required parameter values instead of the full message. It also allows for localization of the message and decreases the possibility of being blocked on the first contact as the message is pre-approved by WhatsApp.

type HSMLanguage

type HSMLanguage struct {
	Policy HSMLanguagePolicy `json:"policy"`

	// Code can be both language and language_locale formats (e.g. en and
	// en_US).
	Code string `json:"code"`
}

HSMLanguage is used to set the message's locale.

type HSMLanguagePolicy

type HSMLanguagePolicy string

HSMLanguagePolicy sets how the provided language is enforced.

const (
	// HSMLanguagePolicyFallback will deliver the message template in the
	// user's device language. If the settings can't be found on the user's
	// device the fallback language is used.
	HSMLanguagePolicyFallback HSMLanguagePolicy = "fallback"

	// HSMLanguagePolicyDeterministic will deliver the message template
	// exactly in the language and locale asked for.
	HSMLanguagePolicyDeterministic HSMLanguagePolicy = "deterministic"
)

type HSMLocalizableParameter

type HSMLocalizableParameter struct {
	Default  string                           `json:"default"`
	Currency *HSMLocalizableParameterCurrency `json:"currency,omitempty"`
	DateTime *time.Time                       `json:"dateTime,omitempty"`
}

HSMLocalizableParameter are used to replace the placeholders in the message template. They will be localized by WhatsApp. Default values are used when localization fails. Default is required. Additionally, currency OR DateTime may be present in a request.

func CurrencyLocalizableHSMParameter

func CurrencyLocalizableHSMParameter(d string, code string, amount int64) *HSMLocalizableParameter

CurrencyLocalizableHSMParameter gets a parameter that localizes a currency. Code is the currency code in ISO 4217 format and amount is the total amount, including cents, multiplied by 1000. E.g. 12.34 becomes 12340.

func DateTimeLocalizableHSMParameter

func DateTimeLocalizableHSMParameter(d string, dateTime time.Time) *HSMLocalizableParameter

DateTimeLocalizableHSMParameter gets a parameter that localizes a DateTime.

func DefaultLocalizableHSMParameter

func DefaultLocalizableHSMParameter(d string) *HSMLocalizableParameter

DefaultLocalizableHSMParameter gets a simple parameter with a default value that will do a simple string replacement.

type HSMLocalizableParameterCurrency

type HSMLocalizableParameterCurrency struct {
	// Code is the currency code in ISO 4217 format.
	Code string `json:"currencyCode"`

	// Amount is the total amount, including cents, multiplied by 1000. E.g.
	// 12.34 become 12340.
	Amount int64 `json:"amount"`
}

type Image

type Image Media

type ListByContactRequest

type ListByContactRequest struct {
	messagebird.PaginationRequest
	Id     string
	Status *Status
}

func (*ListByContactRequest) QueryParams

func (lr *ListByContactRequest) QueryParams() string

type ListConversationMessagesRequest

type ListConversationMessagesRequest struct {
	messagebird.PaginationRequest
	ExcludePlatforms string
}

func (*ListConversationMessagesRequest) QueryParams

func (lr *ListConversationMessagesRequest) QueryParams() string

type ListMessagesRequest

type ListMessagesRequest struct {
	Ids  string
	From *time.Time
}

func (*ListMessagesRequest) QueryParams

func (lr *ListMessagesRequest) QueryParams() string

type ListRequest

type ListRequest struct {
	messagebird.PaginationRequest
	Ids    string
	Status *Status
}

ListRequest retrieves all conversations sorted by the lastReceivedDatetime field so that all conversations with new messages appear first.

func (*ListRequest) QueryParams

func (lr *ListRequest) QueryParams() string

type Location

type Location struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

type Media

type Media struct {
	URL     string `json:"url"`
	Caption string `json:"caption,omitempty"`
}

type Message

type Message struct {
	ID              string
	ConversationID  string
	ChannelID       string
	Platform        string
	To              MessageRecipient
	From            string
	Direction       MessageDirection
	Status          MessageStatus
	Type            MessageType
	Content         *MessageContent
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
	Source          map[string]interface{}
	Tag             MessageTag
	Fallback        *Fallback
	TTL             string
}

func ReadMessage

func ReadMessage(c messagebird.Client, messageID string) (*Message, error)

ReadMessage gets a single message based on its ID.

func Reply

func Reply(c messagebird.Client, conversationID string, req *ReplyRequest) (*Message, error)

Reply Send a new message to an existing conversation. In case the conversation is archived, a new conversation is created.

func SendMessage

func SendMessage(c messagebird.Client, options *SendMessageRequest) (*Message, error)

SendMessage send a message to a specific recipient in a specific platform. If an active conversation already exists for the recipient, the conversation will be resumed. In case there's no active conversation a new one is created.

type MessageContent

type MessageContent struct {
	Audio    *Audio    `json:"audio,omitempty"`
	File     *File     `json:"file,omitempty"`
	Image    *Image    `json:"image,omitempty"`
	Location *Location `json:"location,omitempty"`
	Video    *Video    `json:"video,omitempty"`
	Text     string    `json:"text,omitempty"`

	// HSM is a highly structured message for WhatsApp. Its definition lives in
	// hsm.go.
	HSM *HSM `json:"hsm,omitempty"`

	Interactive     *WhatsAppInteractive `json:"interactive,omitempty"`
	WhatsAppSticker *WhatsAppSticker     `json:"whatsappSticker,omitempty"`
	WhatsAppOrder   *WhatsAppOrder       `json:"whatsappOrder,omitempty"`
	WhatsAppText    *WhatsAppText        `json:"whatsappText,omitempty"`

	FacebookQuickReply      *FacebookMessage `json:"facebookQuickReply,omitempty"`
	FacebookMediaTemplate   *FacebookMessage `json:"facebookMediaTemplate,omitempty"`
	FacebookGenericTemplate *FacebookMessage `json:"facebookGenericTemplate,omitempty"`

	Email               *Email   `json:"email,omitempty"`
	ExternalAttachments []*Media `json:"externalAttachments,omitempty"`
	DisableUrlPreview   bool     `json:"disableUrlPreview,omitempty"`
}

MessageContent holds a message's actual content. Only one field can be set per request.

type MessageCreateRequest

type MessageCreateRequest struct {
	ChannelID string          `json:"channelid"`
	Content   *MessageContent `json:"content"`
	Type      MessageType     `json:"type"`
}

type MessageDirection

type MessageDirection string
const (
	// MessageDirectionReceived indicates an inbound message received from the customer.
	MessageDirectionReceived MessageDirection = "received"

	// MessageDirectionSent indicates an outbound message sent from the API.
	MessageDirectionSent MessageDirection = "sent"
)

type MessageList

type MessageList struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Items      []*Message
}

func ListConversationMessages

func ListConversationMessages(c messagebird.Client, conversationID string, options *ListConversationMessagesRequest) (*MessageList, error)

ListConversationMessages gets a collection of messages from a conversation. Pagination can be set in the options.

func ListMessages

func ListMessages(c messagebird.Client, options *ListMessagesRequest) (*MessageList, error)

ListMessages gets a collection of messages from a conversation. Pagination can be set in the options.

type MessageRecipient

type MessageRecipient string

type MessageStatus

type MessageStatus string

MessageStatus is a field set by the API. It indicates what the state of the message is, e.g. whether it has been successfully delivered or read.

const (
	MessageStatusAccepted        MessageStatus = "accepted"
	MessageStatusPending         MessageStatus = "pending"
	MessageStatusSent            MessageStatus = "sent"
	MessageStatusRejected        MessageStatus = "rejected"
	MessageStatusFailed          MessageStatus = "failed"
	MessageStatusRead            MessageStatus = "read"
	MessageStatusReceived        MessageStatus = "received"
	MessageStatusDeleted         MessageStatus = "deleted"
	MessageStatusUnknown         MessageStatus = "unknown"
	MessageStatusTransmitted     MessageStatus = "transmitted"
	MessageStatusDeliveryFailed  MessageStatus = "delivery_failed"
	MessageStatusBuffered        MessageStatus = "buffered"
	MessageStatusExpired         MessageStatus = "expired"
	MessageStatusClicked         MessageStatus = "clicked"
	MessageStatusOpened          MessageStatus = "opened"
	MessageStatusBounce          MessageStatus = "bounce"
	MessageStatusSpamComplaint   MessageStatus = "spam_complaint"
	MessageStatusOutOfBounded    MessageStatus = "out_of_bounded"
	MessageStatusDelayed         MessageStatus = "delayed"
	MessageStatusListUnsubscribe MessageStatus = "list_unsubscribe"
	MessageStatusDispatched      MessageStatus = "dispatched"
)

type MessageTag

type MessageTag string

type MessageType

type MessageType string

MessageType indicates what kind of content a Message has, e.g. audio or text.

const (
	MessageTypeText     MessageType = "text"
	MessageTypeImage    MessageType = "image"
	MessageTypeVideo    MessageType = "video"
	MessageTypeAudio    MessageType = "audio"
	MessageTypeFile     MessageType = "file"
	MessageTypeLocation MessageType = "location"
	MessageTypeEvent    MessageType = "event"
	MessageTypeRich     MessageType = "rich"
	MessageTypeMenu     MessageType = "menu"
	MessageTypeButtons  MessageType = "buttons"
	MessageTypeLink     MessageType = "link"

	MessageTypeHSM             MessageType = "hsm"
	MessageTypeWhatsAppSticker MessageType = "whatsappSticker"
	MessageTypeInteractive     MessageType = "interactive"
	MessageTypeWhatsappOrder   MessageType = "whatsappOrder"
	MessageTypeWhatsappText    MessageType = "whatsappText"

	MessageTypeExternalAttachment MessageType = "externalAttachment"
	MessageTypeEmail              MessageType = "email"
)

type MessagesCount

type MessagesCount struct {
	HRef          string
	TotalCount    int
	LastMessageId string
}

type Platform

type Platform string

type ReplyRequest

type ReplyRequest struct {
	Type      MessageType            `json:"type"`
	Content   *MessageContent        `json:"content"`
	ChannelID string                 `json:"channelId,omitempty"`
	Fallback  *Fallback              `json:"fallback,omitempty"`
	Source    map[string]interface{} `json:"source,omitempty"`
	EventType string                 `json:"eventType,omitempty"`
	ReportUrl string                 `json:"reportUrl,omitempty"`
	Tag       MessageTag             `json:"tag,omitempty"`
	TrackId   string                 `json:"trackId,omitempty"`
	TTL       string                 `json:"ttl,omitempty"`
}

ReplyRequest contains the request data for the Reply endpoint.

type SendMessageRequest

type SendMessageRequest struct {
	To        string                 `json:"to"`
	From      string                 `json:"from"`
	Type      MessageType            `json:"type"`
	Content   *MessageContent        `json:"content"`
	ReportUrl string                 `json:"reportUrl,omitempty"`
	Fallback  *Fallback              `json:"fallback,omitempty"`
	Source    map[string]interface{} `json:"source,omitempty"`
	Tag       MessageTag             `json:"tag,omitempty"`
	TrackId   string                 `json:"trackId,omitempty"`
	TTL       string                 `json:"ttl,omitempty"`
}

SendMessageRequest contains the request data for the Reply endpoint.

type StartRequest

type StartRequest struct {
	ChannelID string                 `json:"channelId"`
	Content   *MessageContent        `json:"content"`
	To        MessageRecipient       `json:"to"`
	Type      MessageType            `json:"type"`
	Source    map[string]interface{} `json:"source,omitempty"`
	ReportUrl string                 `json:"reportUrl,omitempty"`
	Tag       MessageTag             `json:"tag,omitempty"`
	TrackId   string                 `json:"trackId,omitempty"`
	EventType string                 `json:"eventType,omitempty"`
	TTL       string                 `json:"ttl,omitempty"`
}

StartRequest contains the request data for the Start endpoint.

type Status

type Status string

Status indicates what state a Conversation is in.

const (
	// ConversationStatusActive is returned when the Conversation is active.
	// Only one active conversation can ever exist for a given contact.
	ConversationStatusActive Status = "active"

	// ConversationStatusArchived is returned when the Conversation is
	// archived. When this is the case, a new Conversation is created when a
	// message is received from a contact.
	ConversationStatusArchived Status = "archived"
)

type UpdateRequest

type UpdateRequest struct {
	Status Status `json:"status"`
}

UpdateRequest contains the request data for the Update endpoint.

type Video

type Video Media

type Webhook

type Webhook struct {
	ID              string
	ChannelID       string
	Events          []WebhookEvent
	URL             string
	Status          WebhookStatus
	CreatedDatetime *time.Time
	UpdatedDatetime *time.Time
	Settings        *WebhookSettings
}

func CreateWebhook

func CreateWebhook(c messagebird.Client, req *WebhookCreateRequest) (*Webhook, error)

CreateWebhook registers a webhook that is invoked when something interesting happens.

func ReadWebhook

func ReadWebhook(c messagebird.Client, id string) (*Webhook, error)

ReadWebhook gets a single webhook based on its ID.

func UpdateWebhook

func UpdateWebhook(c messagebird.Client, id string, req *WebhookUpdateRequest) (*Webhook, error)

UpdateWebhook updates a single webhook based on its ID with any values set in WebhookUpdateRequest. Do not set any values that should not be updated.

type WebhookCreateRequest

type WebhookCreateRequest struct {
	ChannelID string           `json:"channelId,omitempty"`
	Events    []WebhookEvent   `json:"events"`
	URL       string           `json:"url"`
	Settings  *WebhookSettings `json:"settings,omitempty"`
}

type WebhookEvent

type WebhookEvent string

type WebhookList

type WebhookList struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Items      []*Webhook
}

func ListWebhooks

func ListWebhooks(c messagebird.Client, options *messagebird.PaginationRequest) (*WebhookList, error)

ListWebhooks gets a collection of webhooks. Pagination can be set in options.

type WebhookSettings

type WebhookSettings struct {
	ExpectedHttpCode string                 `json:"expected_http_code"`
	Headers          map[string]interface{} `json:"headers"`
	Username         string                 `json:"username"`
	Password         string                 `json:"password"`
	QueryParams      string                 `json:"query_params"`
	Retry            int                    `json:"retry"`
	Timeout          int                    `json:"timeout"`
}

type WebhookStatus

type WebhookStatus string

WebhookStatus indicates what state a Webhook is in. At the moment there are only 2 statuses; enabled or disabled.

type WebhookUpdateRequest

type WebhookUpdateRequest struct {
	Events   []WebhookEvent   `json:"events,omitempty"`
	URL      string           `json:"url,omitempty"`
	Status   WebhookStatus    `json:"status,omitempty"`
	Settings *WebhookSettings `json:"settings,omitempty"`
}

type WhatsAppContext

type WhatsAppContext struct {
	Id              string                   `json:"id"`
	From            string                   `json:"from"`
	ReferredProduct *WhatsAppReferredProduct `json:"referred_product"`
}

WhatsAppContext https://developers.messagebird.com/api/conversations/#whatsappcontext-object

type WhatsAppInteractive

type WhatsAppInteractive struct {
	Type   WhatsAppInteractiveType    `json:"type"`
	Header *WhatsAppInteractiveHeader `json:"header"`
	Body   *WhatsAppInteractiveBody   `json:"body"`
	Action *WhatsAppInteractiveAction `json:"action"`
	Footer *WhatsAppInteractiveFooter `json:"footer,omitempty"`
	Reply  *WhatsAppInteractiveReply  `json:"reply,omitempty"`
}

WhatsAppInteractive https://developers.messagebird.com/api/conversations/#whatsappinteractive-object

type WhatsAppInteractiveAction

type WhatsAppInteractiveAction struct {
	CatalogId         string                        `json:"catalog_id"`
	ProductRetailerId string                        `json:"product_retailer_id"`
	Sections          []*WhatsAppInteractiveSection `json:"sections"`
	Button            string                        `json:"button"`
	Buttons           *WhatsAppInteractiveButton    `json:"buttons"`
}

WhatsAppInteractiveAction https://developers.messagebird.com/api/conversations/#whatsappinteractiveaction-object

type WhatsAppInteractiveBody

type WhatsAppInteractiveBody struct {
	Text string `json:"text"`
}

WhatsAppInteractiveBody https://developers.messagebird.com/api/conversations/#whatsappinteractivebody-object

type WhatsAppInteractiveButton

type WhatsAppInteractiveButton struct {
	Id       string `json:"id"`
	Type     string `json:"type"`
	Title    string `json:"title"`
	ImageUrl string `json:"image_url,omitempty"`
}

WhatsAppInteractiveButton https://developers.messagebird.com/api/conversations/#whatsappinteractivebutton-object

type WhatsAppInteractiveFooter

type WhatsAppInteractiveFooter struct {
	Text string `json:"text"`
}

WhatsAppInteractiveFooter https://developers.messagebird.com/api/conversations/#whatsappinteractivefooter-object

type WhatsAppInteractiveHeader

type WhatsAppInteractiveHeader struct {
	Type     WhatsAppInteractiveHeaderType `json:"type"`
	Text     string                        `json:"text"`
	Video    *Media                        `json:"video"`
	Image    *Media                        `json:"image"`
	Document *Media                        `json:"document"`
}

WhatsAppInteractiveHeader https://developers.messagebird.com/api/conversations/#whatsappinteractiveheader-object

type WhatsAppInteractiveHeaderType

type WhatsAppInteractiveHeaderType string

WhatsAppInteractiveHeaderType https://developers.messagebird.com/api/conversations/#whatsappinteractiveheadertype-object

const (
	WAIHeaderTypeText     WhatsAppInteractiveHeaderType = "text"
	WAIHeaderTypeVideo    WhatsAppInteractiveHeaderType = "video"
	WAIHeaderTypeImage    WhatsAppInteractiveHeaderType = "image"
	WAIHeaderTypeDocument WhatsAppInteractiveHeaderType = "document"
)

type WhatsAppInteractiveProduct

type WhatsAppInteractiveProduct struct {
	ProductRetailerId string `json:"product_retailer_id"`
}

type WhatsAppInteractiveReply

type WhatsAppInteractiveReply struct {
	Id          string `json:"id"`
	Text        string `json:"text"`
	Description string `json:"description,omitempty"`
}

WhatsAppInteractiveReply https://developers.messagebird.com/api/conversations/#whatsappinteractivereply-object

type WhatsAppInteractiveSection

type WhatsAppInteractiveSection struct {
	Title        string                           `json:"title"`
	Rows         []*WhatsAppInteractiveSectionRow `json:"rows"`
	ProductItems []*WhatsAppInteractiveProduct    `json:"product_items"`
}

WhatsAppInteractiveSection https://developers.messagebird.com/api/conversations/#whatsappinteractivesection-object

type WhatsAppInteractiveSectionRow

type WhatsAppInteractiveSectionRow struct {
	Id          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
}

type WhatsAppInteractiveType

type WhatsAppInteractiveType string

WhatsAppInteractiveType https://developers.messagebird.com/api/conversations/#whatsappinteractivetype-object

const (
	WAITypeList        WhatsAppInteractiveType = "list"
	WAITypeButton      WhatsAppInteractiveType = "button"
	WAITypeProduct     WhatsAppInteractiveType = "product"
	WAITypeProductList WhatsAppInteractiveType = "product_list"
	WAITypeButtonReply WhatsAppInteractiveType = "button_reply"
)

type WhatsAppOrder

type WhatsAppOrder struct {
	CatalogId    string                  `json:"catalog_id"`
	ProductItems []*WhatsAppOrderProduct `json:"product_items"`
	Text         string                  `json:"text"`
}

WhatsAppOrder https://developers.messagebird.com/api/conversations/#whatsapporder-object

type WhatsAppOrderProduct

type WhatsAppOrderProduct struct {
	ProductRetailerId string `json:"product_retailer_id"`
	Quantity          int    `json:"quantity"`
	ItemPrice         string `json:"item_price"`
	Currency          string `json:"currency"`
}

WhatsAppOrderProduct https://developers.messagebird.com/api/conversations/#whatsapporderproduct-object

type WhatsAppReferredProduct

type WhatsAppReferredProduct struct {
	CatalogId         string `json:"catalog_id"`
	ProductRetailerId string `json:"product_retailer_id"`
}

WhatsAppReferredProduct https://developers.messagebird.com/api/conversations/#whatsappreferredproduct-object

type WhatsAppSticker

type WhatsAppSticker struct {
	Link string `json:"link"`
}

WhatsAppSticker URL of the sticker image. The format must be image/webp and the maximum size is 100 KB.

type WhatsAppText

type WhatsAppText struct {
	Text    *WhatsAppTextBody `json:"text"`
	Context *WhatsAppContext  `json:"context"`
}

WhatsAppText https://developers.messagebird.com/api/conversations/#whatsapptext-object

type WhatsAppTextBody

type WhatsAppTextBody struct {
	Body string `json:"body"`
}

WhatsAppTextBody https://developers.messagebird.com/api/conversations/#whatsapptextbody-object

Jump to

Keyboard shortcuts

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