# marketingActivityUpdateExternal - admin-graphql - MUTATION Version: 2024-10 ## Description Update an external marketing activity. ### Access Scopes `write_marketing_events` access scope. ## Arguments * [input](/docs/api/admin-graphql/2024-10/input-objects/MarketingActivityUpdateExternalInput): MarketingActivityUpdateExternalInput! - The input field for updating an external marketing activity. * [marketingActivityId](/docs/api/admin-graphql/2024-10/scalars/ID): ID - The ID of the marketing activity. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity. * [remoteId](/docs/api/admin-graphql/2024-10/scalars/String): String - The ID of an activity that's hosted outside of Shopify. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity. * [utm](/docs/api/admin-graphql/2024-10/input-objects/UTMInput): UTMInput - Specifies the [Urchin Traffic Module (UTM) parameters](https://en.wikipedia.org/wiki/UTM_parameters) that are associated with a related marketing campaign. Specify either the marketing activity ID, remote ID, or UTM to update the marketing activity. ## Returns * [marketingActivity](/docs/api/admin-graphql/2024-10/objects/MarketingActivity): MarketingActivity The updated marketing activity. * [userErrors](/docs/api/admin-graphql/2024-10/objects/MarketingActivityUserError): MarketingActivityUserError! The list of errors that occurred from executing the mutation. ## Examples ### Update an external marketing activity and its status Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) { marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) { marketingActivity { id title marketingEvent { manageUrl previewUrl } } } }\",\n \"variables\": {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\",\n \"status\": \"PAUSED\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n \"variables\": {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\",\n \"status\": \"PAUSED\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\",\n \"status\": \"PAUSED\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n {\n variables: {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\",\n \"status\": \"PAUSED\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n}" #### Graphql Input { "remoteId": "abcdefg", "updateInput": { "title": "New Title", "remoteUrl": "https://example.com", "remotePreviewImageUrl": "https://example.com", "status": "PAUSED" } } #### Graphql Response { "data": { "marketingActivityUpdateExternal": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/36187062", "title": "New Title", "marketingEvent": { "manageUrl": "https://example.com", "previewUrl": "https://example.com" } } } } } ### Update an external marketing activity using the remote id Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) { marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) { marketingActivity { id title marketingEvent { manageUrl previewUrl } } } }\",\n \"variables\": {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n \"variables\": {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n {\n variables: {\n \"remoteId\": \"abcdefg\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketingActivityUpdateExternal($remoteId: String!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(remoteId: $remoteId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n}" #### Graphql Input { "remoteId": "abcdefg", "updateInput": { "title": "New Title", "remoteUrl": "https://example.com", "remotePreviewImageUrl": "https://example.com" } } #### Graphql Response { "data": { "marketingActivityUpdateExternal": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/36187062", "title": "New Title", "marketingEvent": { "manageUrl": "https://example.com", "previewUrl": "https://example.com" } } } } } ### Update an external marketing activity using the utm parameters Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketingActivityUpdateExternal($utm: UTMInput!, $updateInput: MarketingActivityUpdateExternalInput!) { marketingActivityUpdateExternal(utm: $utm, input: $updateInput) { marketingActivity { id title marketingEvent { manageUrl previewUrl } } } }\",\n \"variables\": {\n \"utm\": {\n \"source\": \"email\",\n \"medium\": \"newsletter\",\n \"campaign\": \"external-event-campaign\"\n },\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdateExternal($utm: UTMInput!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(utm: $utm, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n \"variables\": {\n \"utm\": {\n \"source\": \"email\",\n \"medium\": \"newsletter\",\n \"campaign\": \"external-event-campaign\"\n },\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation marketingActivityUpdateExternal($utm: UTMInput!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(utm: $utm, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"utm\": {\n \"source\": \"email\",\n \"medium\": \"newsletter\",\n \"campaign\": \"external-event-campaign\"\n },\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdateExternal($utm: UTMInput!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(utm: $utm, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n {\n variables: {\n \"utm\": {\n \"source\": \"email\",\n \"medium\": \"newsletter\",\n \"campaign\": \"external-event-campaign\"\n },\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketingActivityUpdateExternal($utm: UTMInput!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(utm: $utm, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n}" #### Graphql Input { "utm": { "source": "email", "medium": "newsletter", "campaign": "external-event-campaign" }, "updateInput": { "title": "New Title", "remoteUrl": "https://example.com", "remotePreviewImageUrl": "https://example.com" } } #### Graphql Response { "data": { "marketingActivityUpdateExternal": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/36187062", "title": "New Title", "marketingEvent": { "manageUrl": "https://example.com", "previewUrl": "https://example.com" } } } } } ### Updates a marketing event Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketingActivityUpdateExternal($marketingActivityId: ID!, $updateInput: MarketingActivityUpdateExternalInput!) { marketingActivityUpdateExternal(marketingActivityId: $marketingActivityId, input: $updateInput) { marketingActivity { id title marketingEvent { manageUrl previewUrl } } } }\",\n \"variables\": {\n \"marketingActivityId\": \"gid://shopify/MarketingActivity/36187062\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdateExternal($marketingActivityId: ID!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(marketingActivityId: $marketingActivityId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n \"variables\": {\n \"marketingActivityId\": \"gid://shopify/MarketingActivity/36187062\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation marketingActivityUpdateExternal($marketingActivityId: ID!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(marketingActivityId: $marketingActivityId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"marketingActivityId\": \"gid://shopify/MarketingActivity/36187062\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdateExternal($marketingActivityId: ID!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(marketingActivityId: $marketingActivityId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n }`,\n {\n variables: {\n \"marketingActivityId\": \"gid://shopify/MarketingActivity/36187062\",\n \"updateInput\": {\n \"title\": \"New Title\",\n \"remoteUrl\": \"https://example.com\",\n \"remotePreviewImageUrl\": \"https://example.com\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketingActivityUpdateExternal($marketingActivityId: ID!, $updateInput: MarketingActivityUpdateExternalInput!) {\n marketingActivityUpdateExternal(marketingActivityId: $marketingActivityId, input: $updateInput) {\n marketingActivity {\n id\n title\n marketingEvent {\n manageUrl\n previewUrl\n }\n }\n }\n}" #### Graphql Input { "marketingActivityId": "gid://shopify/MarketingActivity/36187062", "updateInput": { "title": "New Title", "remoteUrl": "https://example.com", "remotePreviewImageUrl": "https://example.com" } } #### Graphql Response { "data": { "marketingActivityUpdateExternal": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/36187062", "title": "New Title", "marketingEvent": { "manageUrl": "https://example.com", "previewUrl": "https://example.com" } } } } }