사용자가 Instagram 스토리로 콘텐츠를 공유할 수 있도록 Android와 iOS 앱에 공유를 통합합니다. 새 앱을 만들려면 Android용 Facebook SDK로 시작하기 및 iOS용 Facebook SDK로 시작하기를 참조하세요.

2023년 1월부터 Instagram 스토리에 콘텐츠를 공유하려면 Facebook 앱 ID를 제공해야 합니다. 자세한 내용은 Instagram 스토리에 공유하기에 대한 중요 업데이트 안내를 참조하세요. 앱 ID를 제공하지 않을 경우 사용자가 Instagram에 콘텐츠를 공유하려고 시도할 때 "공유한 앱이 현재 스토리에 공유하기를 지원하지 않습니다"라는 오류 메시지가 표시됩니다. 앱 ID를 찾으려면 앱 ID 받기(Android)와 앱 ID 받기(iOS)를 참조하세요.
Android 암시적 인텐트 및 iOS 맞춤 URL 스키마를 사용하면 앱에서 사진, 동영상과 스티커를 Instagram 앱으로 전달할 수 있습니다. Instagram 앱이 해당 콘텐츠를 받아서 스토리 작성기에 읽어들이면 사용자는 콘텐츠를 Instagram 스토리에 게시할 수 있습니다.
![]() | Instagram 앱의 스토리 작성기는 배경 레이어와 스티커 레이어로 구성됩니다. 배경 레이어배경 레이어는 화면을 채우며 사진, 동영상, 단색 또는 컬러 그래디언트로 맞춤 설정할 수 있습니다. 스티커 레이어스티커 레이어는 이미지를 포함할 수 있으며, 사용자가 스토리 작성기에서 레이어를 추가로 맞춤 설정할 수 있습니다. |
Android 구현에서는 암시적 인텐트를 사용해 Instagram 앱을 시작하고 콘텐츠를 전달합니다. 일반적으로 공유 플로는 다음과 같습니다.
스토리에 공유하면 다음의 데이터가 전송됩니다.
| 콘텐츠 | 유형 | 설명 |
|---|---|---|
Facebook 앱 ID | 문자열 | |
배경 자산 | 이미지 자산(JPG, PNG) 또는 동영상 자산(H.264, H.265, WebM)에 대한 URI. 최소 크기: 720x1280. 권장 이미지 비율 9:16 또는 9:18. 동영상의 화질은 1080p일 수 있으며 최대 재생 시간은 20초입니다. Uri는 기기의 로컬 파일에 대한 콘텐츠 Uri이어야 합니다. 배경 자산, 스티커 자산 또는 그 두 가지를 모두 보내야 합니다. | |
스티커 자산 | 이미지 자산(JPG, PNG)에 대한 URI. 권장 크기: 640x480. 이 이미지는 배경 위에 스티커로 표시됩니다. Uri는 기기의 로컬 파일에 대한 콘텐츠 Uri이어야 합니다. 배경 자산, 스티커 자산 또는 그 두 가지를 모두 보내야 합니다. | |
배경 레이어 상단 색상 | 문자열 | 배경 레이어 하단 색상 값과 함께 사용하는 16진수 문자열 색상 값. 두 값이 동일할 경우 배경 레이어는 단색이 됩니다. 두 값이 다르면 그래디언트를 생성하는 데 사용합니다. 배경 자산을 지정할 경우 그 자산을 사용하고 이 값은 무시합니다. |
배경 레이어 하단 색상 | 문자열 | 배경 레이어 상단 색상 값과 함께 사용하는 16진수 문자열 색상 값. 두 값이 동일할 경우 배경 레이어는 단색이 됩니다. 두 값이 다르면 그래디언트를 생성하는 데 사용합니다. 배경 자산을 지정할 경우 그 자산을 사용하고 이 값은 무시합니다. |
다음의 코드 예시는 사용자가 Instagram 스토리에 게시할 수 있도록 이미지를 Instagram에 보냅니다.
// Instantiate an intent
Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");
// Attach your App ID to the intent
String sourceApplication = "1234567"; // This is your application's FB ID
intent.putExtra("source_application", sourceApplication);
// Attach your image to the intent from a URI
Uri backgroundAssetUri = Uri.parse("your-image-asset-uri-goes-here");
intent.setDataAndType(backgroundAssetUri, MEDIA_TYPE_JPEG);
// Grant URI permissions for the image
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Instantiate an activity
Activity activity = getActivity();
// Verify that the activity resolves the intent and start it
if (activity.getPackageManager().resolveActivity(intent, 0) != null) {
activity.startActivityForResult(intent, 0);
} 이 코드 예시에서는 스티커 레이어 이미지 자산과 배경 레이어 색상 세트를 Instagram으로 보냅니다. 배경 레이어 색상을 지정하지 않을 경우 #222222로 설정됩니다.
// Instantiate an intent
Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");
// Attach your App ID to the intent
String sourceApplication = "1234567"; // This is your application's FB ID
intent.putExtra("source_application", sourceApplication);
// Attach your sticker to the intent from a URI, and set background colors
Uri stickerAssetUri = Uri.parse("your-image-asset-uri-goes-here");
intent.setType(MEDIA_TYPE_JPEG);
intent.putExtra("interactive_asset_uri", stickerAssetUri);
intent.putExtra("top_background_color", "#33FF33");
intent.putExtra("bottom_background_color", "#FF00FF");
// Instantiate an activity
Activity activity = getActivity();
// Grant URI permissions for the sticker
activity.grantUriPermission(
"com.instagram.android", stickerAssetUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Verify that the activity resolves the intent and start it
if (activity.getPackageManager().resolveActivity(intent, 0) != null) {
activity.startActivityForResult(intent, 0);
}이 예시에서는 배경 레이어 이미지 자산과 스티커 레이어 이미지 자산을 Instagram으로 보냅니다.
// Instantiate an intent
Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");
// Attach your App ID to the intent
String sourceApplication = "1234567"; // This is your application's FB ID
intent.putExtra("source_application", sourceApplication);
// Attach your image to the intent from a URI
Uri backgroundAssetUri = Uri.parse("your-background-image-asset-uri-goes-here");
intent.setDataAndType(backgroundAssetUri, MEDIA_TYPE_JPEG);
// Attach your sticker to the intent from a URI
Uri stickerAssetUri = Uri.parse("your-sticker-image-asset-uri-goes-here");
intent.putExtra("interactive_asset_uri", stickerAssetUri);
// Grant URI permissions for the image
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Instantiate an activity
Activity activity = getActivity();
// Grant URI permissions for the sticker
activity.grantUriPermission(
"com.instagram.android", stickerAssetUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
// Verify that the activity resolves the intent and start it
if (activity.getPackageManager().resolveActivity(intent, 0) != null) {
activity.startActivityForResult(intent, 0);
}iOS 구현에서는 맞춤 URL 스키마를 사용해 Instagram 앱을 시작하고 콘텐츠를 전달합니다. 일반적으로 공유 플로는 다음과 같습니다.
스토리에 공유하면 다음의 데이터가 전송됩니다.
| 콘텐츠 | 유형 | 설명 |
|---|---|---|
Facebook 앱 ID | ||
배경 이미지 자산 | 지원되는 형식(JPG, PNG)의 이미지 자산에 대한 데이터. 최소 크기: 720x1280. 권장 이미지 비율 9:16 또는 9:18. Instagram 앱에 배경 자산(이미지 또는 동영상), 스티커 자산 또는 두 가지를 모두 전달해야 합니다. | |
배경 동영상 자산 | 지원되는 형식(H.264, H.265, WebM)의 동영상 자산에 대한 데이터. 동영상의 화질은 1080p일 수 있으며 최대 재생 시간은 20초입니다. 50MB 미만을 권장합니다. Instagram 앱에 배경 자산(이미지 또는 동영상), 스티커 자산 또는 두 가지를 모두 전달해야 합니다. | |
스티커 자산 | 지원되는 형식(JPG, PNG)의 이미지 자산에 대한 데이터. 권장 크기: 640x480. 이 이미지는 배경 위에 스티커로 표시됩니다. Instagram 앱에 배경 자산(이미지 또는 동영상), 스티커 자산 또는 두 가지를 모두 전달해야 합니다. | |
배경 레이어 상단 색상 | 배경 레이어 하단 색상 값과 함께 사용하는 16진수 문자열 색상 값. 두 값이 동일할 경우 배경 레이어는 단색이 됩니다. 두 값이 다르면 그래디언트를 생성하는 데 사용합니다. | |
배경 레이어 하단 색상 | 배경 레이어 하단 색상 값과 함께 사용하는 16진수 문자열 색상 값. 두 값이 동일할 경우 배경 레이어는 단색이 됩니다. 두 값이 다르면 그래디언트를 생성하는 데 사용합니다. |
앱에서 Instagram의 맞춤 URL 스키마를 사용하려면 이를 등록해야 합니다. 앱의 Info.plist에 있는 LSApplicationQueriesSchemes 키에 instagram-stories를 추가합니다.
다음의 코드 예시는 사용자가 배경 레이어 이미지 자산을 수정하고 Instagram 스토리에 게시할 수 있도록 이를 Instagram에 보냅니다.
- (void)shareBackgroundImage
{
// Identify your App ID
NSString *const appIDString = @"1234567890";
// Call method to share image
[self backgroundImage:UIImagePNGRepresentation([UIImage imageNamed:@"backgroundImage"])
appID:appIDString];
}
// Method to share image
- (void)backgroundImage:(NSData *)backgroundImage
appID:(NSString *)appID
{
NSURL *urlScheme = [NSURL URLWithString:[NSString stringWithFormat:@"instagram-stories://share?source_application=%@", appID]];
if ([[UIApplication sharedApplication] canOpenURL:urlScheme])
{
// Attach the pasteboard items
NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : backgroundImage}];
// Set pasteboard options
NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
// This call is iOS 10+, can use 'setItems' depending on what versions you support
[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
[[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
}
else
{
// Handle error cases
}
} 이 코드 샘플은 Instagram 앱에 스티커 레이어 이미지 자산과 배경 레이어 색상 세트를 전달하는 방법을 보여줍니다. 배경 레이어 색상을 지정하지 않을 경우 #222222로 설정됩니다.
- (void)shareStickerImage
{
// Identify your App ID
NSString *const appIDString = @"1234567890";
// Call method to share sticker
[self stickerImage:UIImagePNGRepresentation([UIImage imageNamed:@"stickerImage"])
backgroundTopColor:@"#444444"
backgroundBottomColor:@"#333333"
appID:appIDString];
}
// Method to share sticker
- (void)stickerImage:(NSData *)stickerImage
backgroundTopColor:(NSString *)backgroundTopColor
backgroundBottomColor:(NSString *)backgroundBottomColor
appID:(NSString *)appID
{
NSURL *urlScheme = [NSURL URLWithString:[NSString stringWithFormat:@"instagram-stories://share?source_application=%@", appID]];
if ([[UIApplication sharedApplication] canOpenURL:urlScheme])
{
// Attach the pasteboard items
NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.stickerImage" : stickerImage,
@"com.instagram.sharedSticker.backgroundTopColor" : backgroundTopColor,
@"com.instagram.sharedSticker.backgroundBottomColor" : backgroundBottomColor}];
// Set pasteboard options
NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
// This call is iOS 10+, can use 'setItems' depending on what versions you support
[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
[[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
}
else
{
// Handle error cases
}
}이 코드 샘플은 Instagram 앱에 배경 레이어 이미지 자산과 스티커 레이어 이미지 자산을 전달하는 방법을 보여줍니다.
- (void)shareBackgroundAndStickerImage
{
// Identify your App ID
NSString *const appIDString = @"1234567890";
// Call method to share image and sticker
[self backgroundImage:UIImagePNGRepresentation([UIImage imageNamed:@"backgroundImage"])
stickerImage:UIImagePNGRepresentation([UIImage imageNamed:@"stickerImage"])
appID:appIDString];
}
// Method to share image and sticker
- (void)backgroundImage:(NSData *)backgroundImage
stickerImage:(NSData *)stickerImage
appID:(NSString *)appID
{
NSURL *urlScheme = [NSURL URLWithString:[NSString stringWithFormat:@"instagram-stories://share?source_application=%@", appID]];
if ([[UIApplication sharedApplication] canOpenURL:urlScheme])
{
// Attach the pasteboard items
NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : backgroundImage,
@"com.instagram.sharedSticker.stickerImage" : stickerImage}];
// Set pasteboard options
NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
// This call is iOS 10+, can use 'setItems' depending on what versions you support
[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
[[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];
}
else
{
// Handle error cases
}
}앱 사용자가 콘텐츠를 Facebook 스토리에 공유하도록 지원할 수도 있습니다. 이에 관한 방법은 Facebook 스토리에 공유하기 문서를 참조하세요.