gowebengage

package module
v0.0.0-...-4bb35a5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 4 Imported by: 0

README

Webengage Golang SDK

Introduction

This SDK allows you to integrate WebEngage with your Golang application. Using this SDK, you can track user events, send transactional events, and more. You can also use this SDK to trigger campaigns and track user activity in your application.
The SDK is built using the WebEngage REST APIs. You can check the source document here.

Installation

To install the WebEngage Golang SDK, run the following command:

go get github.com/n25a/gowebengage

Usage

To use the WebEngage Golang SDK, you need to import the package and initialize the client.

package main

import (
    "github.com/n25a/gowebengage"
)

func main() {
    // Initialize the client
    client := gowebengage.NewClient("YOUR_WEBENGAGE_ADDRESS", "PROXY_ADDRESS", "USER_AGENT")
}

If you don't have a proxy, you can initialize the client without the proxy address and give empty string as the second parameter.


for more information about all functions and how to use them, please check `Webengage` interface in `client.go` file.  

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventRequest

type EventRequest struct {
	UserID    string                 `json:"userId"`
	EventName string                 `json:"eventName"`
	EventTime string                 `json:"eventTime"`
	EventData map[string]interface{} `json:"eventData"`
}

type SurveyResponse

type SurveyResponse struct {
	Response struct {
		Data    map[string]interface{} `json:"data"`
		Message string                 `json:"message"`
		Status  string                 `json:"status"`
	} `json:"response"`
}

type TransactionalCampaignMessagesRequest

type TransactionalCampaignMessagesRequest struct {
	TTL          int    `json:"ttl"`
	UserId       string `json:"userId"`
	OverrideData struct {
		Context struct {
			Token map[string]interface{} `json:"token"`
		} `json:"context"`
	} `json:"overrideData"`
}

func (*TransactionalCampaignMessagesRequest) SetData

func (t *TransactionalCampaignMessagesRequest) SetData(ttl int, userID string, token map[string]interface{})

type TransactionalCampaignMessagesResponse

type TransactionalCampaignMessagesResponse struct {
	Response struct {
		Data struct {
			TxnID        string `json:"txnId"`
			ExperimentID string `json:"experimentId"`
			UserID       string `json:"userId"`
			TTL          int    `json:"ttl"`
		} `json:"data"`
	} `json:"response"`
}

type UserRequest

type UserRequest struct {
	UserID     string                 `json:"userId"`
	FirstName  string                 `json:"firstName"`
	LastName   string                 `json:"lastName"`
	BirthDate  string                 `json:"birthDate"`
	Gender     string                 `json:"gender"`
	Email      string                 `json:"email"`
	Phone      string                 `json:"phone"`
	Company    string                 `json:"company"`
	Attributes map[string]interface{} `json:"attributes"`
}

type Webengage

type Webengage interface {
	CreateUser(ctx context.Context, apiKey string, licenseCode string, request UserRequest) error
	CreateBulkUser(ctx context.Context, apiKey string, licenseCode string, request []UserRequest) error
	UpdateUser(ctx context.Context, apiKey, licenseCode, userID string, request UserRequest) error
	CreateEvent(ctx context.Context, apiKey, licenseCode, userID string, eventName string, eventTime string,
		eventData map[string]interface{}) error
	CreateBulkEvent(ctx context.Context, apiKey string, licenseCode string, request []EventRequest) error
	CreateTransactionalCampaignMessages(ctx context.Context, apiKey, licenseCode, userID string, ttl int,
		token map[string]interface{}, experimentID string) (*TransactionalCampaignMessagesResponse, error)
	GetSurvey(ctx context.Context, apiKey, surveyResponseID string) (*SurveyResponse, error)
}

Webengage is the interface for the webengage client.

func NewWebengage

func NewWebengage(address string, proxy string, userAgent string) Webengage

type WebengageResponseError

type WebengageResponseError struct {
	Response struct {
		Message string `json:"message"`
		Status  string `json:"status"`
	} `json:"response"`
}

Jump to

Keyboard shortcuts

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