marketing Activity Createmutation
mutation
2024-10latest
Requires write
access scope.
Create new marketing activity.
Arguments
The Input of marketing activity create.
Was this section helpful?
MarketingActivityCreatePayload returns
The created marketing activity.
The path to return back to shopify admin from embedded editor.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: marketingActivityCreate
Query Reference for MUTATION: marketingActivityCreate
"mutation marketingActivityCreate($input: MarketingActivityCreateInput!) {\n marketingActivityCreate(input: $input) {\n marketingActivity {\n # MarketingActivity fields\n }\n redirectPath\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: marketingActivityCreate
"{\n \"input\": {\n \"budget\": {\n \"budgetType\": \"DAILY\",\n \"total\": {\n \"amount\": \"29.99\",\n \"currencyCode\": \"AED\"\n }\n },\n \"context\": \"<your-context>\",\n \"formData\": \"<your-formData>\",\n \"marketingActivityExtensionId\": \"gid://shopify/<objectName>/10079785100\",\n \"marketingActivityTitle\": \"<your-marketingActivityTitle>\",\n \"status\": \"ACTIVE\",\n \"urlParameterValue\": \"<your-urlParameterValue>\",\n \"utm\": {\n \"campaign\": \"<your-campaign>\",\n \"medium\": \"<your-medium>\",\n \"source\": \"<your-source>\"\n }\n }\n}"
Schema Reference for MUTATION: marketingActivityCreate
"input MarketingActivityCreateInput {\n budget: MarketingActivityBudgetInput\n context: String\n formData: String\n marketingActivityExtensionId: ID!\n marketingActivityTitle: String\n status: MarketingActivityStatus!\n urlParameterValue: String\n utm: UTMInput\n}\n\ninput MarketingActivityBudgetInput {\n budgetType: MarketingBudgetBudgetType\n total: MoneyInput\n}\n\ninput UTMInput {\n campaign: String!\n medium: String!\n source: String!\n}\n"
Display Examples for MUTATION: marketingActivityCreate
[ { "example": { "type_name": "marketingactivitycreate", "title": "Create a DRAFT marketing activity for a specific marketing activity extension", "query_string": "mutation marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) {\n marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) {\n marketingActivity {\n id\n title\n status\n }\n }\n}", "variables": { "marketingActivityTitle": "Draft Marketing Activity", "marketingActivityExtensionId": "gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f", "context": "eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==", "status": "DRAFT" }, "response": { "data": { "marketingActivityCreate": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/1063897335", "title": "Draft Marketing Activity", "status": "DRAFT" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchant_marketing/test/unit/graph_api/admin/mutations/marketing_activity_create_test.rb", "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 marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) { marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) { marketingActivity { id title status } } }\",\n \"variables\": {\n \"marketingActivityTitle\": \"Draft Marketing Activity\",\n \"marketingActivityExtensionId\": \"gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f\",\n \"context\": \"eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==\",\n \"status\": \"DRAFT\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) {\n marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }`,\n {\n variables: {\n \"marketingActivityTitle\": \"Draft Marketing Activity\",\n \"marketingActivityExtensionId\": \"gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f\",\n \"context\": \"eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==\",\n \"status\": \"DRAFT\"\n },\n },\n);\n\nconst data = await response.json();\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 marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) {\n marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }\nQUERY\n\nvariables = {\n \"marketingActivityTitle\": \"Draft Marketing Activity\",\n \"marketingActivityExtensionId\": \"gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f\",\n \"context\": \"eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==\",\n \"status\": \"DRAFT\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) {\n marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }`,\n \"variables\": {\n \"marketingActivityTitle\": \"Draft Marketing Activity\",\n \"marketingActivityExtensionId\": \"gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f\",\n \"context\": \"eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==\",\n \"status\": \"DRAFT\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation marketingActivityCreate($marketingActivityTitle: String!, $marketingActivityExtensionId: ID!, $context: String!, $status: MarketingActivityStatus!) {\n marketingActivityCreate(input: {marketingActivityTitle: $marketingActivityTitle, marketingActivityExtensionId: $marketingActivityExtensionId, status: $status, context: $context}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }\nQUERY;\n\n$variables = [\n \"marketingActivityTitle\" => \"Draft Marketing Activity\",\n \"marketingActivityExtensionId\" => \"gid://shopify/MarketingActivityExtension/666dcce8-6389-425f-bcf0-6c9469b6716f\",\n \"context\" => \"eyJtYXJrZXRpbmdfY2FtcGFpZ25faWQiOiI2NDYzMzc3NDMifQ==\",\n \"status\" => \"DRAFT\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [] } ]