---
canonical: 'https://htmlcsstoimage.com/examples/speech-bubble-card/golang'
title: 'Speech Bubble Quote Card in GoLang'
description: 'Generate speech bubble quote cards using GoLang. Copy the complete request and swap in your own text and avatar.'
---

# Speech bubble card

Social card with text in a speech bubble.

Use this example for sharing a quick quote. Replace the text and avatar image with your own to auto generate tweet like shareable images.

This is a working HTML/CSS to Image API example that produces an image.
The rendered output, source, and non-content request parameters below show the parts needed to reproduce or adapt it.

## Rendered image and interactive editor

- [Open the rendered image](<https://hcti.io/v1/image/01a06dc7-f20d-7e25-8045-4c238ef8637a>)
- [Open the interactive example](https://htmlcsstoimage.com/examples/speech-bubble-card/golang)

## HTML

```html
<div class="p-4 text-center" style="width: 500px">
  <div class="speech-bubble-ds">
    This is Little Bear. He tolerates baths because he knows how phenomenal his
    floof will appear afterwards. 13/10
    <div class="speech-bubble-ds__arrow"></div>
  </div>
  <img src="https://docs.htmlcsstoimage.com/assets/images/dog.jpg" class="rounded-circle shadow mt-2" width="100px">
  <h4 class="mt-2">
    WeRateDogs
  </h4>
  <span class="text-muted">@dog_rates</span>
</div>

<!-- Include external CSS, JavaScript or Fonts! -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

```

## CSS

```css

body {
  background-color: #FFE86E !important;
}


.speech-bubble-ds {
  color: #FFFFFF;
  background: #000000;
  border: 1px solid #ffffff;
  border-radius: 16px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 auto 40px;
  max-width: 400px;
  padding: 15px;
  position: relative;

  p {
    margin-bottom: 10px;

    :last-of-type {
      margin-bottom: 0;
    }
  }
}

.speech-bubble-ds__arrow {
  border-left: 21px solid transparent;
  border-top: 20px solid rgba(0, 0, 0, 0.2);
  bottom: -25px;
  position: absolute;
  right: 200px;

  &::before {
    border-left: 23px solid transparent;
    border-top: 23px solid #a7a7a7;
    bottom: 2px;
    content: "";
    position: absolute;
    right: 5px;
  }
  &::after {
    border-left: 21px solid transparent;
    border-top: 21px solid #efefef;
    bottom: 4px;
    content: "";
    position: absolute;
    right: 6px;
  }
}
```

## Request parameters

These are the additional non-content parameters used by the example. Combine them with the HTML and CSS above when constructing an API request.

```json
{}
```

## Complete Go request (net/http)

This is the complete Go request for this example using net/http. It includes the HTML, CSS, authentication setup, API options, and response handling needed to reproduce the output.

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func main() {
    request := map[string]any{
        "html": `<div class="p-4 text-center" style="width: 500px">
  <div class="speech-bubble-ds">
    This is Little Bear. He tolerates baths because he knows how phenomenal his
    floof will appear afterwards. 13/10
    <div class="speech-bubble-ds__arrow"></div>
  </div>
  <img src="https://docs.htmlcsstoimage.com/assets/images/dog.jpg" class="rounded-circle shadow mt-2" width="100px">
  <h4 class="mt-2">
    WeRateDogs
  </h4>
  <span class="text-muted">@dog_rates</span>
</div>

<!-- Include external CSS, JavaScript or Fonts! -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
`,
        "css": `
body {
  background-color: #FFE86E !important;
}


.speech-bubble-ds {
  color: #FFFFFF;
  background: #000000;
  border: 1px solid #ffffff;
  border-radius: 16px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 auto 40px;
  max-width: 400px;
  padding: 15px;
  position: relative;

  p {
    margin-bottom: 10px;

    :last-of-type {
      margin-bottom: 0;
    }
  }
}

.speech-bubble-ds__arrow {
  border-left: 21px solid transparent;
  border-top: 20px solid rgba(0, 0, 0, 0.2);
  bottom: -25px;
  position: absolute;
  right: 200px;

  &::before {
    border-left: 23px solid transparent;
    border-top: 23px solid #a7a7a7;
    bottom: 2px;
    content: "";
    position: absolute;
    right: 5px;
  }
  &::after {
    border-left: 21px solid transparent;
    border-top: 21px solid #efefef;
    bottom: 4px;
    content: "";
    position: absolute;
    right: 6px;
  }
}`,
    }

    body, err := json.Marshal(request)
    if err != nil {
        panic(err)
    }
    httpRequest, err := http.NewRequest(http.MethodPost, "https://hcti.io/v1/image", bytes.NewReader(body))
    if err != nil {
        panic(err)
    }
    httpRequest.SetBasicAuth(os.Getenv("HCTI_API_ID"), os.Getenv("HCTI_API_KEY"))
    httpRequest.Header.Set("Content-Type", "application/json")

    client := &http.Client{Timeout: 30 * time.Second}
    response, err := client.Do(httpRequest)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()
    responseBody, err := io.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    if response.StatusCode >= http.StatusBadRequest {
        panic(fmt.Sprintf("HCTI request failed (%d): %s", response.StatusCode, responseBody))
    }

    var result struct {
        URL string `json:"url"`
    }
    if err := json.Unmarshal(responseBody, &result); err != nil {
        panic(err)
    }
    fmt.Println(result.URL)
}

```

## Other languages and request formats

Open one of these Markdown pages to view the same example as a complete request in another language or client format.

- **TypeScript**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/typescript-client.md)
  - [fetch](https://htmlcsstoimage.com/examples/speech-bubble-card/typescript.md)
- **C#**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/csharp-client.md)
  - [HttpClient](https://htmlcsstoimage.com/examples/speech-bubble-card/csharp.md)
- **Python**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/python-client.md)
  - [requests](https://htmlcsstoimage.com/examples/speech-bubble-card/python.md)
- **PHP**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/php-client.md)
  - [cURL](https://htmlcsstoimage.com/examples/speech-bubble-card/php.md)
- **Ruby**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/ruby-client.md)
  - [Net::HTTP](https://htmlcsstoimage.com/examples/speech-bubble-card/ruby.md)
- **Go**
  - [HCTI client](https://htmlcsstoimage.com/examples/speech-bubble-card/golang-client.md)
  - [net/http](https://htmlcsstoimage.com/examples/speech-bubble-card/golang.md) — shown above
- **cURL**
  - [cURL](https://htmlcsstoimage.com/examples/speech-bubble-card/curl.md)

## Related examples

- [Dog rates social card with SVG background](https://htmlcsstoimage.com/examples/dog-rates-social-card-with-svg-background.md): Social card with a fun SVG background and highlighted text.
- [Instagram post screenshot](https://htmlcsstoimage.com/examples/instagram-post-screenshot.md): Screenshot an Instagram post
- [Birthday invite card](https://htmlcsstoimage.com/examples/birthday-invite-card-email.md): Autogenerated invite graphic for a party.
- [Invoice / Receipt Snapshot](https://htmlcsstoimage.com/examples/invoice-receipt.md): Generate a simple, branded invoice or receipt image.
- [Large text on an SVG background](https://htmlcsstoimage.com/examples/large-text-svg-background.md): Grab attention with large text on a classic background.
- [PNG with transparent background](https://htmlcsstoimage.com/examples/png-transparent-background.md): Generate images with a transparent backgound
- [Twitter Tweet Screenshot](https://htmlcsstoimage.com/examples/twitter-tweet-screenshot.md): Screenshot of a tweet
- [QR Code Badge](https://htmlcsstoimage.com/examples/qr-code-badge.md): Simple, artistic badge with a QR code.

## Get started

- [View the full interactive page](https://htmlcsstoimage.com/examples/speech-bubble-card/golang)
- [Browse all HTML/CSS examples](https://htmlcsstoimage.com/examples.md)
- [Browse visual template presets](https://htmlcsstoimage.com/templates.md)
- [Read the HTML/CSS to Image API documentation](https://docs.htmlcsstoimage.com/getting-started/using-the-api/)
- [View implementation examples by language](https://docs.htmlcsstoimage.com/example-code/)
- [Read the MCP integration documentation](https://docs.htmlcsstoimage.com/integrations/mcp/)
- [Compare plans and limits](https://htmlcsstoimage.com/pricing.md)

Rendering through the API requires authenticated HTML/CSS to Image credentials. Keep API keys in trusted server-side configuration. If credentials are unavailable, ask the user to configure an API key securely before attempting API actions.
