Coder Social home page Coder Social logo

prathamesh-88 / go-novu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from novuhq/go-novu

0.0 0.0 0.0 97 KB

GO SDK for Novu - The open-source notification infrastructure for engineers. ๐Ÿš€

License: MIT License

Go 99.94% Makefile 0.06%

go-novu's Introduction

Novu's API v1 Go Library

Novu's API exposes the entire Novu features via a standardized programmatic interface. Please refer to the full documentation to learn more.

Installation & Usage

Install the package to your GoLang project.

go get github.com/novuhq/go-novu

Getting Started

Please follow the installation procedure and then run the following:

package main

import (
	"context"
	"fmt"
	novu "github.com/novuhq/go-novu/lib"
	"log"
)

func main() {
	subscriberID := "<<REPLACE_WITH_YOUR_SUBSCRIBER>"
	apiKey := "<REPLACE_WITH_YOUR_API_KEY>"
	eventId := "<REPLACE_WITH_YOUR_EVENT_ID>"

	ctx := context.Background()
	to := map[string]interface{}{
		"lastName":     "Doe",
		"firstName":    "John",
		"subscriberId": subscriberID,
		"email":        "[email protected]",
	}

	payload := map[string]interface{}{
		"name": "Hello World",
		"organization": map[string]interface{}{
			"logo": "https://happycorp.com/logo.png",
		},
	}

	data := novu.ITriggerPayloadOptions{To: to, Payload: payload}
	novuClient := novu.NewAPIClient(apiKey, &novu.Config{})

	resp, err := novuClient.EventApi.Trigger(ctx, eventId, data)
	if err != nil {
		log.Fatal("novu error", err.Error())
		return
	}

	fmt.Println(resp)

	// get integrations
	integrations, err := novuClient.IntegrationsApi.GetAll(ctx)
	if err != nil {
		log.Fatal("Get all integrations error: ", err.Error())
	}
	fmt.Println(integrations)
}

NOTE Check the cmd directory to see a sample implementation and test files to see sample tests

Documentation for API Endpoints

Class Method HTTP request Description
EventApi Trigger Post /events/trigger Trigger
EventApi TriggerBulk Post /v1/events/trigger/bulk Bulk trigger event
EventApi BroadcastToAll Post /v1/events/trigger/broadcast Broadcast event to all
EventApi CancelTrigger Delete /v1/events/trigger/:transactionId Cancel triggered event
SubscriberApi Get Get /subscribers/:subscriberId Get a subscriber
SubscriberApi Identify Post /subscribers Create a subscriber
SubscriberApi Update Put /subscribers/:subscriberID Update subscriber data
SubscriberApi Delete Delete /subscribers/:subscriberID Removing a subscriber
SubscriberApi Get Get /subscribers/:subscriberId/notifications/feed Get a notification feed for a particular subscriber
SubscriberApi Get Get /subscribers/:subscriberId/notifications/feed Get the unseen notification count for subscribers feed
SubscriberApi Post Post /v1/subscribers/:subscriberId/messages/markAs Mark a subscriber feed message as seen
SubscriberApi Get Get /subscribers/:subscriberId/preferences Get subscriber preferences
SubscriberApi Patch Patch /subscribers/:subscriberId/preferences/:templateId Update subscriber preference
IntegrationsApi Create Post /integrations Create an integration
IntegrationsApi Update Put /integrations/:integrationId Update an integration
IntegrationsApi Delete Delete /integrations/:integrationId Delete an integration
IntegrationsApi Get Get /integrations Get all integrations
IntegrationsApi GetActive Get /integrations/active Get all active integrations
IntegrationsApi SetIntegrationAsPrimary Post /integrations/{integrationId}/set-primary Set the integration as primary
IntegrationsApi GetChannelLimit Get /integrations/{channelType}/limit Get the limits of the channel

InboundParserApi | Get | Get /inbound-parse/mx/status | Validate the mx record setup for the inbound parse functionality

Authorization (api-key)

Authorization (api-key)

  • Type: API key
  • API key parameter name: ApiKey
  • Location: HTTP header

Support and Feedback

Be sure to visit the Novu official documentation website for additional information about our API.

If you find a bug, please post the issue on Github.

As always, if you need additional assistance, join our Discord us a note here.

Contributors

Name
Oyewole Samuel
Dima Grossman

go-novu's People

Contributors

akhill10 avatar bezaeel avatar cliftonz avatar eshaanagg avatar jerempy avatar king-11 avatar mahendrahegde avatar nonsoamadi10 avatar prajjwaldimri avatar roman-utila avatar samsoft00 avatar scopsy avatar srikanth597 avatar sumitsaurabh927 avatar unicodeveloper avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.