← Stripe + Twilio integrations

Make a Phone Call with Twilio API on New Custom Webhook Events from Stripe API

Pipedream makes it easy to connect APIs for Twilio, Stripe and 800+ other apps remarkably fast.

Trigger workflow on
New Custom Webhook Events from the Stripe API
Next, do this
Make a Phone Call with the Twilio API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Stripe trigger and Twilio action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Custom Webhook Events trigger
    1. Connect your Stripe account
    2. Select one or more Events
  3. Configure the Make a Phone Call action
    1. Connect your Twilio account
    2. Select a From
    3. Configure To
    4. Configure Text
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger


This integration uses pre-built, open source components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.


Description:Emit new event on each webhook event

Trigger Code

import stripe from "../../stripe.app.mjs";
import constants from "../common/constants.mjs";

export default {
  key: "stripe-custom-webhook-events",
  name: "New Custom Webhook Events",
  type: "source",
  version: "0.0.4",
  description: "Emit new event on each webhook event",
  props: {
    enabledEvents: {
      type: "string[]",
      label: "Events",
      description: "Events to listen for. Select `*` for all events",
      options: constants.WEBHOOK_EVENTS,
      default: [
    /* eslint-disable pipedream/props-label */
    /* eslint-disable pipedream/props-description */
    http: {
      type: "$.interface.http",
      customResponse: true,
    /* eslint-enable pipedream/props-description */
    /* eslint-enable pipedream/props-label */
    db: "$.service.db",
  hooks: {
    async activate() {
      let enabledEvents = this.enabledEvents;
      if (enabledEvents.includes("*")) enabledEvents = [
      const endpoint = await this.stripe.sdk().webhookEndpoints.create({
        url: this.http.endpoint,
        enabled_events: enabledEvents,
      this.db.set("endpoint", JSON.stringify(endpoint));

      for (const eventType of this.enabledEvents) {
        const events = await this.stripe.getEvents({

        for (const event of events) {
    async deactivate() {
      const endpoint = this.getEndpoint();
      this.db.set("endpoint", null);
      if (!endpoint) return;
      const confirmation = await this.stripe.sdk().webhookEndpoints.del(endpoint.id);
      if ("deleted" in confirmation && !confirmation.deleted) {
        throw new Error("endpoint not deleted");
  run(event) {
    const endpoint = this.getEndpoint();
    if (!endpoint) {
        status: 500,
      throw new Error("endpoint config missing from db");
    const sig = event.headers["stripe-signature"];
    try {
      event = this.stripe.sdk().webhooks.constructEvent(event.bodyRaw, sig, endpoint.secret);
    } catch (err) {
        status: 400,
        body: err.message,
      status: 200,

  methods: {
    emit(event) {
      this.$emit(event, {
        id: event.id,
        summary: `New event ${event.type} with id ${event.data.id}`,
        ts: Date.parse(event.created),
    getEndpoint() {
      let endpoint;
      const endpointJson = this.db.get("endpoint");
      try {
        endpoint = JSON.parse(endpointJson);
      } catch (err) {
      return endpoint;

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
StripestripeappThis component uses the Stripe app.
EventsenabledEventsstring[]Select a value from the drop down menu:*account.application.authorizedaccount.application.deauthorizedaccount.external_account.createdaccount.external_account.deletedaccount.external_account.updatedaccount.updatedapplication_fee.createdapplication_fee.refund.updatedapplication_fee.refundedbalance.availablecapability.updatedcharge.capturedcharge.dispute.closedcharge.dispute.createdcharge.dispute.funds_reinstatedcharge.dispute.funds_withdrawncharge.dispute.updatedcharge.expiredcharge.failedcharge.pendingcharge.refund.updatedcharge.refundedcharge.succeededcharge.updatedcheckout.session.async_payment_failedcheckout.session.async_payment_succeededcheckout.session.completedcoupon.createdcoupon.deletedcoupon.updatedcredit_note.createdcredit_note.updatedcredit_note.voidedcustomer.createdcustomer.deletedcustomer.discount.createdcustomer.discount.deletedcustomer.discount.updatedcustomer.source.createdcustomer.source.deletedcustomer.source.expiringcustomer.source.updatedcustomer.subscription.createdcustomer.subscription.deletedcustomer.subscription.pending_update_appliedcustomer.subscription.pending_update_expiredcustomer.subscription.trial_will_endcustomer.subscription.updatedcustomer.tax_id.createdcustomer.tax_id.deletedcustomer.tax_id.updatedcustomer.updatedfile.createdinvoice.createdinvoice.deletedinvoice.finalizedinvoice.marked_uncollectibleinvoice.paidinvoice.payment_action_requiredinvoice.payment_failedinvoice.payment_succeededinvoice.sentinvoice.upcominginvoice.updatedinvoice.voidedinvoiceitem.createdinvoiceitem.deletedinvoiceitem.updatedissuing_authorization.createdissuing_authorization.requestissuing_authorization.updatedissuing_card.createdissuing_card.updatedissuing_cardholder.createdissuing_cardholder.updatedissuing_dispute.createdissuing_dispute.funds_reinstatedissuing_dispute.updatedissuing_transaction.createdissuing_transaction.updatedmandate.updatedorder.createdorder.payment_failedorder.payment_succeededorder.updatedorder_return.createdpayment_intent.amount_capturable_updatedpayment_intent.canceledpayment_intent.createdpayment_intent.payment_failedpayment_intent.processingpayment_intent.succeededpayment_method.attachedpayment_method.card_automatically_updatedpayment_method.detachedpayment_method.updatedpayout.canceledpayout.createdpayout.failedpayout.paidpayout.updatedperson.createdperson.deletedperson.updatedplan.createdplan.deletedplan.updatedprice.createdprice.deletedprice.updatedproduct.createdproduct.deletedproduct.updatedradar.early_fraud_warning.createdradar.early_fraud_warning.updatedrecipient.createdrecipient.deletedrecipient.updatedreporting.report_run.failedreporting.report_run.succeededreporting.report_type.updatedreview.closedreview.openedsetup_intent.canceledsetup_intent.createdsetup_intent.setup_failedsetup_intent.succeededsigma.scheduled_query_run.createdsku.createdsku.deletedsku.updatedsource.canceledsource.chargeablesource.failedsource.mandate_notificationsource.refund_attributes_requiredsource.transaction.createdsource.transaction.updatedsubscription_schedule.abortedsubscription_schedule.canceledsubscription_schedule.completedsubscription_schedule.createdsubscription_schedule.expiringsubscription_schedule.releasedsubscription_schedule.updatedtax_rate.createdtax_rate.updatedtopup.canceledtopup.createdtopup.failedtopup.reversedtopup.succeededtransfer.createdtransfer.failedtransfer.paidtransfer.reversedtransfer.updated
N/Ahttp$.interface.httpThis component uses $.interface.http to generate a unique URL when the component is first instantiated. Each request to the URL will trigger the run() method of the component.
N/Adb$.service.dbThis component uses $.service.db to maintain state between component invocations.

Trigger Authentication

Stripe uses API keys for authentication. When you connect your Stripe account, Pipedream securely stores the keys so you can easily authenticate to Stripe APIs in both code and no-code steps.

  1. Create a Stripe API key. We recommend you restrict this API key to only operations you need to execute from Pipedream (e.g. a read-only key).

  2. Enter the API key below

About Stripe

Payment Platform


Description:Make a phone call, passing text that Twilio will speak to the recipient of the call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource) for more information

Action Code

// Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
import twilio from "../../twilio.app.mjs";
import { phone } from "phone";

export default {
  key: "twilio-make-phone-call",
  name: "Make a Phone Call",
  description: "Make a phone call, passing text that Twilio will speak to the recipient of the call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource) for more information",
  version: "0.0.7",
  type: "action",
  props: {
    from: {
      propDefinition: [
    to: {
      propDefinition: [
    text: {
      label: "Text",
      type: "string",
      description: "The text you'd like Twilio to speak to the user when they pick up the phone.",
  async run({ $ }) {
    // Parse the given number into its E.164 equivalent
    // The E.164 phone number will be included in the first element
    // of the array, but the array will be empty if parsing fails.
    // See https://www.npmjs.com/package/phone
    const toParsed = phone(this.to);
    if (!toParsed || !toParsed.phoneNumber) {
      throw new Error(`Phone number ${this.to} couldn't be parsed as a valid number.`);

    const data = {
      to: toParsed.phoneNumber,
      from: this.from,
      twiml: `<Response><Say>${this.text}</Say></Response>`,

    const resp = await this.twilio.getClient().calls.create(data);
    $.export("$summary", `Successfully made a new phone call, "${this.twilio.callToString(resp)}"`);
    return resp;

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

TwiliotwilioappThis component uses the Twilio app.
FromfromstringSelect a value from the drop down menu.

The destination phone number in E.164 format. Format with a + and country code (e.g., +16175551212).


The text you'd like Twilio to speak to the user when they pick up the phone.

Action Authentication

Twilio uses API keys for authentication. When you connect your Twilio account, Pipedream securely stores the keys so you can easily authenticate to Twilio APIs in both code and no-code steps.

  1. Create an API key in Twilio. There are two types of keys: Master and Standard. You'll need a Master key to interact with certain API endpoints, like /Accounts. If you don't need to interact with those endpoints, you can use a Standard key.

  2. After creating your key, you'll see an Sid and Secret. Enter those in the fields below.

  3. Visit your Twilio Dashboard. You'll see your Account SID listed near the top. Enter that in the AccountSid field below.

About Twilio

Cloud communications platform for building SMS, Voice & Messaging applications on an API built for global scale

More Ways to Connect Twilio + Stripe

Cancel a Payment Intent with the Stripe API

Cancel a payment intent. Once canceled, no additional charges will be made by the payment intent and any operations on the payment intent will fail with an error. For payment intents with status=requires_capture, the remaining amount_capturable will automatically be refunded. See the docs for more information

Try it
Cancel Or Reverse a Payout with the Stripe API

Cancel or reverse a payout. A payout can be canceled only if it has not yet been paid out. A payout can be reversed only if it has already been paid out. Funds will be refunded to your available balance. See the docs for more information

Try it