API (v2) Reference

Introduction

Base URL: https://api.magicbell.com/v2

For authentication, rate limits, and errors, please refer to the API documentation.

Create a broadcast

POST/broadcasts
Project JWT

Request body

action_url
nullable string
max length: 2048
category
nullable string
max length: 255
pattern: ^[A-Za-z0-9_\.\-/:]+$
content
nullable string
max length: 10485760
created_at
string
format: date-time
custom_attributes
nullable object
id
string
format: uuid
overrides
nullable object
Show child attributes
channels
object
Show child attributes
in_app
object
Show child attributes
title
string
min length: 1
max length: 255
content
string
max length: 1048576
action_url
nullable string
max length: 2048
mobile_push
object
Show child attributes
title
string
min length: 1
max length: 255
content
string
max length: 1048576
action_url
nullable string
max length: 2048
email
object
Show child attributes
title
string
min length: 1
max length: 255
content
string
max length: 1048576
action_url
nullable string
max length: 2048
sms
object
Show child attributes
title
string
min length: 1
max length: 255
content
string
max length: 1048576
action_url
nullable string
max length: 2048
providers
object
Show child attributes
sendgrid
object
mailgun
object
expo
object
apns
object
teams
object
twilio
object
ses
object
fcm
object
slack
object
web_push
object
recipients
nullable array required
min items: 1
max items: 1000
Show child attributes
(array item)
status
object
Show child attributes
summary
object required
Show child attributes
total
integer required
failures
integer required
errors
nullable array required
Show child attributes
(array item)
object
Show child attributes
message
string
status
string required
Possible enum values:
enqueued
processing
processed
title
string required
min length: 1
max length: 255
topic
nullable string
max length: 255
pattern: ^[A-Za-z0-9_\.\-/:]+$
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/broadcasts"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


email := broadcasts.Email{
  ActionUrl: util.ToPointer(util.Nullable[string]{ Value: "ActionUrl" }),
  Content: util.ToPointer("Content"),
  Title: util.ToPointer("Title"),
}


inApp := broadcasts.InApp{
  ActionUrl: util.ToPointer(util.Nullable[string]{ Value: "ActionUrl" }),
  Content: util.ToPointer("Content"),
  Title: util.ToPointer("Title"),
}


mobilePush := broadcasts.MobilePush{
  ActionUrl: util.ToPointer(util.Nullable[string]{ Value: "ActionUrl" }),
  Content: util.ToPointer("Content"),
  Title: util.ToPointer("Title"),
}


sms := broadcasts.Sms{
  ActionUrl: util.ToPointer(util.Nullable[string]{ Value: "ActionUrl" }),
  Content: util.ToPointer("Content"),
  Title: util.ToPointer("Title"),
}

overridesChannels := broadcasts.OverridesChannels{
  Email: &email,
  InApp: &inApp,
  MobilePush: &mobilePush,
  Sms: &sms,
}


providers := broadcasts.Providers{
  Apns: []byte{},
  Expo: []byte{},
  Fcm: []byte{},
  Mailgun: []byte{},
  Sendgrid: []byte{},
  Ses: []byte{},
  Slack: []byte{},
  Teams: []byte{},
  Twilio: []byte{},
  WebPush: []byte{},
}

overrides := broadcasts.Overrides{
  Channels: &overridesChannels,
  Providers: &providers,
}


user := shared.User{
  CreatedAt: util.ToPointer(util.Nullable[string]{ Value: "CreatedAt" }),
  CustomAttributes: []byte{},
  Email: util.ToPointer(util.Nullable[string]{ Value: "Email" }),
  ExternalId: util.ToPointer(util.Nullable[string]{ Value: "ExternalId" }),
  FirstName: util.ToPointer(util.Nullable[string]{ Value: "FirstName" }),
  Id: util.ToPointer("Id"),
  LastName: util.ToPointer(util.Nullable[string]{ Value: "LastName" }),
  LastNotifiedAt: util.ToPointer(util.Nullable[string]{ Value: "LastNotifiedAt" }),
  LastSeenAt: util.ToPointer(util.Nullable[string]{ Value: "LastSeenAt" }),
  UpdatedAt: util.ToPointer(util.Nullable[string]{ Value: "UpdatedAt" }),
}


errors := broadcasts.Errors{
  Message: util.ToPointer("Message"),
}

statusStatus := broadcasts.STATUS_STATUS_ENQUEUED


summary := broadcasts.Summary{
  Failures: util.ToPointer(int64(123)),
  Total: util.ToPointer(int64(123)),
}

broadcastStatus := broadcasts.BroadcastStatus{
  Errors: []broadcasts.Errors{errors},
  Status: &statusStatus,
  Summary: &summary,
}

request := broadcasts.Broadcast{
  ActionUrl: util.ToPointer(util.Nullable[string]{ Value: "ActionUrl" }),
  Category: util.ToPointer(util.Nullable[string]{ Value: "Category" }),
  Content: util.ToPointer(util.Nullable[string]{ Value: "Content" }),
  CreatedAt: util.ToPointer("CreatedAt"),
  CustomAttributes: []byte{},
  Id: util.ToPointer("Id"),
  Overrides: &overrides,
  Recipients: []shared.User{user},
  Status: &broadcastStatus,
  Title: util.ToPointer("Title"),
  Topic: util.ToPointer(util.Nullable[string]{ Value: "Topic" }),
}

response, err := client.Broadcasts.CreateBroadcast(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
  "title": "Hello, World!",
  "content": "I come from broadcast",
  "action_url": "https://example.com",
  "category": "example",
  "topic": "example",
  "custom_attributes": {},
  "recipients": [
    {
      "external_id": "83d987a-83fd034",
      "email": "test@example.com",
      "first_name": "Person",
      "last_name": "Doe",
      "custom_attributes": {
        "plan": "enterprise",
        "pricing_version": "v10",
        "preferred_pronoun": "They"
      },
      "phone_numbers": ["+1 5005550001"]
    }
  ],
  "overrides": {}
}

Fetch a broadcast

GET/broadcasts/{broadcast_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Broadcasts.FetchBroadcast(context.Background(), "broadcastId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
  "title": "Hello, World!",
  "content": "I come from broadcast",
  "action_url": "https://example.com",
  "category": "example",
  "topic": "example",
  "custom_attributes": {},
  "recipients": [
    {
      "external_id": "83d987a-83fd034",
      "email": "test@example.com",
      "first_name": "Person",
      "last_name": "Doe",
      "custom_attributes": {
        "plan": "enterprise",
        "pricing_version": "v10",
        "preferred_pronoun": "They"
      },
      "phone_numbers": ["+1 5005550001"]
    }
  ],
  "overrides": {}
}

List all broadcasts

GET/broadcasts
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/broadcasts"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := broadcasts.ListBroadcastsRequestParams{

}

response, err := client.Broadcasts.ListBroadcasts(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
  "title": "Hello, World!",
  "content": "I come from broadcast",
  "action_url": "https://example.com",
  "category": "example",
  "topic": "example",
  "custom_attributes": {},
  "recipients": [
    {
      "external_id": "83d987a-83fd034",
      "email": "test@example.com",
      "first_name": "Person",
      "last_name": "Doe",
      "custom_attributes": {
        "plan": "enterprise",
        "pricing_version": "v10",
        "preferred_pronoun": "They"
      },
      "phone_numbers": ["+1 5005550001"]
    }
  ],
  "overrides": {}
}
],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an APNs token

PUT/channels/mobile_push/apns/tokens
User JWT

Request body

app_id
string
pattern: ^[a-zA-Z0-9]+(.[a-zA-Z0-9]+)*$
device_token
string required
min length: 64
installation_id
string
Possible enum values:
development
production
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)

apnsTokenPayloadInstallationId := channels.APNS_TOKEN_PAYLOAD_INSTALLATION_ID_DEVELOPMENT

request := channels.ApnsTokenPayload{
  AppId: util.ToPointer("AppId"),
  DeviceToken: util.ToPointer("DeviceToken"),
  InstallationId: &apnsTokenPayloadInstallationId,
}

response, err := client.Channels.SaveApnsToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "installation_id": "development"
}

Fetch an APNs token

GET/channels/mobile_push/apns/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchApnsToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an APNs token

DELETE/channels/mobile_push/apns/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteApnsToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all APNs tokens

GET/channels/mobile_push/apns/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListApnsTokensRequestParams{

}

response, err := client.Channels.ListApnsTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an Expo token

PUT/channels/mobile_push/expo/tokens
User JWT

Request body

device_token
string required
min length: 1
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := channels.ExpoTokenPayload{
  DeviceToken: util.ToPointer("DeviceToken"),
}

response, err := client.Channels.SaveExpoToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"
}

Fetch an Expo token

GET/channels/mobile_push/expo/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchExpoToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an Expo token

DELETE/channels/mobile_push/expo/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteExpoToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all Expo tokens

GET/channels/mobile_push/expo/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListExpoTokensRequestParams{

}

response, err := client.Channels.ListExpoTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a FCM token

PUT/channels/mobile_push/fcm/tokens
User JWT

Request body

device_token
string required
min length: 64
installation_id
string
Possible enum values:
development
production
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)

fcmTokenPayloadInstallationId := channels.FCM_TOKEN_PAYLOAD_INSTALLATION_ID_DEVELOPMENT

request := channels.FcmTokenPayload{
  DeviceToken: util.ToPointer("DeviceToken"),
  InstallationId: &fcmTokenPayloadInstallationId,
}

response, err := client.Channels.SaveFcmToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "installation_id": "development"
}

Fetch a FCM token

GET/channels/mobile_push/fcm/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchFcmToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete a FCM token

DELETE/channels/mobile_push/fcm/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteFcmToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all FCM tokens

GET/channels/mobile_push/fcm/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListFcmTokensRequestParams{

}

response, err := client.Channels.ListFcmTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an Inbox token

PUT/channels/in_app/inbox/tokens
User JWT

Request body

connection_id
nullable string
token
string required
min length: 64
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := channels.InboxToken{
  ConnectionId: util.ToPointer(util.Nullable[string]{ Value: "ConnectionId" }),
  Token: util.ToPointer("Token"),
}

response, err := client.Channels.SaveInboxToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt"
}

Fetch an Inbox token

GET/channels/in_app/inbox/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchInboxToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an Inbox token

DELETE/channels/in_app/inbox/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteInboxToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all Inbox tokens

GET/channels/in_app/inbox/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListInboxTokensRequestParams{

}

response, err := client.Channels.ListInboxTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Slack token

PUT/channels/slack/tokens
User JWT

Request body

oauth
object
Show child attributes
scope
string
channel_id
string required
installation_id
string required
webhook
object
Show child attributes
url
string required
format: uri
min length: 1
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


slackTokenPayloadOauth := channels.SlackTokenPayloadOauth{
  ChannelId: util.ToPointer("ChannelId"),
  InstallationId: util.ToPointer("InstallationId"),
  Scope: util.ToPointer("Scope"),
}


slackTokenPayloadWebhook := channels.SlackTokenPayloadWebhook{
  Url: util.ToPointer("Url"),
}

request := channels.SlackTokenPayload{
  Oauth: &slackTokenPayloadOauth,
  Webhook: &slackTokenPayloadWebhook,
}

response, err := client.Channels.SaveSlackToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "webhook": {
    "url": "https://example.com/webhook"
  }
}

Fetch a Slack token

GET/channels/slack/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchSlackToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z",
  "webhook": {
    "url": "https://example.com/webhook"
  }
}

Delete a Slack token

DELETE/channels/slack/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteSlackToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all Slack tokens

GET/channels/slack/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListSlackTokensRequestParams{

}

response, err := client.Channels.ListSlackTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z",
  "webhook": {
    "url": "https://example.com/webhook"
  }
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Teams token

PUT/channels/teams/tokens
User JWT

Request body

webhook
object
Show child attributes
url
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


teamsTokenPayloadWebhook := channels.TeamsTokenPayloadWebhook{
  Url: util.ToPointer("Url"),
}

request := channels.TeamsTokenPayload{
  Webhook: &teamsTokenPayloadWebhook,
}

response, err := client.Channels.SaveTeamsToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Fetch a Teams token

GET/channels/teams/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchTeamsToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete a Teams token

DELETE/channels/teams/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteTeamsToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all Teams tokens

GET/channels/teams/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListTeamsTokensRequestParams{

}

response, err := client.Channels.ListTeamsTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Web Push token

PUT/channels/web_push/tokens
User JWT

Request body

endpoint
string required
format: uri
keys
object required
Show child attributes
auth
string required
p256dh
string required
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/shared"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


webPushTokenPayloadKeys := shared.WebPushTokenPayloadKeys{
  Auth: util.ToPointer("Auth"),
  P256dh: util.ToPointer("P256dh"),
}

request := shared.WebPushTokenPayload{
  Endpoint: util.ToPointer("Endpoint"),
  Keys: &webPushTokenPayloadKeys,
}

response, err := client.Channels.SaveWebPushToken(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "keys": {
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0",
    "auth": "GoIO2ulhtQuyBM64lZuFuw"
  }
}

Fetch a Web Push token

GET/channels/web_push/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchWebPushToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "id": "123",
  "keys": {
    "auth": "GoIO2ulhtQuyBM64lZuFuw",
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
  },
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete a Web Push token

DELETE/channels/web_push/tokens/{token_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteWebPushToken(context.Background(), "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List all Web Push tokens

GET/channels/web_push/tokens
User JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListWebPushTokensRequestParams{

}

response, err := client.Channels.ListWebPushTokens(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "id": "123",
  "keys": {
    "auth": "GoIO2ulhtQuyBM64lZuFuw",
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
  },
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an event

GET/events/{event_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Events.FetchEvent(context.Background(), "eventId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "type": "example_type",
    "timestamp": "2021-01-01T00:00:00Z"
  }

List all events

GET/events
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/events"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := events.ListEventsRequestParams{

}

response, err := client.Events.ListEvents(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "id": "123",
    "type": "example_type",
    "timestamp": "2021-01-01T00:00:00Z"
  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an APNs integration

PUT/integrations/apns
Project JWT

Request body

app_id
string required
pattern: ^[a-zA-Z0-9]+(.[a-zA-Z0-9]+)*$
badge
string required
Possible enum values:
unread
unseen
certificate
string required
pattern: ^-+?\s?BEGIN PRIVATE KEY-+\n([A-Za-z0-9+/\r\n]+={0,2})\n-+\s?END PRIVATE KEY+-+\n?$
key_id
string required
min length: 10
max length: 10
payload_version
string
Possible enum values:
1
2
team_id
string required
min length: 10
max length: 10
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)

badge := integrations.BADGE_UNREAD

payloadVersion := integrations.PAYLOAD_VERSION_1

request := integrations.ApnsConfigPayload{
  AppId: util.ToPointer("AppId"),
  Badge: &badge,
  Certificate: util.ToPointer("Certificate"),
  KeyId: util.ToPointer("KeyId"),
  PayloadVersion: &payloadVersion,
  TeamId: util.ToPointer("TeamId"),
}

response, err := client.Integrations.SaveApnsIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "app_id": "com.example.myapp",
  "certificate": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgHnr4B2P+by++FGu/th0a44E8chJl5v5Vo4gq0YHw6e6gCgYIKoZIzj0DAQehRANCAARCg1MRibnfyeX5mx6+Rtfzzn7UhJP/oaqL4RzSmDuTsd3BTX33cuQ0gWHe20R2m1bLAkI1wrp+zbWOlAOAD7KX\n-----END PRIVATE KEY-----",
  "key_id": "ABCD1234EF",
  "team_id": "ABCD1234EF",
  "badge": "unread"
}

Delete an APNs integration

DELETE/integrations/apns
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteApnsIntegrationRequestParams{

}

response, err := client.Integrations.DeleteApnsIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all APNs integrations

GET/integrations/apns
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListApnsIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "app_id": "com.example.myapp",
  "certificate": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgHnr4B2P+by++FGu/th0a44E8chJl5v5Vo4gq0YHw6e6gCgYIKoZIzj0DAQehRANCAARCg1MRibnfyeX5mx6+Rtfzzn7UhJP/oaqL4RzSmDuTsd3BTX33cuQ0gWHe20R2m1bLAkI1wrp+zbWOlAOAD7KX\n-----END PRIVATE KEY-----",
  "key_id": "ABCD1234EF",
  "team_id": "ABCD1234EF",
  "badge": "unread"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an Expo integration

PUT/integrations/expo
Project JWT

Request body

access_token
string required
min length: 1
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.ExpoConfigPayload{
  AccessToken: util.ToPointer("AccessToken"),
}

response, err := client.Integrations.SaveExpoIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "access_token": "expo_access_token"
}

Delete an Expo integration

DELETE/integrations/expo
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteExpoIntegrationRequestParams{

}

response, err := client.Integrations.DeleteExpoIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Expo integrations

GET/integrations/expo
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListExpoIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "access_token": "expo_access_token"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a FCM integration

PUT/integrations/fcm
Project JWT

Request body

auth_provider_x509_cert_url
string required
auth_uri
string required
client_email
string required
client_id
string required
client_x509_cert_url
string required
private_key
string required
pattern: ^-+?\s?BEGIN[A-Z ]+-+\n([A-Za-z0-9+/\r\n]+={0,2})\n-+\s?END[A-Z ]+-+\n?$
private_key_id
string required
project_id
string required
token_uri
string required
type
string required
Possible enum values:
service_account
universe_domain
string required
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)

type_ := integrations.TYPE_SERVICE_ACCOUNT

request := integrations.FcmConfigPayload{
  AuthProviderX509CertUrl: util.ToPointer("AuthProviderX509CertUrl"),
  AuthUri: util.ToPointer("AuthUri"),
  ClientEmail: util.ToPointer("ClientEmail"),
  ClientId: util.ToPointer("ClientId"),
  ClientX509CertUrl: util.ToPointer("ClientX509CertUrl"),
  PrivateKey: util.ToPointer("PrivateKey"),
  PrivateKeyId: util.ToPointer("PrivateKeyId"),
  ProjectId: util.ToPointer("ProjectId"),
  TokenUri: util.ToPointer("TokenUri"),
  Type_: &type_,
  UniverseDomain: util.ToPointer("UniverseDomain"),
}

response, err := client.Integrations.SaveFcmIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "type": "service_account",
  "project_id": "platform-development",
  "private_key_id": "1935e74178f6ef0bbc23fb3538255f8281093bf2",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9b8QGyPBK/V1VspgMQOE+UlOzkenUaEUreg\nqFg0TM8ofaSS6OXeR0DgGdALUCyGeyf6YcuG55QFWlKmvuF8QzY/05mA2G7XcKjc\nrF3Xtju61tLmYnqZnMOT46AkquTgPyfYa3+n5aVimRAsdOYESvOUvPTUgcbc2GGK\nC2h2MUCoRKuhzbGx847XJmINRE+xaht4hDMhzhMBVrgGGyQ3sIdbCxpbiQR6QH2H\npITrSnd4hlKRPREWS/D4FUKP/ucXdORP9SUi0R64NRZ3GvT1HvpVZ9fOXwIACdAG\n9fpIQbsmIgxhgZ5ZjuGz/nFi2KQ2Y8rEycQmnHd4QQKBgQD4LVFL93E4qwr7Eruj\nFjyxGYYi2PhVxvrpiSD6ziK3HUjAxat6OcoElJx7WEFWHmi7KRgehqcl40A8Coav\n9DGBwnSM2AYKgzOqMqzjK71TFOQsJdGEYThnhiL2FoQeptgskVS7J9MMBPTnyl7D\nYObINwGbg9auVp66rj5W+dymZwKBgQDB6VdpxJpU9hXBW+8nJESduhzpYiHoe1kN\nyka90dQDOe2b/R7bnF1Ggte6Ll1dMs3xLhN1Mm2XTcX2zmzM15C0E4+1t1LXXzAo\nO2P+riEmCIUc1i0yNMVgEKXiOBBYgKauE3fT88c4dw2JAT0QlifJ0h8kRPNhUaq9\nespjleNQwQKBgHUzwZ7knn2qmSb1M9PTHppseWJfoPexXrGHZyHK064ykDcpos+4\nFuWO4U+G4GQxPDiXMaLI6IsGBUHVnsHdyruC/9O7+S5hw7Zu9CLcdy6TQSZwPcAM\nwbxyJnSdMYvgM1roz2ELb6nPdXE5qwMN8i8/euzcmDgBBDkZLKuamE+lAoGBAKb7\nvd7DAvPvBkUAWi2mub/pqUQA0ZpVvhZ1/f0wWBZ/J/KQQqZzPI+f1Q3rJ1M+kMIE\nH5Vo257TxooGsQKlD2NDBRpCx//XZK0Al9eVM86Av8BZX4pAj0dujqsEBG9yOhbl\nhObsor4pJ2q3ulIyPAk7/L1K8xr3LMUGnIqtZJcBAoGAEQffqGbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n",
  "client_email": "firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com",
  "client_id": "117893100789081023083",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

Delete a FCM integration

DELETE/integrations/fcm
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteFcmIntegrationRequestParams{

}

response, err := client.Integrations.DeleteFcmIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all FCM integrations

GET/integrations/fcm
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListFcmIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "type": "service_account",
  "project_id": "platform-development",
  "private_key_id": "1935e74178f6ef0bbc23fb3538255f8281093bf2",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7/GBHM4AK4/8c\nZyvJfdzjBzfA48tV9T3N4hBCb4E66jIz+oztH9oSngEfIVO/L1dWjK1OlN0cqJ0f\nQaKq1eycSjmwfTR3HGNjQQyoGQ4BFBdyqT5rRDDZLPI2LoR0dtQXcBtiFpJF2t8e\niDmpl3d/ipuKMtBRzjYPqzP0qv3YkPmw2v5FqKK9EIaHRtOhd2R28F5FE+kF1dvB\nt7fEeVtKcQJcSwDUQ8HEshlWSx6azGd4jxf9jHRXWumXYfTA6NMA7EUTDJVus3vU\ny9MCv2KwZO/dzlQygY0BM9FHPSzZRIiHUx+DH6gYl2uWJatluHz58lj3r5mo/Ssc\nyP3TrqOnAgMBAAECggEAWAnDe0UCt9b8QGyPBK/V1VspgMQOE+UlOzkenUaEUreg\nqFg0TM8ofaSS6OXeR0DgGdALUCyGeyf6YcuG55QFWlKmvuF8QzY/05mA2G7XcKjc\nrF3Xtju61tLmYnqZnMOT46AkquTgPyfYa3+n5aVimRAsdOYESvOUvPTUgcbc2GGK\nC2h2MUCoRKuhzbGx847XJmINRE+xaht4hDMhzhMBVrgGGyQ3sIdbCxpbiQR6QH2H\npITrSnd4hlKRPREWS/D4FUKP/ucXdORP9SUi0R64NRZ3GvT1HvpVZ9fOXwIACdAG\n9fpIQbsmIgxhgZ5ZjuGz/nFi2KQ2Y8rEycQmnHd4QQKBgQD4LVFL93E4qwr7Eruj\nFjyxGYYi2PhVxvrpiSD6ziK3HUjAxat6OcoElJx7WEFWHmi7KRgehqcl40A8Coav\n9DGBwnSM2AYKgzOqMqzjK71TFOQsJdGEYThnhiL2FoQeptgskVS7J9MMBPTnyl7D\nYObINwGbg9auVp66rj5W+dymZwKBgQDB6VdpxJpU9hXBW+8nJESduhzpYiHoe1kN\nyka90dQDOe2b/R7bnF1Ggte6Ll1dMs3xLhN1Mm2XTcX2zmzM15C0E4+1t1LXXzAo\nO2P+riEmCIUc1i0yNMVgEKXiOBBYgKauE3fT88c4dw2JAT0QlifJ0h8kRPNhUaq9\nespjleNQwQKBgHUzwZ7knn2qmSb1M9PTHppseWJfoPexXrGHZyHK064ykDcpos+4\nFuWO4U+G4GQxPDiXMaLI6IsGBUHVnsHdyruC/9O7+S5hw7Zu9CLcdy6TQSZwPcAM\nwbxyJnSdMYvgM1roz2ELb6nPdXE5qwMN8i8/euzcmDgBBDkZLKuamE+lAoGBAKb7\nvd7DAvPvBkUAWi2mub/pqUQA0ZpVvhZ1/f0wWBZ/J/KQQqZzPI+f1Q3rJ1M+kMIE\nH5Vo257TxooGsQKlD2NDBRpCx//XZK0Al9eVM86Av8BZX4pAj0dujqsEBG9yOhbl\nhObsor4pJ2q3ulIyPAk7/L1K8xr3LMUGnIqtZJcBAoGAEQffqGbnaOG8Ue3++bLP\nN6XlAyt5UajAd1CycIHgDvbW0CkWoI70Bg7QNqMYJe6DareH4vRpdB3tw6zNP7qN\n0Bd04L8+zUYN+VqNJ70d7Xn+k2rY7STlgU3vwOzHFwu4wK2A7e+aAZ8AjC+Sr0ZM\nps+wuWO8MN5yQTBZvAEIfQs=\n-----END PRIVATE KEY-----\n",
  "client_email": "firebase-adminsdk-qwhtp@platform-development.iam.gserviceaccount.com",
  "client_id": "117893100789081023083",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-qwhtp%40magicbell-development.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an Inbox installation

PUT/integrations/inbox/installations
User JWT

Request body

images
nullable object required
Show child attributes
emptyInboxUrl
string required
locale
nullable string required
min length: 2
theme
nullable object required
Show child attributes
footer
object
Show child attributes
fontSize
string required
backgroundColor
string required
textColor
string required
borderRadius
string required
notification
object
Show child attributes
default
object required
Show child attributes
backgroundColor
string required
hover
object
Show child attributes
backgroundColor
string required
state
object
Show child attributes
color
string required
margin
string required
fontFamily
string required
fontSize
string required
textColor
string required
borderRadius
string required
unseen
object required
Show child attributes
state
object
Show child attributes
color
string required
textColor
string required
backgroundColor
string required
hover
object
Show child attributes
backgroundColor
string required
unread
object required
Show child attributes
textColor
string required
backgroundColor
string required
hover
object
Show child attributes
backgroundColor
string required
state
object
Show child attributes
color
string required
dialog
object
Show child attributes
textColor
string required
accentColor
string required
backgroundColor
string required
icon
object
Show child attributes
borderColor
string required
width
string required
banner
object
Show child attributes
fontSize
string required
backgroundColor
string required
textColor
string required
backgroundOpacity
number
unseenBadge
object
Show child attributes
backgroundColor
string required
header
object
Show child attributes
textColor
string required
borderRadius
string required
fontFamily
string required
fontSize
string required
backgroundColor
string required
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


images := integrations.Images{
  EmptyInboxUrl: util.ToPointer("EmptyInboxUrl"),
}


banner := integrations.Banner{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BackgroundOpacity: util.ToPointer(float64(123)),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


dialog := integrations.Dialog{
  AccentColor: util.ToPointer("AccentColor"),
  BackgroundColor: util.ToPointer("BackgroundColor"),
  TextColor: util.ToPointer("TextColor"),
}


footer := integrations.Footer{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


header := integrations.Header{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontFamily: util.ToPointer("FontFamily"),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


icon := integrations.Icon{
  BorderColor: util.ToPointer("BorderColor"),
  Width: util.ToPointer("Width"),
}


defaultHover := integrations.DefaultHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


defaultState := integrations.DefaultState{
  Color: util.ToPointer("Color"),
}

default_ := integrations.Default_{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontFamily: util.ToPointer("FontFamily"),
  FontSize: util.ToPointer("FontSize"),
  Hover: &defaultHover,
  Margin: util.ToPointer("Margin"),
  State: &defaultState,
  TextColor: util.ToPointer("TextColor"),
}


unreadHover := integrations.UnreadHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


unreadState := integrations.UnreadState{
  Color: util.ToPointer("Color"),
}

unread := integrations.Unread{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  Hover: &unreadHover,
  State: &unreadState,
  TextColor: util.ToPointer("TextColor"),
}


unseenHover := integrations.UnseenHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


unseenState := integrations.UnseenState{
  Color: util.ToPointer("Color"),
}

unseen := integrations.Unseen{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  Hover: &unseenHover,
  State: &unseenState,
  TextColor: util.ToPointer("TextColor"),
}

themeNotification := integrations.ThemeNotification{
  Default_: &default_,
  Unread: &unread,
  Unseen: &unseen,
}


unseenBadge := integrations.UnseenBadge{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}

theme := integrations.Theme{
  Banner: &banner,
  Dialog: &dialog,
  Footer: &footer,
  Header: &header,
  Icon: &icon,
  Notification: &themeNotification,
  UnseenBadge: &unseenBadge,
}

request := integrations.InboxConfigPayload{
  Images: &images,
  Locale: util.ToPointer(util.Nullable[string]{ Value: "Locale" }),
  Theme: &theme,
}

response, err := client.Integrations.SaveInboxInstallation(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "images": { "emptyInboxUrl": "" },
  "locale": "de",
  "theme": {
    "banner": {
      "backgroundColor": "#F8F5FF",
      "fontSize": "14px",
      "textColor": "#3A424D"
    },
    "dialog": {
      "accentColor": "#5225C1",
      "backgroundColor": "#F5F5F5",
      "textColor": "#313131"
    },
    "footer": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "header": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "icon": { "borderColor": "#EDEDEF", "width": "24px" },
    "unseenBadge": { "backgroundColor": "#F80808" }
  }
}

Start an Inbox installation

POST/integrations/inbox/installations/start
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.StartInboxInstallation(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "images": { "emptyInboxUrl": "" },
  "locale": "de",
  "theme": {
    "banner": {
      "backgroundColor": "#F8F5FF",
      "fontSize": "14px",
      "textColor": "#3A424D"
    },
    "dialog": {
      "accentColor": "#5225C1",
      "backgroundColor": "#F5F5F5",
      "textColor": "#313131"
    },
    "footer": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "header": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "icon": { "borderColor": "#EDEDEF", "width": "24px" },
    "unseenBadge": { "backgroundColor": "#F80808" }
  }
}

Save an Inbox integration

PUT/integrations/inbox
Project JWT

Request body

images
nullable object required
Show child attributes
emptyInboxUrl
string required
locale
nullable string required
min length: 2
theme
nullable object required
Show child attributes
banner
object
Show child attributes
fontSize
string required
backgroundColor
string required
textColor
string required
backgroundOpacity
number
unseenBadge
object
Show child attributes
backgroundColor
string required
header
object
Show child attributes
fontFamily
string required
fontSize
string required
backgroundColor
string required
textColor
string required
borderRadius
string required
footer
object
Show child attributes
fontSize
string required
backgroundColor
string required
textColor
string required
borderRadius
string required
notification
object
Show child attributes
unseen
object required
Show child attributes
hover
object
Show child attributes
backgroundColor
string required
state
object
Show child attributes
color
string required
textColor
string required
backgroundColor
string required
unread
object required
Show child attributes
textColor
string required
backgroundColor
string required
hover
object
Show child attributes
backgroundColor
string required
state
object
Show child attributes
color
string required
default
object required
Show child attributes
state
object
Show child attributes
color
string required
margin
string required
fontFamily
string required
fontSize
string required
textColor
string required
borderRadius
string required
backgroundColor
string required
hover
object
Show child attributes
backgroundColor
string required
dialog
object
Show child attributes
backgroundColor
string required
textColor
string required
accentColor
string required
icon
object
Show child attributes
borderColor
string required
width
string required
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


images := integrations.Images{
  EmptyInboxUrl: util.ToPointer("EmptyInboxUrl"),
}


banner := integrations.Banner{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BackgroundOpacity: util.ToPointer(float64(123)),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


dialog := integrations.Dialog{
  AccentColor: util.ToPointer("AccentColor"),
  BackgroundColor: util.ToPointer("BackgroundColor"),
  TextColor: util.ToPointer("TextColor"),
}


footer := integrations.Footer{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


header := integrations.Header{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontFamily: util.ToPointer("FontFamily"),
  FontSize: util.ToPointer("FontSize"),
  TextColor: util.ToPointer("TextColor"),
}


icon := integrations.Icon{
  BorderColor: util.ToPointer("BorderColor"),
  Width: util.ToPointer("Width"),
}


defaultHover := integrations.DefaultHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


defaultState := integrations.DefaultState{
  Color: util.ToPointer("Color"),
}

default_ := integrations.Default_{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  BorderRadius: util.ToPointer("BorderRadius"),
  FontFamily: util.ToPointer("FontFamily"),
  FontSize: util.ToPointer("FontSize"),
  Hover: &defaultHover,
  Margin: util.ToPointer("Margin"),
  State: &defaultState,
  TextColor: util.ToPointer("TextColor"),
}


unreadHover := integrations.UnreadHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


unreadState := integrations.UnreadState{
  Color: util.ToPointer("Color"),
}

unread := integrations.Unread{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  Hover: &unreadHover,
  State: &unreadState,
  TextColor: util.ToPointer("TextColor"),
}


unseenHover := integrations.UnseenHover{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}


unseenState := integrations.UnseenState{
  Color: util.ToPointer("Color"),
}

unseen := integrations.Unseen{
  BackgroundColor: util.ToPointer("BackgroundColor"),
  Hover: &unseenHover,
  State: &unseenState,
  TextColor: util.ToPointer("TextColor"),
}

notification := integrations.Notification{
  Default_: &default_,
  Unread: &unread,
  Unseen: &unseen,
}


unseenBadge := integrations.UnseenBadge{
  BackgroundColor: util.ToPointer("BackgroundColor"),
}

theme := integrations.Theme{
  Banner: &banner,
  Dialog: &dialog,
  Footer: &footer,
  Header: &header,
  Icon: &icon,
  Notification: &notification,
  UnseenBadge: &unseenBadge,
}

request := integrations.InboxConfigPayload{
  Images: &images,
  Locale: util.ToPointer(util.Nullable[string]{ Value: "Locale" }),
  Theme: &theme,
}

response, err := client.Integrations.SaveInboxIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "images": { "emptyInboxUrl": "" },
  "locale": "de",
  "theme": {
    "banner": {
      "backgroundColor": "#F8F5FF",
      "fontSize": "14px",
      "textColor": "#3A424D"
    },
    "dialog": {
      "accentColor": "#5225C1",
      "backgroundColor": "#F5F5F5",
      "textColor": "#313131"
    },
    "footer": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "header": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "icon": { "borderColor": "#EDEDEF", "width": "24px" },
    "unseenBadge": { "backgroundColor": "#F80808" }
  }
}

Delete an Inbox integration

DELETE/integrations/inbox
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteInboxIntegrationRequestParams{

}

response, err := client.Integrations.DeleteInboxIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Inbox integrations

GET/integrations/inbox
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListInboxIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "images": { "emptyInboxUrl": "" },
  "locale": "de",
  "theme": {
    "banner": {
      "backgroundColor": "#F8F5FF",
      "fontSize": "14px",
      "textColor": "#3A424D"
    },
    "dialog": {
      "accentColor": "#5225C1",
      "backgroundColor": "#F5F5F5",
      "textColor": "#313131"
    },
    "footer": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "header": {
      "backgroundColor": "#FFFFFF",
      "borderRadius": "16px",
      "fontFamily": "inherit",
      "fontSize": "15px",
      "textColor": "#5225C1"
    },
    "icon": { "borderColor": "#EDEDEF", "width": "24px" },
    "unseenBadge": { "backgroundColor": "#F80808" }
  }
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Mailgun integration

PUT/integrations/mailgun
Project JWT

Request body

api_key
string required
min length: 1
domain
string required
min length: 1
from
object
Show child attributes
email
string required
format: email
name
nullable string
region
string required
Possible enum values:
us
eu
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


mailgunConfigPayloadFrom := integrations.MailgunConfigPayloadFrom{
  Email: util.ToPointer("Email"),
  Name: util.ToPointer(util.Nullable[string]{ Value: "Name" }),
}

region := integrations.REGION_US

request := integrations.MailgunConfigPayload{
  ApiKey: util.ToPointer("ApiKey"),
  Domain: util.ToPointer("Domain"),
  From: &mailgunConfigPayloadFrom,
  Region: &region,
}

response, err := client.Integrations.SaveMailgunIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "from": {
    "name": "Example",
    "email": "hello@example.com"
  },
  "api_key": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
  "region": "us",
  "domain": "example.com"
}

Delete a Mailgun integration

DELETE/integrations/mailgun
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteMailgunIntegrationRequestParams{

}

response, err := client.Integrations.DeleteMailgunIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Mailgun integrations

GET/integrations/mailgun
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListMailgunIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "from": {
    "name": "Example",
    "email": "hello@example.com"
  },
  "api_key": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
  "region": "us",
  "domain": "example.com"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Ping Email integration

PUT/integrations/ping_email
Project JWT

Request body

url
string required
format: uri
min length: 1
max length: 100
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.PingConfigPayload{
  Url: util.ToPointer("Url"),
}

response, err := client.Integrations.SavePingEmailIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "url": "https://example.com/webhook"
}

Delete a Ping Email integration

DELETE/integrations/ping_email
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeletePingEmailIntegrationRequestParams{

}

response, err := client.Integrations.DeletePingEmailIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Ping Email integrations

GET/integrations/ping_email
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListPingEmailIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "url": "https://example.com/webhook"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a SendGrid integration

PUT/integrations/sendgrid
Project JWT

Request body

api_key
string required
from
object
Show child attributes
email
string required
format: email
name
nullable string
reply_to
object
Show child attributes
email
string required
format: email
name
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


sendgridConfigPayloadFrom := integrations.SendgridConfigPayloadFrom{
  Email: util.ToPointer("Email"),
  Name: util.ToPointer(util.Nullable[string]{ Value: "Name" }),
}


replyTo := integrations.ReplyTo{
  Email: util.ToPointer("Email"),
  Name: util.ToPointer(util.Nullable[string]{ Value: "Name" }),
}

request := integrations.SendgridConfigPayload{
  ApiKey: util.ToPointer("ApiKey"),
  From: &sendgridConfigPayloadFrom,
  ReplyTo: &replyTo,
}

response, err := client.Integrations.SaveSendgridIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "api_key": "SG.1234567890",
  "from": {
    "email": "company@example.com",
    "name": "Company Name"
  },
  "reply_to": {
    "email": "reply-to@example.com",
    "name": "Reply to Company"
  }
}

Delete a SendGrid integration

DELETE/integrations/sendgrid
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteSendgridIntegrationRequestParams{

}

response, err := client.Integrations.DeleteSendgridIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all SendGrid integrations

GET/integrations/sendgrid
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListSendgridIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "api_key": "SG.1234567890",
  "from": {
    "email": "company@example.com",
    "name": "Company Name"
  },
  "reply_to": {
    "email": "reply-to@example.com",
    "name": "Reply to Company"
  }
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save an Amazon SES integration

PUT/integrations/ses
Project JWT

Request body

from
object
Show child attributes
email
string required
format: email
name
nullable string
key_id
string required
min length: 1
region
string required
min length: 1
secret_key
string required
min length: 1
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


sesConfigPayloadFrom := integrations.SesConfigPayloadFrom{
  Email: util.ToPointer("Email"),
  Name: util.ToPointer(util.Nullable[string]{ Value: "Name" }),
}

request := integrations.SesConfigPayload{
  From: &sesConfigPayloadFrom,
  KeyId: util.ToPointer("KeyId"),
  Region: util.ToPointer("Region"),
  SecretKey: util.ToPointer("SecretKey"),
}

response, err := client.Integrations.SaveSesIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "key_id": "MY_FAKE_AWS_ACCESS_KEY_ID",
  "secret_key": "MY_FAKE_AWS_SECRET_KEY",
  "region": "eu-west-1",
  "from": {
    "name": "Person Name",
    "email": "person@example.com"
  }
}

Delete an Amazon SES integration

DELETE/integrations/ses
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteSesIntegrationRequestParams{

}

response, err := client.Integrations.DeleteSesIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Amazon SES integrations

GET/integrations/ses
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListSesIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "key_id": "MY_FAKE_AWS_ACCESS_KEY_ID",
  "secret_key": "MY_FAKE_AWS_SECRET_KEY",
  "region": "eu-west-1",
  "from": {
    "name": "Person Name",
    "email": "person@example.com"
  }
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Slack installation

PUT/integrations/slack/installations
User JWT

Request body

access_token
string required
app_id
string required
authed_user
object required
Show child attributes
scope
string
access_token
string
refresh_token
string
id
string required
token_type
string
expires_in
integer
bot_user_id
string
enterprise
object
Show child attributes
name
string required
id
string required
expires_in
integer
id
string
pattern: ^[A-Z0-9]+-.*$
incoming_webhook
object
Show child attributes
channel
string required
configuration_url
string required
url
string required
is_enterprise_install
boolean
refresh_token
string
scope
string
team
object required
Show child attributes
name
string
id
string required
token_type
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


authedUser := integrations.AuthedUser{
  AccessToken: util.ToPointer("AccessToken"),
  ExpiresIn: util.ToPointer(int64(123)),
  Id: util.ToPointer("Id"),
  RefreshToken: util.ToPointer("RefreshToken"),
  Scope: util.ToPointer("Scope"),
  TokenType: util.ToPointer("TokenType"),
}


enterprise := integrations.Enterprise{
  Id: util.ToPointer("Id"),
  Name: util.ToPointer("Name"),
}


incomingWebhook := integrations.IncomingWebhook{
  Channel: util.ToPointer("Channel"),
  ConfigurationUrl: util.ToPointer("ConfigurationUrl"),
  Url: util.ToPointer("Url"),
}


team := integrations.Team{
  Id: util.ToPointer("Id"),
  Name: util.ToPointer("Name"),
}

request := integrations.SlackInstallation{
  AccessToken: util.ToPointer("AccessToken"),
  AppId: util.ToPointer("AppId"),
  AuthedUser: &authedUser,
  BotUserId: util.ToPointer("BotUserId"),
  Enterprise: &enterprise,
  ExpiresIn: util.ToPointer(int64(123)),
  Id: util.ToPointer("Id"),
  IncomingWebhook: &incomingWebhook,
  IsEnterpriseInstall: util.ToPointer(true),
  RefreshToken: util.ToPointer("RefreshToken"),
  Scope: util.ToPointer("Scope"),
  Team: &team,
  TokenType: util.ToPointer("TokenType"),
}

response, err := client.Integrations.SaveSlackInstallation(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "A12345678-T123",
  "access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
  "scope": "identify,commands,bot",
  "team_name": "Team Installing Your App",
  "team_id": "T12345678",
  "enterprise_id": "E12345678",
  "enterprise_name": "Enterprise Grid, Inc.",
  "bot_user_id": "U12345678",
  "app_id": "A12345678",
  "authed_user": {
    "id": "U12345678",
    "scope": "identify,commands"
  },
  "incoming_webhook": {
    "channel": "C12345678",
    "channel_id": "C12345678",
    "configuration_url": "https://teamname.slack.com/services/B12345678",
    "url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
  },
  "team": {
    "name": "Team Installing Your App",
    "id": "T123"
  }
}

Start a Slack installation

POST/integrations/slack/installations/start
User JWT

Request body

app_id
string required
auth_url
string
extra_scopes
array
Show child attributes
(array item)
string
redirect_url
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.SlackStartInstall{
  AppId: util.ToPointer("AppId"),
  AuthUrl: util.ToPointer("AuthUrl"),
  ExtraScopes: []string{},
  RedirectUrl: util.ToPointer("RedirectUrl"),
}

response, err := client.Integrations.StartSlackInstallation(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "app_id": "app-id",
    "auth_url": "https://slack.com/oauth/v2/authorize?client_id=app-id&scope=channels:read,chat:write",
    "scopes": [
      "channels:read",
      "chat:write"
    ]
  }

Finish a Slack installation

POST/integrations/slack/installations/finish
User JWT

Request body

app_id
string required
code
string required
redirect_url
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.SlackFinishInstallResponse{
  AppId: util.ToPointer("AppId"),
  Code: util.ToPointer("Code"),
  RedirectUrl: util.ToPointer("RedirectUrl"),
}

response, err := client.Integrations.FinishSlackInstallation(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "A12345678-T123",
  "access_token": "xoxb-123456789012-1234567890123-12345678901234567890abcdef123456",
  "scope": "identify,commands,bot",
  "team_name": "Team Installing Your App",
  "team_id": "T12345678",
  "enterprise_id": "E12345678",
  "enterprise_name": "Enterprise Grid, Inc.",
  "bot_user_id": "U12345678",
  "app_id": "A12345678",
  "authed_user": {
    "id": "U12345678",
    "scope": "identify,commands"
  },
  "incoming_webhook": {
    "channel": "C12345678",
    "channel_id": "C12345678",
    "configuration_url": "https://teamname.slack.com/services/B12345678",
    "url": "https://hooks.slack.com/services/T12345678/B12345678/123456789012345678901234"
  },
  "team": {
    "name": "Team Installing Your App",
    "id": "T123"
  }
}

Save a Slack integration

PUT/integrations/slack
Project JWT

Request body

app_id
string required
pattern: ^[0-9A-Z]+$
client_id
string required
pattern: ^[0-9]+\.[0-9]+$
client_secret
string required
min length: 32
max length: 32
signing_secret
string required
min length: 32
max length: 32
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.SlackConfigPayload{
  AppId: util.ToPointer("AppId"),
  ClientId: util.ToPointer("ClientId"),
  ClientSecret: util.ToPointer("ClientSecret"),
  SigningSecret: util.ToPointer("SigningSecret"),
}

response, err := client.Integrations.SaveSlackIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "app_id": "12345678901",
  "client_id": "1.0",
  "client_secret": "12345678901234567890123456789012",
  "signing_secret": "12345678901234567890123456789012"
}

Delete a Slack integration

DELETE/integrations/slack
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteSlackIntegrationRequestParams{

}

response, err := client.Integrations.DeleteSlackIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Slack integrations

GET/integrations/slack
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListSlackIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "app_id": "12345678901",
  "client_id": "1.0",
  "client_secret": "12345678901234567890123456789012",
  "signing_secret": "12345678901234567890123456789012"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Twilio integration

PUT/integrations/twilio
Project JWT

Request body

account_sid
string required
min length: 1
max length: 100
api_key
string required
min length: 1
max length: 100
api_secret
string required
min length: 1
max length: 100
from
string required
min length: 1
max length: 100
pattern: ^\+[0-9]{1,14}$
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.TwilioConfigPayload{
  AccountSid: util.ToPointer("AccountSid"),
  ApiKey: util.ToPointer("ApiKey"),
  ApiSecret: util.ToPointer("ApiSecret"),
  From: util.ToPointer("From"),
}

response, err := client.Integrations.SaveTwilioIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "account_sid": "ACXXXXXXXX",
  "api_key": "SKXXXXXXXX",
  "api_secret": "your_api_secret",
  "from": "+15017122661"
}

Delete a Twilio integration

DELETE/integrations/twilio
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteTwilioIntegrationRequestParams{

}

response, err := client.Integrations.DeleteTwilioIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Twilio integrations

GET/integrations/twilio
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListTwilioIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "account_sid": "ACXXXXXXXX",
  "api_key": "SKXXXXXXXX",
  "api_secret": "your_api_secret",
  "from": "+15017122661"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a Web Push installation

PUT/integrations/web_push/installations
User JWT

Request body

endpoint
string required
format: uri
keys
object required
Show child attributes
p256dh
string required
auth
string required
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"
  "github.com/magicbell/magicbell-go/pkg/user-client/util"
  "github.com/magicbell/magicbell-go/pkg/user-client/shared"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


webPushTokenPayloadKeys := shared.WebPushTokenPayloadKeys{
  Auth: util.ToPointer("Auth"),
  P256dh: util.ToPointer("P256dh"),
}

request := shared.WebPushTokenPayload{
  Endpoint: util.ToPointer("Endpoint"),
  Keys: &webPushTokenPayloadKeys,
}

response, err := client.Integrations.SaveWebPushInstallation(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "keys": {
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0",
    "auth": "GoIO2ulhtQuyBM64lZuFuw"
  }
}

Start a Web Push installation

POST/integrations/web_push/installations/start
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.StartWebPushInstallation(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "public_key": "BHaJd...gRHDk",
  "auth_token": "eyGhb...GA2Bw"
}

Save a Web Push integration

PUT/integrations/web_push
Project JWT

Request body

private_key
string required
min length: 8
max length: 128
public_key
string required
min length: 8
max length: 128
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := integrations.WebpushConfigPayload{
  PrivateKey: util.ToPointer("PrivateKey"),
  PublicKey: util.ToPointer("PublicKey"),
}

response, err := client.Integrations.SaveWebPushIntegration(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "public_key": "BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw",
  "private_key": "y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"
}

Delete a Web Push integration

DELETE/integrations/web_push
Project JWT

Query parameters

id
string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/integrations"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := integrations.DeleteWebPushIntegrationRequestParams{

}

response, err := client.Integrations.DeleteWebPushIntegration(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all Web Push integrations

GET/integrations/web_push
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Integrations.ListWebPushIntegrations(context.Background())
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
    "name": "<provider-name>",
    "id": "123",
    "config": {
  "public_key": "BNKZeSrRX_c3QfqzOvv1oshpj1qPbDcUJHKET6Ahs2u9-F4HgllPYxtgaGvGSqfytuALumX5NYZPLD8YmCwBxcw",
  "private_key": "y56TIPdEzrQ0Ku_uQbGGkB84mYdF9pJl5IHvmAZ_fVs"
}

  }],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Archive all notifications

POST/notifications/archive
User JWT

Query parameters

category
nullable string
topic
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/notifications"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := notifications.ArchiveAllNotificationsRequestParams{

}

response, err := client.Notifications.ArchiveAllNotifications(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Mark all notifications read

POST/notifications/read
User JWT

Query parameters

category
nullable string
topic
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/notifications"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := notifications.MarkAllNotificationsReadRequestParams{

}

response, err := client.Notifications.MarkAllNotificationsRead(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Fetch a notification

GET/notifications/{notification_id}
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Notifications.FetchNotification(context.Background(), "notificationId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "4b6efd21-f0f6-4051-8922-cc8c90a3dc5d",
  "title": "Example Notification",
  "action_url": null,
  "seen_at": null,
  "read_at": null,
  "project_id": 7,
  "user_id": "d4121424-097e-40b0-9cc8-357060d004b2",
  "created_at": "2024-09-11T11:14:42.165Z",
  "updated_at": "2024-09-11T11:14:42.165Z",
  "custom_attributes": { "key": "value", "obj_key": { "one": "two" } },
  "metadata": {},
  "category_id": null,
  "notification_broadcast_id": "6a8b1e23-f54b-4c65-95b2-78f288d7f247",
  "in_app": true,
  "discarded_at": null,
  "overrides": {},
  "aasm_state": "unseen",
  "archived_at": null,
  "topic_id": null
}

Unarchive a notification

POST/notifications/{notification_id}/unarchive
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Notifications.UnarchiveNotification(context.Background(), "notificationId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Archive a notification

POST/notifications/{notification_id}/archive
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Notifications.ArchiveNotification(context.Background(), "notificationId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Mark a notification read

POST/notifications/{notification_id}/read
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Notifications.MarkNotificationRead(context.Background(), "notificationId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Mark a notification unread

POST/notifications/{notification_id}/unread
User JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Notifications.MarkNotificationUnread(context.Background(), "notificationId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

List all notifications

GET/notifications
User JWT

Query parameters

category
nullable string
ending_before
nullable string
limit
integer
starting_after
nullable string
status
nullable string
topic
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/user-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/user-client/client"

  "github.com/magicbell/magicbell-go/pkg/user-client/notifications"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := notifications.ListNotificationsRequestParams{

}

response, err := client.Notifications.ListNotifications(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "id": "4b6efd21-f0f6-4051-8922-cc8c90a3dc5d",
  "title": "Example Notification",
  "action_url": null,
  "seen_at": null,
  "read_at": null,
  "project_id": 7,
  "user_id": "d4121424-097e-40b0-9cc8-357060d004b2",
  "created_at": "2024-09-11T11:14:42.165Z",
  "updated_at": "2024-09-11T11:14:42.165Z",
  "custom_attributes": { "key": "value", "obj_key": { "one": "two" } },
  "metadata": {},
  "category_id": null,
  "notification_broadcast_id": "6a8b1e23-f54b-4c65-95b2-78f288d7f247",
  "in_app": true,
  "discarded_at": null,
  "overrides": {},
  "aasm_state": "unseen",
  "archived_at": null,
  "topic_id": null
}
],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Save a user

PUT/users
Project JWT

Request body

created_at
nullable string
format: date-time
custom_attributes
nullable object
email
nullable string
external_id
nullable string
first_name
nullable string
id
string
format: uuid
last_name
nullable string
last_notified_at
nullable string
format: date-time
last_seen_at
nullable string
format: date-time
updated_at
nullable string
format: date-time
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"
  "github.com/magicbell/magicbell-go/pkg/project-client/util"
  "github.com/magicbell/magicbell-go/pkg/project-client/shared"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


request := shared.User{
  CreatedAt: util.ToPointer(util.Nullable[string]{ Value: "CreatedAt" }),
  CustomAttributes: []byte{},
  Email: util.ToPointer(util.Nullable[string]{ Value: "Email" }),
  ExternalId: util.ToPointer(util.Nullable[string]{ Value: "ExternalId" }),
  FirstName: util.ToPointer(util.Nullable[string]{ Value: "FirstName" }),
  Id: util.ToPointer("Id"),
  LastName: util.ToPointer(util.Nullable[string]{ Value: "LastName" }),
  LastNotifiedAt: util.ToPointer(util.Nullable[string]{ Value: "LastNotifiedAt" }),
  LastSeenAt: util.ToPointer(util.Nullable[string]{ Value: "LastSeenAt" }),
  UpdatedAt: util.ToPointer(util.Nullable[string]{ Value: "UpdatedAt" }),
}

response, err := client.Users.SaveUser(context.Background(), request)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "id": "8a038704-acc1-47f9-81b0-7523886cbeae",
  "external_id": "external-id",
  "email": "dan@example.com",
  "first_name": "Dan",
  "last_name": "Example",
  "custom_attributes": {
    "key": "value"
  }
}

Delete a user

DELETE/users/{user_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Users.DeleteUser(context.Background(), "userId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{}

Fetch an user's APNs token

GET/users/{user_id}/channels/mobile_push/apns/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserApnsToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's APNs token

DELETE/users/{user_id}/channels/mobile_push/apns/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserApnsToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's APNs tokens

GET/users/{user_id}/channels/mobile_push/apns/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserApnsTokensRequestParams{

}

response, err := client.Channels.ListUserApnsTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's Expo token

GET/users/{user_id}/channels/mobile_push/expo/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserExpoToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's Expo token

DELETE/users/{user_id}/channels/mobile_push/expo/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserExpoToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's Expo tokens

GET/users/{user_id}/channels/mobile_push/expo/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserExpoTokensRequestParams{

}

response, err := client.Channels.ListUserExpoTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's FCM token

GET/users/{user_id}/channels/mobile_push/fcm/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserFcmToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's FCM token

DELETE/users/{user_id}/channels/mobile_push/fcm/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserFcmToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's FCM tokens

GET/users/{user_id}/channels/mobile_push/fcm/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserFcmTokensRequestParams{

}

response, err := client.Channels.ListUserFcmTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "device_token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "installation_id": "development",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's Inbox token

GET/users/{user_id}/channels/in_app/inbox/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserInboxToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's Inbox token

DELETE/users/{user_id}/channels/in_app/inbox/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserInboxToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's Inbox tokens

GET/users/{user_id}/channels/in_app/inbox/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserInboxTokensRequestParams{

}

response, err := client.Channels.ListUserInboxTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "token": "eH0fLhuiRj2Np7UQ-opXAm:APA91bGtC-wH4sgW1jWkMKIZf7FYkm_RTQb7Jid7DfSJnCgivGYoRzhLrGxpcIF6yPjmbzAr6CKF-6phZkBasFUUfZmfdgcqfA_ZlZdVk6pSnon3LGzMumCzEJE0zgWoo_RUmVUVJUAt",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's Slack token

GET/users/{user_id}/channels/slack/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserSlackToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z",
  "webhook": {
    "url": "https://example.com/webhook"
  }
}

Delete an user's Slack token

DELETE/users/{user_id}/channels/slack/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserSlackToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's Slack tokens

GET/users/{user_id}/channels/slack/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserSlackTokensRequestParams{

}

response, err := client.Channels.ListUserSlackTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z",
  "webhook": {
    "url": "https://example.com/webhook"
  }
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's Teams token

GET/users/{user_id}/channels/teams/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserTeamsToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's Teams token

DELETE/users/{user_id}/channels/teams/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserTeamsToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's Teams tokens

GET/users/{user_id}/channels/teams/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserTeamsTokensRequestParams{

}

response, err := client.Channels.ListUserTeamsTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "id": "123",
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

Fetch an user's Web Push token

GET/users/{user_id}/channels/web_push/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.FetchUserWebPushToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "id": "123",
  "keys": {
    "auth": "GoIO2ulhtQuyBM64lZuFuw",
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
  },
  "updated_at": "2021-01-01T00:00:00Z"
}

Delete an user's Web Push token

DELETE/users/{user_id}/channels/web_push/tokens/{token_id}
Project JWT
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

)

config := clientconfig.NewConfig()
client := client.NewClient(config)

response, err := client.Channels.DeleteUserWebPushToken(context.Background(), "userId", "tokenId")
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "id": "123",
    "discarded_at": "2021-01-01T00:00:00Z"
  }

List an user's Web Push tokens

GET/users/{user_id}/channels/web_push/tokens
Project JWT

Query parameters

ending_before
nullable string
limit
integer
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/channels"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := channels.ListUserWebPushTokensRequestParams{

}

response, err := client.Channels.ListUserWebPushTokens(context.Background(), "userId", params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "created_at": "2021-01-01T00:00:00Z",
  "discarded_at": "2021-01-01T00:00:00Z",
  "endpoint": "https://fcm.googleapis.com/fcm/send/fZhR0fsr0zw:APA91bE4pM-qo1KBJDU_Zp2N9nDP-Jdmwugm-v4KNL_NlJvYCrJeJUzPXmMyAXqAE0m6BFOrkSWT0ArGbUjEEpxQEYZLado8JeW1PZA5CHB8R6C7HT6-MD6Qs8ZaCn8_ffLGGU7WuvtN",
  "id": "123",
  "keys": {
    "auth": "GoIO2ulhtQuyBM64lZuFuw",
    "p256dh": "BICAe4KtLhhPNFvynlqMRxjvpRnr94881QeuTCr8kCwJf-Fssj3FLIlnfFMjj7T1yNg5l6cn14350323_NSGZh0"
  },
  "updated_at": "2021-01-01T00:00:00Z"
}],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }

List all users

GET/users
Project JWT

Query parameters

ending_before
nullable string
limit
integer
query
nullable string
starting_after
nullable string
Request
import (
  "fmt"
  "encoding/json"
  "github.com/magicbell/magicbell-go/pkg/project-client/clientconfig"
  "github.com/magicbell/magicbell-go/pkg/project-client/client"

  "github.com/magicbell/magicbell-go/pkg/project-client/users"
)

config := clientconfig.NewConfig()
client := client.NewClient(config)


params := users.ListUsersRequestParams{

}

response, err := client.Users.ListUsers(context.Background(), params)
if err != nil {
  panic(err)
}

fmt.Println(response)
Response
{
    "data":[{
  "id": "8a038704-acc1-47f9-81b0-7523886cbeae",
  "external_id": "external-id",
  "email": "dan@example.com",
  "first_name": "Dan",
  "last_name": "Example",
  "custom_attributes": {
    "key": "value"
  }
}
],
    "links": {
      "first":"https://api.magicbell.com/v1/example",
      "next":"https://api.magicbell.com/v1/example?page_next=abc",
      "prev":null
    }
  }