We currently have a custom activity used to send SMS, we are wondering if anyone has had any success making Ampscript/SSJS accessible within a custom activity in Journey Builder.

The idea here is that we have a text box that currently allows the marketing user to input text with the opportunity to use some personalization parameters using {{Contact.Attribute.DE.field}}. Though this is useful we would really love the ability for our marketing team to write ampscript/SSJS within the HTML modal and have it run the script as it would with email in content builder.

Currently, our HTML Modal looks like this, when we put in Ampscript for example the actual ampscript is saved as a string and doesn't execute.

enter image description here

The code for the HTML Modal is here:

  <!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="vendor/bower_components/salesforce-lightning-design-system/assets/styles/salesforce-lightning-design-system.min.css">     <link rel="stylesheet" href="css/styles.css">
    <script type="text/javascript" src="vendor/bower_components/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="js/require.js"></script>
    <script type="text/javascript">
        (function () {
            var config = {
                baseUrl: 'js'

            var dependencies = [

            require(config, dependencies);

    <div id="step1" class="step">
        <div class="slds-grid">

            <main class="slds-col">
               <img src="https://www.twilio.com/console/bundles/core/img/logo-wordmark.svg">
                <h3 style="margin-top: 10px; margin-bottom: 12px;">Please Input SMS Content You Would Like to Send</h3>
                <textarea style="color: black;" id="text-message-body" rows="8" cols="50" maxlength="460" ></textarea>
                <div id="textmessage_feedback"></div>




The JS used to parse the input text is used here:

var inArguments = hasInArguments ? payload['arguments'].execute.inArguments : {};


$.each(inArguments, function (index, inArgument) {
    $.each(inArgument, function (key, val) {

        if (key === 'TextMessage')

connection.trigger('updateButton', {
    button: 'next',
    text: 'done',
    visible: true

Is there some code that would allow us to run some ampscript in the modal prior to saving it to the POST body? Apologies for the long question, feel free to remove if not helpful.

I have seen this question asked before, but, the questions were somewhat generic so I thought I would add a more detailed question to the conversation. See below for other questions: Use SSJS in Custom Activity Using AMPScript in Custom Activity

  • 1
    ampscript is only processed when a message is being built by the OMM servers, there is nothing to compile ort execute the code outside of this – EazyE Oct 21 at 22:28
  • What about SSJS though? – Nate Harris Oct 21 at 23:19
  • 1
    Both are run in the same process flow, so if one will not compile, neither will the other. – Gortonington Oct 22 at 12:48
  • 1
    As the commenters have pointed out, you are not going to be able to use SSJS or Ampscript within a custom activity. You can write some logic on the app side to do lookups or dynamically format the message using user data, but that would be a custom process and you'd need to rebuild whatever ampscript functions you had planned on using (i.e. LookupRows turns into a SOAP/REST call to retrieve data from a data extension.) – Jason Hanshaw Oct 22 at 14:16
  • That makes sense, I wonder if there is a way you could write some vanilla js in the text box that would interact with fields using {{Contact.Attribute.DE.field}}. That would execute every time a contact passes through. The idea is to be able to modify the content without having to change the backend of the app every time we want to test something. – Nate Harris Oct 22 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.