Tags: Products, SMS
This task is a demonstration of sending text messages via Nexmo. In this task, we monitor for newly-created products, and we send a text message about the product to a phone number stored in that product's metafield.
- View in the task library: tasks.mechanic.dev/send-an-sms-via-nexmo-when-a-product-is-created
- Task JSON, for direct import: task.json
- Preview task code: script.liquid
{
"message_content__required_multiline": "{{ product.title }} is now available!\n\nhttps://{{ shop.domain }}/products/{{ product.handle }}",
"phone_number_metafield_namespace__required": null,
"phone_number_metafield_key__required": null,
"nexmo_api_key__required": null,
"nexmo_api_secret__required": null,
"nexmo_sms_phone_number__required": null,
"test_mode__boolean": true,
"default_country_code__number": null,
"minutes_to_wait_before_sending__number": null
}
Learn about task options in Mechanic
shopify/products/create{% if options.minutes_to_wait_before_sending__number != blank %}+{{ options.minutes_to_wait_before_sending__number }}.minutes{% endif %}
Learn about event subscriptions in Mechanic
This task is a demonstration of sending text messages via Nexmo. In this task, we monitor for newly-created products, and we send a text message about the product to a phone number stored in that product's metafield.
This task monitors for newly-created products, and sends a text message about the product to a phone number stored in that product's metafield. If there is no number stored, or the number is invalid, no message will be sent.
Notes:
- Nexmo requires all phone numbers to have a country code. If a phone number encountered appears to be an invalid international number, this task will try to add whatever value you've got in the "Default country code" option.
- Your Nexmo information (API key/secret, and SMS phone number) can be found on the Nexmo dashboard's "Getting started" page
- Use test mode to have this task report the message that it would send, if test mode was not enabled
Find this task in the library at tasks.mechanic.dev, and use the "Try this task" button. Or, import this task's JSON export – see Importing and exporting tasks to learn how imports work.
Found a bug? Got an improvement to add? Start here: ../../CONTRIBUTING.md.
Submit your task requests for consideration by the Mechanic community, and they may be chosen for development and inclusion in the task library!