Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 23:15 UTC
feat: add Gmail Filterer example
balyan.sid@gmail.com committed
Jun 26, 2025 at 21:47 UTC
f218296f75cc7972fba8765cbc4a977ced031ca4
9 files changed
+426
-1122
fern/assets/images/examples/ai-email-labels.png
Binary files /dev/null and b/fern/assets/images/examples/ai-email-labels.png differ
fern/assets/images/examples/gmail-agent-trace.png
Binary files /dev/null and b/fern/assets/images/examples/gmail-agent-trace.png differ
fern/assets/images/examples/trigger-config.png
Binary files /dev/null and b/fern/assets/images/examples/trigger-config.png differ
fern/assets/images/examples/webhook-secret.png
Binary files /dev/null and b/fern/assets/images/examples/webhook-secret.png differ
fern/docs.yml
+1
-1099
@@ -198,7 +198,7 @@ navigation:
198
icon: zap
199
skip-slug: true
200
contents:
201
- - page: Gmail Reaper
201
+ - page: AI Gmail Labeller
202
path: pages/dist/examples/gmail-filterer.mdx
203
slug: examples/gmail-reaper
204
- section: Behind the curtain
@@ -254,1119 +254,21 @@ navigation:
254
- page: Gmail
255
slug: tools/gmail
256
path: tools/gmail.mdx
257
- - page: Googlesheets
258
- slug: tools/googlesheets
259
- path: tools/googlesheets.mdx
257
- page: Notion
258
slug: tools/notion
259
path: tools/notion.mdx
263
- - page: Shopify
264
- slug: tools/shopify
265
- path: tools/shopify.mdx
266
- - page: Stripe
267
- slug: tools/stripe
268
- path: tools/stripe.mdx
269
- - page: Twitter
270
- slug: tools/twitter
271
- path: tools/twitter.mdx
272
- - section: Crm
273
- skip-slug: true
274
- contents:
275
- - page: Acculynx
276
- slug: tools/acculynx
277
- path: tools/acculynx.mdx
278
- - page: Affinity
279
- slug: tools/affinity
280
- path: tools/affinity.mdx
281
- - page: Agencyzoom
282
- slug: tools/agencyzoom
283
- path: tools/agencyzoom.mdx
284
- - page: Apollo
285
- slug: tools/apollo
286
- path: tools/apollo.mdx
287
- - page: Attio
288
- slug: tools/attio
289
- path: tools/attio.mdx
290
- - page: Close
291
- slug: tools/close
292
- path: tools/close.mdx
293
- - page: Dynamics365
294
- slug: tools/dynamics365
295
- path: tools/dynamics365.mdx
296
- - page: Freshdesk
297
- slug: tools/freshdesk
298
- path: tools/freshdesk.mdx
299
- - page: Gorgias
300
- slug: tools/gorgias
301
- path: tools/gorgias.mdx
302
- - page: Hubspot
303
- slug: tools/hubspot
304
- path: tools/hubspot.mdx
305
- - page: Intercom
306
- slug: tools/intercom
307
- path: tools/intercom.mdx
308
- - page: Kommo
309
- slug: tools/kommo
310
- path: tools/kommo.mdx
311
- - page: Pipedrive
312
- slug: tools/pipedrive
313
- path: tools/pipedrive.mdx
314
- - page: Salesforce
315
- slug: tools/salesforce
316
- path: tools/salesforce.mdx
317
- - page: Simplesat
318
- slug: tools/simplesat
319
- path: tools/simplesat.mdx
320
- - page: Zendesk
321
- slug: tools/zendesk
322
- path: tools/zendesk.mdx
323
- - page: Zoho
324
- slug: tools/zoho
325
- path: tools/zoho.mdx
326
- - page: Zoominfo
327
- slug: tools/zoominfo
328
- path: tools/zoominfo.mdx
329
- - section: Analytics & Data
330
- skip-slug: true
331
- contents:
332
- - page: Amplitude
333
- slug: tools/amplitude
334
- path: tools/amplitude.mdx
335
- - page: Browseai
336
- slug: tools/browseai
337
- path: tools/browseai.mdx
338
- - page: Exa
339
- slug: tools/exa
340
- path: tools/exa.mdx
341
- - page: Firecrawl
342
- slug: tools/firecrawl
343
- path: tools/firecrawl.mdx
344
- - page: Fireflies
345
- slug: tools/fireflies
346
- path: tools/fireflies.mdx
347
- - page: Googlebigquery
348
- slug: tools/googlebigquery
349
- path: tools/googlebigquery.mdx
350
- - page: Kibana
351
- slug: tools/kibana
352
- path: tools/kibana.mdx
353
- - page: Microsoft Clarity
354
- slug: tools/microsoft_clarity
355
- path: tools/microsoft_clarity.mdx
356
- - page: Mixpanel
357
- slug: tools/mixpanel
358
- path: tools/mixpanel.mdx
359
- - page: Peopledatalabs
360
- slug: tools/peopledatalabs
361
- path: tools/peopledatalabs.mdx
362
- - page: Placekey
363
- slug: tools/placekey
364
- path: tools/placekey.mdx
365
- - page: Posthog
366
- slug: tools/posthog
367
- path: tools/posthog.mdx
368
- - page: Serpapi
369
- slug: tools/serpapi
370
- path: tools/serpapi.mdx
371
- - page: Servicenow
372
- slug: tools/servicenow
373
- path: tools/servicenow.mdx
374
- - page: Snowflake
375
- slug: tools/snowflake
376
- path: tools/snowflake.mdx
377
- - page: Tavily
378
- slug: tools/tavily
379
- path: tools/tavily.mdx
380
- - section: Collaboration & Communication
381
- skip-slug: true
382
- contents:
383
- - page: Chatwork
384
- slug: tools/chatwork
385
- path: tools/chatwork.mdx
386
- - page: Dailybot
387
- slug: tools/dailybot
388
- path: tools/dailybot.mdx
389
- - page: Dialpad
390
- slug: tools/dialpad
391
- path: tools/dialpad.mdx
392
- - page: Discordbot
393
- slug: tools/discordbot
394
- path: tools/discordbot.mdx
395
- - page: Echtpost
396
- slug: tools/echtpost
397
- path: tools/echtpost.mdx
398
- - page: Googlemeet
399
- slug: tools/googlemeet
400
- path: tools/googlemeet.mdx
401
- - page: Microsoft Teams
402
- slug: tools/microsoft_teams
403
- path: tools/microsoft_teams.mdx
404
- - page: Outlook
405
- slug: tools/outlook
406
- path: tools/outlook.mdx
407
- - page: Retellai
408
- slug: tools/retellai
409
- path: tools/retellai.mdx
410
- - page: Share Point
411
- slug: tools/share_point
412
- path: tools/share_point.mdx
413
- - page: Slackbot
414
- slug: tools/slackbot
415
- path: tools/slackbot.mdx
416
- - page: Zoom
417
- slug: tools/zoom
418
- path: tools/zoom.mdx
419
- - section: Productivity & Project Management
420
- skip-slug: true
421
- contents:
422
- - page: Airtable
423
- slug: tools/airtable
424
- path: tools/airtable.mdx
425
- - page: Clickup
426
- slug: tools/clickup
427
- path: tools/clickup.mdx
428
- - page: Coda
429
- slug: tools/coda
430
- path: tools/coda.mdx
431
- - page: Googledocs
432
- slug: tools/googledocs
433
- path: tools/googledocs.mdx
434
- - page: Googletasks
435
- slug: tools/googletasks
436
- path: tools/googletasks.mdx
437
- - page: Linear
438
- slug: tools/linear
439
- path: tools/linear.mdx
440
- - page: Linkhut
441
- slug: tools/linkhut
442
- path: tools/linkhut.mdx
443
- - page: Monday
444
- slug: tools/monday
445
- path: tools/monday.mdx
446
- - page: Onepage
447
- slug: tools/onepage
448
- path: tools/onepage.mdx
449
- - page: Shortcut
450
- slug: tools/shortcut
451
- path: tools/shortcut.mdx
452
- - page: Todoist
453
- slug: tools/todoist
454
- path: tools/todoist.mdx
455
- - page: Wrike
456
- slug: tools/wrike
457
- path: tools/wrike.mdx
458
- - section: Developer Tools & Devops
459
- skip-slug: true
460
- contents:
461
- - page: Ably
462
- slug: tools/ably
463
- path: tools/ably.mdx
464
- - page: Baserow
465
- slug: tools/baserow
466
- path: tools/baserow.mdx
467
- - page: Bitbucket
468
- slug: tools/bitbucket
469
- path: tools/bitbucket.mdx
470
- - page: Contentful
471
- slug: tools/contentful
472
- path: tools/contentful.mdx
473
- - page: Datadog
474
- slug: tools/datadog
475
- path: tools/datadog.mdx
476
- - page: Neon
477
- slug: tools/neon
478
- path: tools/neon.mdx
479
- - page: Ngrok
480
- slug: tools/ngrok
481
- path: tools/ngrok.mdx
482
- - page: Pagerduty
483
- slug: tools/pagerduty
484
- path: tools/pagerduty.mdx
485
- - page: Sentry
486
- slug: tools/sentry
487
- path: tools/sentry.mdx
488
- - page: Supabase
489
- slug: tools/supabase
490
- path: tools/supabase.mdx
491
- - page: Zenrows
492
- slug: tools/zenrows
493
- path: tools/zenrows.mdx
494
- - section: Marketing & Social Media
495
- skip-slug: true
496
- contents:
497
- - page: Active Campaign
498
- slug: tools/active_campaign
499
- path: tools/active_campaign.mdx
500
- - page: Ahrefs
501
- slug: tools/ahrefs
502
- path: tools/ahrefs.mdx
503
- - page: Amcards
504
- slug: tools/amcards
505
- path: tools/amcards.mdx
506
- - page: Brandfetch
507
- slug: tools/brandfetch
508
- path: tools/brandfetch.mdx
509
- - page: Crustdata
510
- slug: tools/crustdata
511
- path: tools/crustdata.mdx
512
- - page: Klaviyo
513
- slug: tools/klaviyo
514
- path: tools/klaviyo.mdx
515
- - page: Linkedin
516
- slug: tools/linkedin
517
- path: tools/linkedin.mdx
518
- - page: Mailchimp
519
- slug: tools/mailchimp
520
- path: tools/mailchimp.mdx
521
- - page: Reddit
522
- slug: tools/reddit
523
- path: tools/reddit.mdx
524
- - page: Sendgrid
525
- slug: tools/sendgrid
526
- path: tools/sendgrid.mdx
527
- - page: Twitter Media
528
- slug: tools/twitter_media
529
- path: tools/twitter_media.mdx
530
- - section: Ai & Machine Learning
531
- skip-slug: true
532
- contents:
533
- - page: Humanloop
534
- slug: tools/humanloop
535
- path: tools/humanloop.mdx
536
- - page: Lmnt
537
- slug: tools/lmnt
538
- path: tools/lmnt.mdx
539
- - page: Mem0
540
- slug: tools/mem0
541
- path: tools/mem0.mdx
542
- - page: Perplexityai
543
- slug: tools/perplexityai
544
- path: tools/perplexityai.mdx
545
- - page: Semanticscholar
546
- slug: tools/semanticscholar
547
- path: tools/semanticscholar.mdx
548
- - page: Textrazor
549
- slug: tools/textrazor
550
- path: tools/textrazor.mdx
551
- - page: Typefully
552
- slug: tools/typefully
553
- path: tools/typefully.mdx
554
- - section: Document & File Management
555
- skip-slug: true
556
- contents:
557
- - page: Docusign
558
- slug: tools/docusign
559
- path: tools/docusign.mdx
560
- - page: Dropbox
561
- slug: tools/dropbox
562
- path: tools/dropbox.mdx
563
- - page: Googledrive
564
- slug: tools/googledrive
565
- path: tools/googledrive.mdx
566
- - page: Googlephotos
567
- slug: tools/googlephotos
568
- path: tools/googlephotos.mdx
569
- - page: Googlesuper
570
- slug: tools/googlesuper
571
- path: tools/googlesuper.mdx
572
- - page: One Drive
573
- slug: tools/one_drive
574
- path: tools/one_drive.mdx
575
- - page: Pandadoc
576
- slug: tools/pandadoc
577
- path: tools/pandadoc.mdx
578
- - section: Other / Miscellaneous
579
- skip-slug: true
580
- contents:
581
- - page: Browserbase Tool
582
- slug: tools/browserbase_tool
583
- path: tools/browserbase_tool.mdx
584
- - page: Foursquare
585
- slug: tools/foursquare
586
- path: tools/foursquare.mdx
587
- - page: Google Maps
588
- slug: tools/google_maps
589
- path: tools/google_maps.mdx
590
- - page: Linkup
591
- slug: tools/linkup
592
- path: tools/linkup.mdx
593
- - page: More Trees
594
- slug: tools/more_trees
595
- path: tools/more_trees.mdx
596
- - page: Tinyurl
597
- slug: tools/tinyurl
598
- path: tools/tinyurl.mdx
599
- - page: Yousearch
600
- slug: tools/yousearch
601
- path: tools/yousearch.mdx
602
- - section: Productivity
603
- skip-slug: true
604
- contents:
605
- - page: Asana
606
- slug: tools/asana
607
- path: tools/asana.mdx
608
- - page: Bolna
609
- slug: tools/bolna
610
- path: tools/bolna.mdx
611
- - page: Jira
612
- slug: tools/jira
613
- path: tools/jira.mdx
614
- - page: Slack
615
- slug: tools/slack
616
- path: tools/slack.mdx
617
- - page: Trello
618
- slug: tools/trello
619
- path: tools/trello.mdx
620
- - section: Finance & Accounting
621
- skip-slug: true
622
- contents:
623
- - page: Flutterwave
624
- slug: tools/flutterwave
625
- path: tools/flutterwave.mdx
626
- - page: Quickbooks
627
- slug: tools/quickbooks
628
- path: tools/quickbooks.mdx
629
- - page: Ramp
630
- slug: tools/ramp
631
- path: tools/ramp.mdx
632
- - page: Recallai
633
- slug: tools/recallai
634
- path: tools/recallai.mdx
260
- section: Scheduling & Booking
261
skip-slug: true
262
contents:
638
- - page: Apaleo
639
- slug: tools/apaleo
640
- path: tools/apaleo.mdx
641
- - page: Cal
642
- slug: tools/cal
643
- path: tools/cal.mdx
644
- - page: Calendly
645
- slug: tools/calendly
646
- path: tools/calendly.mdx
263
- page: Googlecalendar
264
slug: tools/googlecalendar
265
path: tools/googlecalendar.mdx
650
- - section: Workflow Automation
651
- skip-slug: true
652
- contents:
653
- - page: Bannerbear
654
- slug: tools/bannerbear
655
- path: tools/bannerbear.mdx
656
- - page: Formsite
657
- slug: tools/formsite
658
- path: tools/formsite.mdx
659
- - page: Process Street
660
- slug: tools/process_street
661
- path: tools/process_street.mdx
662
- - page: Workiom
663
- slug: tools/workiom
664
- path: tools/workiom.mdx
665
- - section: Design & Creative Tools
666
- skip-slug: true
667
- contents:
668
- - page: Canva
669
- slug: tools/canva
670
- path: tools/canva.mdx
671
- - page: Figma
672
- slug: tools/figma
673
- path: tools/figma.mdx
674
- - page: Webflow
675
- slug: tools/webflow
676
- path: tools/webflow.mdx
677
- - section: Email Marketing
678
- skip-slug: true
679
- contents:
680
- - page: Bigmailer
681
- slug: tools/bigmailer
682
- path: tools/bigmailer.mdx
683
- - page: Brevo
684
- slug: tools/brevo
685
- path: tools/brevo.mdx
686
- - page: Emailoctopus
687
- slug: tools/emailoctopus
688
- path: tools/emailoctopus.mdx
689
- - section: Collaboration
690
- skip-slug: true
691
- contents:
692
- - page: Confluence
693
- slug: tools/confluence
694
- path: tools/confluence.mdx
695
- - page: Gong
696
- slug: tools/gong
697
- path: tools/gong.mdx
698
- - section: Education & Lms
699
- skip-slug: true
700
- contents:
701
- - page: Canvas
702
- slug: tools/canvas
703
- path: tools/canvas.mdx
704
- - page: D2Lbrightspace
705
- slug: tools/d2lbrightspace
706
- path: tools/d2lbrightspace.mdx
707
- - section: Finance
708
- skip-slug: true
709
- contents:
710
- - page: Altoviz
711
- slug: tools/altoviz
712
- path: tools/altoviz.mdx
713
- - page: Finage
714
- slug: tools/finage
715
- path: tools/finage.mdx
716
- - section: Time Tracking
717
- skip-slug: true
718
- contents:
719
- - page: Clockify
720
- slug: tools/clockify
721
- path: tools/clockify.mdx
722
- - page: Timecamp
723
- slug: tools/timecamp
724
- path: tools/timecamp.mdx
725
- - section: Web Scraping
726
- skip-slug: true
727
- contents:
728
- - page: Scrape Do
729
- slug: tools/scrape_do
730
- path: tools/scrape_do.mdx
731
- - page: Scrapingant
732
- slug: tools/scrapingant
733
- path: tools/scrapingant.mdx
734
- - section: Accounting
735
- skip-slug: true
736
- contents:
737
- - page: Bill
738
- slug: tools/bill
739
- path: tools/bill.mdx
740
- - section: Advertising & Marketing
741
- skip-slug: true
742
- contents:
743
- - page: Googleads
744
- slug: tools/googleads
745
- path: tools/googleads.mdx
746
- - section: Ai Video
747
- skip-slug: true
748
- contents:
749
- - page: Heygen
750
- slug: tools/heygen
751
- path: tools/heygen.mdx
752
- - section: Api
753
- skip-slug: true
754
- contents:
755
- - page: Screenshotone
756
- slug: tools/screenshotone
757
- path: tools/screenshotone.mdx
758
- - section: Blockchain
759
- skip-slug: true
760
- contents:
761
- - page: Alchemy
762
- slug: tools/alchemy
763
- path: tools/alchemy.mdx
764
- - section: Browser Automation
765
- skip-slug: true
766
- contents:
767
- - page: Browserless
768
- slug: tools/browserless
769
- path: tools/browserless.mdx
770
- - section: Business Intelligence
771
- skip-slug: true
772
- contents:
773
- - page: Klipfolio
774
- slug: tools/klipfolio
775
- path: tools/klipfolio.mdx
776
- - section: Communication
777
- skip-slug: true
778
- contents:
779
- - page: Whatsapp
780
- slug: tools/whatsapp
781
- path: tools/whatsapp.mdx
782
- - section: Compliance
783
- skip-slug: true
784
- contents:
785
- - page: Tpscheck
786
- slug: tools/tpscheck
787
- path: tools/tpscheck.mdx
788
- - section: Cryptocurrency
789
- skip-slug: true
790
- contents:
791
- - page: Coinbase
792
- slug: tools/coinbase
793
- path: tools/coinbase.mdx
794
- - section: Data & Analytics
795
- skip-slug: true
796
- contents:
797
- - page: Excel
798
- slug: tools/excel
799
- path: tools/excel.mdx
800
- - section: Data Services
801
- skip-slug: true
802
- contents:
803
- - page: Enigma
804
- slug: tools/enigma
805
- path: tools/enigma.mdx
806
- - section: Database Management
807
- skip-slug: true
808
- contents:
809
- - page: Ragic
810
- slug: tools/ragic
811
- path: tools/ragic.mdx
812
- - section: Dev Tools
813
- skip-slug: true
814
- contents:
815
- - page: Gitlab
816
- slug: tools/gitlab
817
- path: tools/gitlab.mdx
818
- - section: E Commerce
819
- skip-slug: true
820
- contents:
821
- - page: Junglescout
822
- slug: tools/junglescout
823
- path: tools/junglescout.mdx
824
- - section: Ed
825
- skip-slug: true
826
- contents:
827
- - page: Blackboard
828
- slug: tools/blackboard
829
- path: tools/blackboard.mdx
830
- - section: Email
831
- skip-slug: true
832
- contents:
833
- - page: Resend
834
- slug: tools/resend
835
- path: tools/resend.mdx
836
- - section: Entertainment & Media
837
- skip-slug: true
838
- contents:
839
- - page: Youtube
840
- slug: tools/youtube
841
- path: tools/youtube.mdx
842
- - section: Erp
843
- skip-slug: true
844
- contents:
845
- - page: Bamboohr
846
- slug: tools/bamboohr
847
- path: tools/bamboohr.mdx
848
- - section: Financial Data
849
- skip-slug: true
850
- contents:
851
- - page: Nasdaq Data Link Time Series And Table Data
852
- slug: tools/nasdaq_data_link_time_series_and_table_data
853
- path: tools/nasdaq_data_link_time_series_and_table_data.mdx
854
- - section: Form Backend
855
- skip-slug: true
856
- contents:
857
- - page: Formcarry
858
- slug: tools/formcarry
859
- path: tools/formcarry.mdx
860
- - section: Gaming
861
- skip-slug: true
862
- contents:
863
- - page: Discord
864
- slug: tools/discord
865
- path: tools/discord.mdx
866
- - section: Incident Management
867
- skip-slug: true
868
- contents:
869
- - page: Rootly
870
- slug: tools/rootly
871
- path: tools/rootly.mdx
872
- - section: Internet Security
873
- skip-slug: true
874
- contents:
875
- - page: Nextdns
876
- slug: tools/nextdns
877
- path: tools/nextdns.mdx
878
- - section: Knowledge Base
879
- skip-slug: true
880
- contents:
881
- - page: Box
882
- slug: tools/box
883
- path: tools/box.mdx
884
- - section: Lead Generation
885
- skip-slug: true
886
- contents:
887
- - page: Leadfeeder
888
- slug: tools/leadfeeder
889
- path: tools/leadfeeder.mdx
890
- - section: Maintenance Management
891
- skip-slug: true
892
- contents:
893
- - page: Maintainx
894
- slug: tools/maintainx
895
- path: tools/maintainx.mdx
896
- - section: Marketing
897
- skip-slug: true
898
- contents:
899
- - page: Fomo
900
- slug: tools/fomo
901
- path: tools/fomo.mdx
902
- - section: Natural Language Processing
903
- skip-slug: true
904
- contents:
905
- - page: Rosette Text Analytics
906
- slug: tools/rosette_text_analytics
907
- path: tools/rosette_text_analytics.mdx
908
- - section: Networking
909
- skip-slug: true
910
- contents:
911
- - page: Cloudflare
912
- slug: tools/cloudflare
913
- path: tools/cloudflare.mdx
914
- - section: Nft
915
- skip-slug: true
916
- contents:
917
- - page: Open Sea
918
- slug: tools/open_sea
919
- path: tools/open_sea.mdx
920
- - section: Photography
921
- skip-slug: true
922
- contents:
923
- - page: Smugmug
924
- slug: tools/smugmug
925
- path: tools/smugmug.mdx
926
- - section: Podcast
927
- skip-slug: true
928
- contents:
929
- - page: Listennotes
930
- slug: tools/listennotes
931
- path: tools/listennotes.mdx
932
- - section: Project Management
933
- skip-slug: true
934
- contents:
935
- - page: Rocketlane
936
- slug: tools/rocketlane
937
- path: tools/rocketlane.mdx
938
- - section: Sales
939
- skip-slug: true
940
- contents:
941
- - page: Leadoku
942
- slug: tools/leadoku
943
- path: tools/leadoku.mdx
944
- - section: Security & Compliance
945
- skip-slug: true
946
- contents:
947
- - page: Borneo
948
- slug: tools/borneo
949
- path: tools/borneo.mdx
950
- - section: Seo
951
- skip-slug: true
952
- contents:
953
- - page: Semrush
954
- slug: tools/semrush
955
- path: tools/semrush.mdx
956
- - section: Social Media
957
- skip-slug: true
958
- contents:
959
- - page: Metaads
960
- slug: tools/metaads
961
- path: tools/metaads.mdx
962
- - section: Testing
963
- skip-slug: true
964
- contents:
965
- - page: Bugbug
966
- slug: tools/bugbug
967
- path: tools/bugbug.mdx
968
- - section: Url Shortening
969
- skip-slug: true
970
- contents:
971
- - page: Cutt Ly
972
- slug: tools/cutt_ly
973
- path: tools/cutt_ly.mdx
974
- - section: Vacation Rental Software
975
- skip-slug: true
976
- contents:
977
- - page: Lodgify
978
- slug: tools/lodgify
979
- path: tools/lodgify.mdx
980
- - section: Voice
981
- skip-slug: true
982
- contents:
983
- - page: Elevenlabs
984
- slug: tools/elevenlabs
985
- path: tools/elevenlabs.mdx
986
- - section: Web3 Development
987
- skip-slug: true
988
- contents:
989
- - page: Starton
990
- slug: tools/starton
991
- path: tools/starton.mdx
992
- - section: Website Builders
993
- skip-slug: true
994
- contents:
995
- - page: Brilliant Directories
996
- slug: tools/brilliant_directories
997
- path: tools/brilliant_directories.mdx
998
- - section: Proxy Apps
999
- skip-slug: true
1000
- contents:
1001
- - page: Accelo
1002
- slug: tools/accelo
1003
- path: tools/accelo.mdx
1004
- - page: Adobe
1005
- slug: tools/adobe
1006
- path: tools/adobe.mdx
1007
- - page: Aero Workflow
1008
- slug: tools/aero_workflow
1009
- path: tools/aero_workflow.mdx
1010
- - page: Amazon
1011
- slug: tools/amazon
1012
- path: tools/amazon.mdx
1013
- - page: Appdrag
1014
- slug: tools/appdrag
1015
- path: tools/appdrag.mdx
1016
- - page: Appsflyer
1017
- slug: tools/appsflyer
1018
- path: tools/appsflyer.mdx
1019
- - page: Ashby
1020
- slug: tools/ashby
1021
- path: tools/ashby.mdx
1022
- - page: Atlassian
1023
- slug: tools/atlassian
1024
- path: tools/atlassian.mdx
1025
- - page: Auth0
1026
- slug: tools/auth0
1027
- path: tools/auth0.mdx
1028
- - page: Axonaut
1029
- slug: tools/axonaut
1030
- path: tools/axonaut.mdx
1031
- - page: Battlenet
1032
- slug: tools/battlenet
1033
- path: tools/battlenet.mdx
1034
- - page: Beeminder
1035
- slug: tools/beeminder
1036
- path: tools/beeminder.mdx
1037
- - page: Bitwarden
1038
- slug: tools/bitwarden
1039
- path: tools/bitwarden.mdx
1040
- - page: Blackbaud
1041
- slug: tools/blackbaud
1042
- path: tools/blackbaud.mdx
1043
- - page: Boldsign
1044
- slug: tools/boldsign
1045
- path: tools/boldsign.mdx
1046
- - page: Botbaba
1047
- slug: tools/botbaba
1048
- path: tools/botbaba.mdx
1049
- - page: Braintree
1050
- slug: tools/braintree
1051
- path: tools/braintree.mdx
1052
- - page: Breezy Hr
1053
- slug: tools/breezy_hr
1054
- path: tools/breezy_hr.mdx
1055
- - page: Brex
1056
- slug: tools/brex
1057
- path: tools/brex.mdx
1058
- - page: Brex Staging
1059
- slug: tools/brex_staging
1060
- path: tools/brex_staging.mdx
1061
- - page: Brightpearl
1062
- slug: tools/brightpearl
1063
- path: tools/brightpearl.mdx
1064
- - page: Browserhub
1065
- slug: tools/browserhub
1066
- path: tools/browserhub.mdx
1067
- - page: Bubble
1068
- slug: tools/bubble
1069
- path: tools/bubble.mdx
1070
- - page: Chmeetings
1071
- slug: tools/chmeetings
1072
- path: tools/chmeetings.mdx
1073
- - page: Coinmarketcal
1074
- slug: tools/coinmarketcal
1075
- path: tools/coinmarketcal.mdx
1076
- - page: Customer Io
1077
- slug: tools/customer_io
1078
- path: tools/customer_io.mdx
1079
- - page: Datagma
1080
- slug: tools/datagma
1081
- path: tools/datagma.mdx
1082
- - page: Datarobot
1083
- slug: tools/datarobot
1084
- path: tools/datarobot.mdx
1085
- - page: Deel
1086
- slug: tools/deel
1087
- path: tools/deel.mdx
1088
- - page: Demio
1089
- slug: tools/demio
1090
- path: tools/demio.mdx
1091
- - page: Digicert
1092
- slug: tools/digicert
1093
- path: tools/digicert.mdx
1094
- - page: Docmosis
1095
- slug: tools/docmosis
1096
- path: tools/docmosis.mdx
1097
- - page: Dropbox Sign
1098
- slug: tools/dropbox_sign
1099
- path: tools/dropbox_sign.mdx
1100
- - page: Epic Games
1101
- slug: tools/epic_games
1102
- path: tools/epic_games.mdx
1103
- - page: Eventbrite
1104
- slug: tools/eventbrite
1105
- path: tools/eventbrite.mdx
1106
- - page: Exist
1107
- slug: tools/exist
1108
- path: tools/exist.mdx
1109
- - page: Facebook
1110
- slug: tools/facebook
1111
- path: tools/facebook.mdx
1112
- - page: Factorial
1113
- slug: tools/factorial
1114
- path: tools/factorial.mdx
1115
- - page: Fitbit
1116
- slug: tools/fitbit
1117
- path: tools/fitbit.mdx
1118
- - page: Freshbooks
1119
- slug: tools/freshbooks
1120
- path: tools/freshbooks.mdx
1121
- - page: Front
1122
- slug: tools/front
1123
- path: tools/front.mdx
1124
- - page: Go To Webinar
1125
- slug: tools/go_to_webinar
1126
- path: tools/go_to_webinar.mdx
1127
- - page: Google Analytics
1128
- slug: tools/google_analytics
1129
- path: tools/google_analytics.mdx
1130
- - page: Googleslides
1131
- slug: tools/googleslides
1132
- path: tools/googleslides.mdx
1133
- - page: Gumroad
1134
- slug: tools/gumroad
1135
- path: tools/gumroad.mdx
1136
- - page: Guru
1137
- slug: tools/guru
1138
- path: tools/guru.mdx
1139
- - page: Hackerrank Work
1140
- slug: tools/hackerrank_work
1141
- path: tools/hackerrank_work.mdx
1142
- - page: Harvest
1143
- slug: tools/harvest
1144
- path: tools/harvest.mdx
1145
- - page: Helcim
1146
- slug: tools/helcim
1147
- path: tools/helcim.mdx
1148
- - page: Highlevel
1149
- slug: tools/highlevel
1150
- path: tools/highlevel.mdx
1151
- - page: Icims Talent Cloud
1152
- slug: tools/icims_talent_cloud
1153
- path: tools/icims_talent_cloud.mdx
1154
- - page: Idea Scale
1155
- slug: tools/idea_scale
1156
- path: tools/idea_scale.mdx
1157
- - page: Interzoid
1158
- slug: tools/interzoid
1159
- path: tools/interzoid.mdx
1160
- - page: Keap
1161
- slug: tools/keap
1162
- path: tools/keap.mdx
1163
- - page: Lastpass
1164
- slug: tools/lastpass
1165
- path: tools/lastpass.mdx
1166
- - page: Launch Darkly
1167
- slug: tools/launch_darkly
1168
- path: tools/launch_darkly.mdx
1169
- - page: Lever
1170
- slug: tools/lever
1171
- path: tools/lever.mdx
1172
- - page: Lever Sandbox
1173
- slug: tools/lever_sandbox
1174
- path: tools/lever_sandbox.mdx
1175
- - page: Lexoffice
1176
- slug: tools/lexoffice
1177
- path: tools/lexoffice.mdx
1178
- - page: Mailerlite
1179
- slug: tools/mailerlite
1180
- path: tools/mailerlite.mdx
1181
- - page: Mboum
1182
- slug: tools/mboum
1183
- path: tools/mboum.mdx
1184
- - page: Metatextai
1185
- slug: tools/metatextai
1186
- path: tools/metatextai.mdx
1187
- - page: Microsoft Tenant
1188
- slug: tools/microsoft_tenant
1189
- path: tools/microsoft_tenant.mdx
1190
- - page: Miro
1191
- slug: tools/miro
1192
- path: tools/miro.mdx
1193
- - page: Mocean
1194
- slug: tools/mocean
1195
- path: tools/mocean.mdx
1196
- - page: Mopinion
1197
- slug: tools/mopinion
1198
- path: tools/mopinion.mdx
1199
- - page: Moxie
1200
- slug: tools/moxie
1201
- path: tools/moxie.mdx
1202
- - page: Moz
1203
- slug: tools/moz
1204
- path: tools/moz.mdx
1205
- - page: Mural
1206
- slug: tools/mural
1207
- path: tools/mural.mdx
1208
- - page: Ncscale
1209
- slug: tools/ncscale
1210
- path: tools/ncscale.mdx
1211
- - page: Netsuite
1212
- slug: tools/netsuite
1213
- path: tools/netsuite.mdx
1214
- - page: Oncehub
1215
- slug: tools/oncehub
1216
- path: tools/oncehub.mdx
1217
- - page: Piggy
1218
- slug: tools/piggy
1219
- path: tools/piggy.mdx
1220
- - page: Precoro
1221
- slug: tools/precoro
1222
- path: tools/precoro.mdx
1223
- - page: Printnode
1224
- slug: tools/printnode
1225
- path: tools/printnode.mdx
1226
- - page: Productboard
1227
- slug: tools/productboard
1228
- path: tools/productboard.mdx
1229
- - page: Qualaroo
1230
- slug: tools/qualaroo
1231
- path: tools/qualaroo.mdx
1232
- - page: Rafflys
1233
- slug: tools/rafflys
1234
- path: tools/rafflys.mdx
1235
- - page: Ravenseotools
1236
- slug: tools/ravenseotools
1237
- path: tools/ravenseotools.mdx
1238
- - page: Ring Central
1239
- slug: tools/ring_central
1240
- path: tools/ring_central.mdx
1241
- - page: Rippling
1242
- slug: tools/rippling
1243
- path: tools/rippling.mdx
1244
- - page: Rocket Reach
1245
- slug: tools/rocket_reach
1246
- path: tools/rocket_reach.mdx
1247
- - page: Sage
1248
- slug: tools/sage
1249
- path: tools/sage.mdx
1250
- - page: Seismic
1251
- slug: tools/seismic
1252
- path: tools/seismic.mdx
1253
- - page: Servicem8
1254
- slug: tools/servicem8
1255
- path: tools/servicem8.mdx
1256
- - page: Smartrecruiters
1257
- slug: tools/smartrecruiters
1258
- path: tools/smartrecruiters.mdx
1259
- - page: Square
1260
- slug: tools/square
1261
- path: tools/square.mdx
1262
- - page: Stack Exchange
1263
- slug: tools/stack_exchange
1264
- path: tools/stack_exchange.mdx
1265
- - page: Survey Monkey
1266
- slug: tools/survey_monkey
1267
- path: tools/survey_monkey.mdx
1268
- - page: Tapform
1269
- slug: tools/tapform
1270
- path: tools/tapform.mdx
1271
- - page: Terminus
1272
- slug: tools/terminus
1273
- path: tools/terminus.mdx
1274
- - page: Timekit
1275
- slug: tools/timekit
1276
- path: tools/timekit.mdx
1277
- - page: Timely
1278
- slug: tools/timely
1279
- path: tools/timely.mdx
1280
- - page: Tinypng
1281
- slug: tools/tinypng
1282
- path: tools/tinypng.mdx
1283
- - page: Tisane
1284
- slug: tools/tisane
1285
- path: tools/tisane.mdx
1286
- - page: Toneden
1287
- slug: tools/toneden
1288
- path: tools/toneden.mdx
1289
- - page: Twitch
1290
- slug: tools/twitch
1291
- path: tools/twitch.mdx
1292
- - page: Venly
1293
- slug: tools/venly
1294
- path: tools/venly.mdx
1295
- - page: Vero
1296
- slug: tools/vero
1297
- path: tools/vero.mdx
1298
- - page: Visme
1299
- slug: tools/visme
1300
- path: tools/visme.mdx
1301
- - page: Waboxapp
1302
- slug: tools/waboxapp
1303
- path: tools/waboxapp.mdx
1304
- - page: Wakatime
1305
- slug: tools/wakatime
1306
- path: tools/wakatime.mdx
1307
- - page: Wave Accounting
1308
- slug: tools/wave_accounting
1309
- path: tools/wave_accounting.mdx
1310
- - page: Webex
1311
- slug: tools/webex
1312
- path: tools/webex.mdx
1313
- - page: Wiz
1314
- slug: tools/wiz
1315
- path: tools/wiz.mdx
1316
- - page: Xero
1317
- slug: tools/xero
1318
- path: tools/xero.mdx
1319
- - page: Yandex
1320
- slug: tools/yandex
1321
- path: tools/yandex.mdx
1322
- - page: Ynab
1323
- slug: tools/ynab
1324
- path: tools/ynab.mdx
1325
- - page: Zenserp
1326
- slug: tools/zenserp
1327
- path: tools/zenserp.mdx
1328
- - page: Zoho Bigin
1329
- slug: tools/zoho_bigin
1330
- path: tools/zoho_bigin.mdx
1331
- - page: Zoho Books
1332
- slug: tools/zoho_books
1333
- path: tools/zoho_books.mdx
1334
- - page: Zoho Desk
1335
- slug: tools/zoho_desk
1336
- path: tools/zoho_desk.mdx
1337
- - page: Zoho Inventory
1338
- slug: tools/zoho_inventory
1339
- path: tools/zoho_inventory.mdx
1340
- - page: Zoho Invoice
1341
- slug: tools/zoho_invoice
1342
- path: tools/zoho_invoice.mdx
1343
- - page: Zoho Mail
1344
- slug: tools/zoho_mail
1345
- path: tools/zoho_mail.mdx
266
- section: No Auth
267
skip-slug: true
268
contents:
1349
- - page: Codeinterpreter
1350
- slug: tools/codeinterpreter
1351
- path: tools/codeinterpreter.mdx
269
- page: Composio
270
slug: tools/composio
271
path: tools/composio.mdx
1355
- - page: Composio Search
1356
- slug: tools/composio_search
1357
- path: tools/composio_search.mdx
1358
- - page: Entelligence
1359
- slug: tools/entelligence
1360
- path: tools/entelligence.mdx
1361
- - page: Hackernews
1362
- slug: tools/hackernews
1363
- path: tools/hackernews.mdx
1364
- - page: Text To Pdf
1365
- slug: tools/text_to_pdf
1366
- path: tools/text_to_pdf.mdx
1367
- - page: Weathermap
1368
- slug: tools/weathermap
1369
- path: tools/weathermap.mdx
272
- tab: sdk-reference
273
layout:
274
- section: Python
fern/fern.config.json
+1
-1
@@ -1,4 +1,4 @@
1
{
2
"organization": "composio",
3
- "version": "0.64.14"
3
+ "version": "0.60.0"
4
}
\ No newline at end of file
fern/pages/src/examples/gmail-filterer.mdx
+178
@@ -0,0 +1,178 @@
1
+---
2
+title: AI Gmail Labeller
3
+subtitle: "A Python app that uses your custom LLM prompt to label your Gmail!"
4
+image: "https://og.composio.dev/api/og?title=Full%20Stack%20Chat%20App" # image for socials
5
+keywords: ''
6
+hide-nav-links: false
7
+---
8
+Imagine having an AI assistant that automatically organizes your Gmail inbox by intelligently labeling incoming emails. That's exactly what we'll build in this tutorial.
9
+
10
+<Frame>
11
+ <img src="https://camo.githubusercontent.com/29b105fdcc2e005d8dd76bab0af33081a0567637da1061da6e1664285b843f8d/68747470733a2f2f692e696d6775722e636f6d2f515646337956582e676966" alt="Gmail Labeller" />
12
+</Frame>
13
+
14
+The complete app is available in our [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository. The app has a frontend built with Next.js along with Supabase for authentication.
15
+
16
+<Card
17
+ title="GitHub Repository"
18
+ href="https://github.com/ComposioHQ/filter-gmails-example"
19
+ icon="fa-brands fa-github"
20
+>
21
+ Explore the complete source code on GitHub
22
+</Card>
23
+
24
+In this guide, we'll focus on the Composio + OpenAI Agents part of the app
25
+
26
+## Prerequisites
27
+- Clone the [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository and set the project up locally.
28
+- Get a Composio API key. You can get one [here](https://app.composio.dev/developers).
29
+
30
+
31
+## Creating Triggers for users
32
+[Triggers](/docs/using-triggers) are a way to listen for events from apps. They act as a notification system for your AI applications, enabling your agents to respond dynamically to external events occurring within your apps.
33
+
34
+In some cases, triggers require certain configuration to set the correct events. You can inspect and add these properties while enabling the triggers.
35
+
36
+<SnippetCode
37
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L135-L156"
38
+ language="python"
39
+ title="apps/backend/email_processor.py"
40
+ highlightStart={18}
41
+ highlightEnd={22}
42
+/>
43
+
44
+Then the trigger can be created with the following code:
45
+
46
+<SnippetCode
47
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L163-L169"
48
+ language="python"
49
+ title="apps/backend/email_processor.py"
50
+/>
51
+
52
+
53
+## Listening for a trigger event
54
+<Callout type="info">
55
+For local development, you can use [ngrok](https://ngrok.com/) to expose your local server to the internet.
56
+
57
+```bash
58
+ngrok http 8000
59
+```
60
+
61
+Then you can set the ngrok URL in the trigger configuration.
62
+<Frame>
63
+ <img src="../../../assets/images/examples/trigger-config.png" alt="Trigger configuration" />
64
+</Frame>
65
+</Callout>
66
+
67
+This is the main webhook endpoint for processing Gmail new message events.
68
+
69
+Composio sends a POST request to the webhook endpoint `/composio/webhook` that contains the event data.
70
+
71
+It is parsed and then the labelling method `process_gmail_message` is called through a FastAPI Background task.
72
+
73
+```python apps/backend/main.py {1-5, 29-33} maxLines=33
74
+@app.post("/composio/webhook")
75
+async def listen_webhooks(
76
+ request: Request,
77
+ background_tasks: BackgroundTasks
78
+):
79
+ """
80
+ Main webhook endpoint for processing Gmail
81
+ new message events. This is the core webhook
82
+ labeling functionality.
83
+ """
84
+ # Verify webhook signature
85
+ # Check if this is a Gmail new message event
86
+ if (
87
+ webhook_data.get("type") == "gmail_new_message"
88
+ or "gmail" in webhook_data.get("type", "").lower()
89
+ ):
90
+ gmail_message = GmailMessage.from_composio_payload(
91
+ webhook_data
92
+ )
93
+ # Get the user's custom prompt or use default
94
+ default_prompt = (
95
+ initial_prompt or "Default email processing prompt"
96
+ )
97
+ user_prompt = get_user_prompt(
98
+ gmail_message.user_id, default_prompt
99
+ )
100
+
101
+ # Add email processing to background tasks
102
+ background_tasks.add_task(
103
+ process_gmail_message,
104
+ gmail_message,
105
+ user_prompt
106
+ )
107
+
108
+ logger.info(
109
+ f"Queued email {gmail_message.id} for processing"
110
+ )
111
+ return {"status": "received", "webhook_id": webhook_id}
112
+```
113
+
114
+## Processing the mail using OpenAI Agents SDK
115
+The `process_gmail_message` method is responsible for processing the email using the OpenAI Agents SDK.
116
+
117
+<SnippetCode
118
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L14-L24"
119
+ language="python"
120
+ title="apps/backend/email_processor.py"
121
+/>
122
+
123
+<SnippetCode
124
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L42-L45"
125
+ language="python"
126
+ title="apps/backend/email_processor.py"
127
+/>
128
+
129
+We read the first 10k characters of the email body to pass it to the agent. This is done to not overwhelm or surpass the token limits in case of really long emails.
130
+
131
+<SnippetCode
132
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L50-L60"
133
+ language="python"
134
+ title="apps/backend/email_processor.py"
135
+/>
136
+
137
+`user_filter` is the user's custom prompt from the database. We pass it to the agent along with the email body.
138
+
139
+<SnippetCode
140
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L68-L85"
141
+ language="python"
142
+ title="apps/backend/email_processor.py"
143
+/>
144
+
145
+You can view the agent trace in OpenAI's [Traces Dashboard](https://platform.openai.com/traces/).
146
+
147
+<Frame>
148
+ <img src="../../../assets/images/examples/gmail-agent-trace.png" alt="Gmail Agent Trace" />
149
+</Frame>
150
+
151
+## Securing the webhooks!
152
+It is important to validate the webhook signature to ensure the request is coming from Composio.
153
+
154
+Generate and store the webhook signature in the environment variables.
155
+
156
+<Frame>
157
+ <img src="../../../assets/images/examples/webhook-secret.png" alt="Webhook Secret" />
158
+</Frame>
159
+
160
+The webhook signature is validated in the `verify_webhook_signature` function.
161
+<SnippetCode
162
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/webhook.py#L10-L56"
163
+ language="python"
164
+ title="apps/backend/webhook.py"
165
+/>
166
+
167
+In the `/composio/webhook` endpoint, we verify the webhook signature and then parse the request body. If the signature is invalid, we return a 401 status code.
168
+
169
+<SnippetCode
170
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/main.py#L31-L38"
171
+ language="python"
172
+ title="apps/backend/main.py"
173
+/>
174
+
175
+## Inspiration
176
+This example was inspired by an X/Twitter post by [@FarzaTV](https://x.com/FarzaTV/status/1905371012369350857).
177
+
178
+We encourage you to check out the [full app](https://github.com/ComposioHQ/filter-gmails-example), fork it, build it and make it your own! Reach out to [sid@composio.dev](mailto:sid@composio.dev) for free credits ;)
fern/scripts/build-snippets.ts
+195
-22
@@ -9,8 +9,27 @@ const DOCS_SRC_DIR = path.join(import.meta.dir, '../pages/src');
9
const PAGES_DIST_DIR = path.join(import.meta.dir, '../pages/dist');
10
const PROJECT_ROOT = path.join(import.meta.dir, '../..');
11
12
+// Custom error class for SnippetCode errors
13
+class SnippetCodeError extends Error {
14
+ constructor(message: string) {
15
+ super(message);
16
+ this.name = 'SnippetCodeError';
17
+ }
18
+}
19
+
20
+// Type for parsed GitHub URL
21
+interface ParsedGitHubUrl {
22
+ owner: string;
23
+ repo: string;
24
+ branch: string;
25
+ filePath: string;
26
+ startLine?: number;
27
+ endLine?: number;
28
+}
29
+
30
interface SnippetCodeProps {
13
- src: string;
31
+ src?: string;
32
+ githubUrl?: string;
33
startLine?: number;
34
endLine?: number;
35
highlightStart?: number;
@@ -23,6 +42,99 @@ interface SnippetCodeProps {
42
path?: string;
43
}
44
45
+// Parse GitHub URL and extract components
46
+function parseGitHubUrl(url: string): ParsedGitHubUrl {
47
+ try {
48
+ // Validate URL format
49
+ const githubRegex = /^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.+?)(?:#L(\d+)(?:-L(\d+))?)?$/;
50
+ const match = url.match(githubRegex);
51
+
52
+ if (!match) {
53
+ throw new SnippetCodeError(
54
+ `Invalid GitHub URL format. Expected: https://github.com/owner/repo/blob/branch/path/to/file.ext#L1-L10\nReceived: ${url}`
55
+ );
56
+ }
57
+
58
+ const [, owner, repo, branch, filePath, startLineStr, endLineStr] = match;
59
+
60
+ return {
61
+ owner,
62
+ repo,
63
+ branch,
64
+ filePath,
65
+ startLine: startLineStr ? parseInt(startLineStr, 10) : undefined,
66
+ endLine: endLineStr ? parseInt(endLineStr, 10) : startLineStr ? parseInt(startLineStr, 10) : undefined
67
+ };
68
+ } catch (error) {
69
+ if (error instanceof SnippetCodeError) {
70
+ throw error;
71
+ }
72
+ throw new SnippetCodeError(`Failed to parse GitHub URL: ${error.message}`);
73
+ }
74
+}
75
+
76
+// Cache for GitHub content to avoid repeated fetches
77
+const githubContentCache = new Map<string, { content?: string; error?: string }>();
78
+
79
+// Fetch content from GitHub with error handling
80
+async function fetchGitHubContent(parsedUrl: ParsedGitHubUrl): Promise<{ content?: string; error?: string }> {
81
+ const cacheKey = `${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
82
+
83
+ // Check cache first
84
+ if (githubContentCache.has(cacheKey)) {
85
+ return githubContentCache.get(cacheKey)!;
86
+ }
87
+
88
+ try {
89
+ const rawUrl = `https://raw.githubusercontent.com/${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
90
+
91
+ // Create abort controller for timeout
92
+ const controller = new AbortController();
93
+ const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
94
+
95
+ const response = await fetch(rawUrl, { signal: controller.signal });
96
+ clearTimeout(timeoutId);
97
+
98
+ if (!response.ok) {
99
+ let error: string;
100
+ if (response.status === 404) {
101
+ error = `File not found: ${parsedUrl.filePath} in ${parsedUrl.owner}/${parsedUrl.repo}@${parsedUrl.branch}`;
102
+ } else {
103
+ error = `GitHub API error: ${response.status} ${response.statusText}`;
104
+ }
105
+ const result = { error };
106
+ githubContentCache.set(cacheKey, result);
107
+ return result;
108
+ }
109
+
110
+ const content = await response.text();
111
+ const result = { content };
112
+ githubContentCache.set(cacheKey, result);
113
+ return result;
114
+ } catch (error: any) {
115
+ let errorMessage: string;
116
+ if (error.name === 'AbortError') {
117
+ errorMessage = `Timeout fetching from GitHub: ${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.filePath}`;
118
+ } else if (error.message.includes('fetch')) {
119
+ errorMessage = `Network error fetching from GitHub: ${error.message}`;
120
+ } else {
121
+ errorMessage = `Error fetching from GitHub: ${error.message}`;
122
+ }
123
+ const result = { error: errorMessage };
124
+ githubContentCache.set(cacheKey, result);
125
+ return result;
126
+ }
127
+}
128
+
129
+// Extract lines from content
130
+function extractLinesFromContent(content: string, startLine?: number, endLine?: number): string {
131
+ const lines = content.split('\n');
132
+ const start = startLine ? startLine - 1 : 0;
133
+ const end = endLine ? endLine : Math.min(lines.length, 100); // Default to first 100 lines
134
+
135
+ return lines.slice(start, end).join('\n');
136
+}
137
+
138
function ensureDistDir() {
139
// Remove existing dist directory to ensure clean build
140
@@ -108,16 +220,29 @@ function generateHighlightString(
220
return `{${relativeStart}-${relativeEnd}}`;
221
}
222
111
-function parseSnippetCodeTags(content: string, contextDir: string): string {
223
+async function parseSnippetCodeTags(content: string, contextDir: string): Promise<string> {
224
const exampleCodeRegex = /<SnippetCode\s+([^>]*?)(?:\s*\/?>|>\s*<\/SnippetCode>)/g;
113
-
114
- return content.replace(exampleCodeRegex, (match, propsString) => {
225
+ const matches: Array<{ match: string; propsString: string }> = [];
226
+
227
+ let match;
228
+ while ((match = exampleCodeRegex.exec(content)) !== null) {
229
+ matches.push({ match: match[0], propsString: match[1] });
230
+ }
231
+
232
+ let result = content;
233
+
234
+ for (const { match, propsString } of matches) {
235
+ const replacement = await (async () => {
236
// Parse props from the tag
237
const props: Partial<SnippetCodeProps> = {};
238
239
// Extract src
240
const srcMatch = propsString.match(/src=["']([^"']+)["']/);
241
if (srcMatch) props.src = srcMatch[1];
242
+
243
+ // Extract githubUrl
244
+ const githubUrlMatch = propsString.match(/githubUrl=["']([^"']+)["']/);
245
+ if (githubUrlMatch) props.githubUrl = githubUrlMatch[1];
246
247
// Extract other numeric props (handle both JSX {1} and quoted "1" syntax)
248
const startLineMatch = propsString.match(/startLine=(?:["'](\d+)["']|{(\d+)})/);
@@ -169,14 +294,49 @@ function parseSnippetCodeTags(content: string, contextDir: string): string {
294
props.wordWrap = true;
295
}
296
172
- if (!props.src) {
173
- console.warn('⚠️ SnippetCode tag missing src attribute:', match);
174
- return '```\n// Error: SnippetCode tag missing src attribute\n```';
297
+ // Validate that either src or githubUrl is provided
298
+ if (!props.src && !props.githubUrl) {
299
+ const errorMessage = 'SnippetCode tag missing both src and githubUrl attributes';
300
+ console.warn(`⚠️ ${errorMessage}:`, match);
301
+ return `\`\`\`error\n${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
302
}
303
177
- // Read the file content
178
- const codeContent = readFileLines(props.src, contextDir, props.startLine, props.endLine);
179
- const langInfo = getLanguageFromPath(props.src);
304
+ let codeContent: string;
305
+ let filePath: string;
306
+ let langInfo: { syntax: string; displayName: string };
307
+
308
+ try {
309
+ if (props.githubUrl) {
310
+ // Handle GitHub URL
311
+ const parsedUrl = parseGitHubUrl(props.githubUrl);
312
+
313
+ // Fetch content from GitHub
314
+ const fetchResult = await fetchGitHubContent(parsedUrl);
315
+
316
+ if (fetchResult.error) {
317
+ console.error(`❌ SnippetCode Error: ${fetchResult.error}`);
318
+ return `\`\`\`error\nSnippetCode Error: ${fetchResult.error}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
319
+ }
320
+
321
+ // Extract lines based on URL or manual overrides
322
+ const startLine = props.startLine || parsedUrl.startLine || 1;
323
+ const endLine = props.endLine || parsedUrl.endLine || 100;
324
+
325
+ codeContent = extractLinesFromContent(fetchResult.content!, startLine, endLine);
326
+ filePath = parsedUrl.filePath;
327
+ langInfo = getLanguageFromPath(filePath);
328
+ } else {
329
+ // Handle local file
330
+ codeContent = readFileLines(props.src!, contextDir, props.startLine, props.endLine);
331
+ filePath = props.src!;
332
+ langInfo = getLanguageFromPath(filePath);
333
+ }
334
+ } catch (error) {
335
+ const errorMessage = error instanceof SnippetCodeError ? error.message : `Unexpected error: ${error.message}`;
336
+ console.error(`❌ SnippetCode Error: ${errorMessage}`);
337
+ return `\`\`\`error\nSnippetCode Error: ${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
338
+ }
339
+
340
const syntax = props.language || langInfo.syntax;
341
const displayName = langInfo.displayName;
342
@@ -206,14 +366,19 @@ function parseSnippetCodeTags(content: string, contextDir: string): string {
366
const codeBlock = `\`\`\`${syntax} ${displayName}${highlightString ? ` ${highlightString}` : ''}${titleComment} maxLines=40 ${props.wordWrap ? 'wordWrap' : ''}\n${codeContent}\n\`\`\``;
367
368
return codeBlock;
209
- });
369
+ })();
370
+
371
+ result = result.replace(match, replacement);
372
+ }
373
+
374
+ return result;
375
}
376
212
-function processFile(srcPath: string, distPath: string) {
377
+async function processFile(srcPath: string, distPath: string) {
378
try {
379
const content = fs.readFileSync(srcPath, 'utf8');
380
const contextDir = path.dirname(srcPath);
216
- const processedContent = parseSnippetCodeTags(content, contextDir);
381
+ const processedContent = await parseSnippetCodeTags(content, contextDir);
382
383
// Ensure the directory exists
384
const distDir = path.dirname(distPath);
@@ -234,11 +399,12 @@ function isMarkdownFile(filename: string): boolean {
399
return filename.endsWith('.mdx') || filename.endsWith('.md');
400
}
401
237
-function processAllFiles() {
402
+async function processAllFiles() {
403
console.log('🔄 Processing all .mdx and .md files...');
404
240
- function processDirectory(srcDir: string) {
405
+ async function processDirectory(srcDir: string) {
406
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
407
+ const promises: Promise<void>[] = [];
408
409
for (const entry of entries) {
410
const srcPath = path.join(srcDir, entry.name);
@@ -246,7 +412,7 @@ function processAllFiles() {
412
if (entry.isDirectory()) {
413
// Skip dist directory to avoid infinite loops
414
if (entry.name === 'dist') continue;
249
- processDirectory(srcPath);
415
+ promises.push(processDirectory(srcPath));
416
} else if (entry.isFile() && isMarkdownFile(entry.name)) {
417
// Calculate the relative path from the source directory
418
const relativePath = path.relative(DOCS_SRC_DIR, srcPath);
@@ -254,12 +420,14 @@ function processAllFiles() {
420
// Always preserve directory structure
421
const distPath = path.join(PAGES_DIST_DIR, relativePath);
422
257
- processFile(srcPath, distPath);
423
+ promises.push(processFile(srcPath, distPath));
424
}
425
}
426
+
427
+ await Promise.all(promises);
428
}
429
262
- processDirectory(DOCS_SRC_DIR);
430
+ await processDirectory(DOCS_SRC_DIR);
431
console.log('✅ All files processed');
432
}
433
@@ -278,7 +446,9 @@ function startWatchMode() {
446
447
if (eventType === 'change' && fs.existsSync(srcPath)) {
448
console.log(`🔄 File changed: ${filename}`);
281
- processFile(srcPath, distPath);
449
+ processFile(srcPath, distPath).catch(error => {
450
+ console.error(`❌ Error processing ${filename}:`, error);
451
+ });
452
}
453
});
454
@@ -310,13 +480,13 @@ function startWatchMode() {
480
}
481
482
// Main function
313
-function main() {
483
+async function main() {
484
console.log('🚀 Starting SnippetCode processor...');
485
console.log(`Source: ${DOCS_SRC_DIR}`);
486
console.log(`Dist: ${PAGES_DIST_DIR}`);
487
488
ensureDistDir();
319
- processAllFiles();
489
+ await processAllFiles();
490
491
// Check if we should run in watch mode
492
const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
@@ -329,4 +499,7 @@ function main() {
499
}
500
501
// Run the main function directly
332
-main();
502
+main().catch(error => {
503
+ console.error('❌ Fatal error:', error);
504
+ process.exit(1);
505
+});
fern/snippets/mcp/typescript/openai.ts
new
+51
@@ -0,0 +1,51 @@
1
+import { Composio } from '@composio/core';
2
+import { OpenAIResponsesProvider } from '@composio/openai';
3
+import OpenAI from 'openai';
4
+import { v4 as uuidv4 } from 'uuid';
5
+
6
+const openai = new OpenAI({
7
+ apiKey: process.env.OPENAI_API_KEY,
8
+});
9
+
10
+const composio = new Composio({
11
+ apiKey: process.env.COMPOSIO_API_KEY,
12
+ provider: new OpenAIResponsesProvider(),
13
+});
14
+
15
+const mcpConfig = await composio.mcp.create(
16
+ 'gmail-mcp',
17
+ [
18
+ {
19
+ toolkit: 'GMAIL',
20
+ allowedTools: ['GMAIL_FETCH_EMAILS'],
21
+ authConfigId: 'ac_GHetipM5x5s0',
22
+ },
23
+ ],
24
+ { useComposioManagedAuth: true }
25
+);
26
+
27
+console.log(`✅ MCP server created: ${mcpConfig.id}`);
28
+console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(', ')}`);
29
+
30
+// Retrieve server URLs for connected accounts
31
+const mcpTools = await mcpConfig.getServer({
32
+ userId: "sid"
33
+});
34
+
35
+console.log('MCP Tools:', mcpTools);
36
+
37
+const completion = await openai.responses.create({
38
+ model: 'gpt-4o-mini',
39
+ input:
40
+ "I've connected to Gmail and I want to fetch the latest email from my inbox and summarize it",
41
+ tools: mcpTools,
42
+});
43
+
44
+console.log('\n📬 Email Summary:');
45
+console.log(completion.output_text);
46
+
47
+console.log('\n✅ OpenAI MCP example completed successfully!');
48
+console.log(
49
+ '\n💡 Note: The MCP server URLs can also be used to connect from other MCP-compatible clients.'
50
+);
51
+console.log(`📍 Server ID for future reference: ${mcpConfig.id}`);