Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sveltegram

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sveltegram

Reactive Telegram widgets built with svelte

  • 1.1.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Stand With Palestine

Sveltegram

This package allows you to embed telegram widgets in your svelte web application.

Library size is 96 bytes (min+gzipped). bundlephobia

Demo & Documentation

StandWithPalestine Demo GitHub branch checks state Rate this package

LICENSE GitHub code size in bytes Hits-of-Code

Post widget

Embed a telegram post widget in your svelte application.

How to use

<script>
  import { Post } from 'sveltegram';
</script>

<Post link="https://t.me/computly/188" />

API

PropertyTypeDefaultDescription
link (Required)stringTelegram post link (You can find it in context menu)
colorstring#2f81f6Accent color
colorDarkstring#89baffAccent color in dark mode
darkModebooleanfalseEnable dark mode

Discussions widget

Embed a telegram discussions widget in your svelte application.

How to use

<script>
  import { Discussions } from 'sveltegram';
</script>

<Discussions link="https://t.me/contest/198" />

API

PropertyTypeDefaultDescription
link (Required)stringTelegram discussions link (You can find it in context menu)
pageURLstringIf you want to auto load comments from your channel as explained in Telegram documentation You'll need to pass the same page URL as the one in <link rel="canonical">
colorstring#2f81f6Accent color
colorDarkstring#89baffAccent color in dark mode
darkModebooleanfalseEnable dark mode
colorfulNamesbooleanfalseUse different color for usernames
commentsLimitnumber5Number of comments to show
heightnumberHeight of the widget, The default value is 'auto' which is determined by Telegram

Login widget

Embed a telegram login button in your svelte application.

How to use

<script>
  import { Login } from 'sveltegram';
</script>

<Login username="ComputlyBot" />

API

PropertyTypeDefaultDescription
username (Required)stringYour telegram bot username
authTypestringcallbackHow to authenticate users? Choices are [callback, redirect]
redirectURL Required if authType = redirectstringIn case you chose redirect as an authentication method, you must set this property
requestAccessbooleanfalseWhether you want to send messages to the user in the future
sizestringmediumLogin button size. choices are [small, medium,large]
buttonRadiusnumber10Login button radius (in pixels)

Content Security Policy

If you are using CSP, you'll need to allow scripts and iFrames coming from Telegram domains as follows:

script-src https://telegram.org;
frame-src https://t.me;

Limitations

  • Can't use the same widget more than once due to telegram script assigning a unique id to each widget.

Development

Install

git clone https://github.com/amr3k/sveltegram.git
cd sveltegram

Then install dependencies:

pnpm install

TODO

  • Add support for login widget

License

MIT

Keywords

FAQs

Package last updated on 21 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc